Index: ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb
===================================================================
diff -u -r1728 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb (.../ActivityStateEnum.vb) (revision 1728)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb (.../ActivityStateEnum.vb) (revision 1744)
@@ -50,4 +50,19 @@
End Select
End Function
+ public Function GetLetterFromActivityState(activityState As ActivityStateEnum) As Char
+ Select Case activityState
+ Case ActivityStateEnum.Finished
+ Return "F"C
+ Case ActivityStateEnum.Stopped
+ Return "P"C
+ Case ActivityStateEnum.Started
+ Return "S"C
+ Case ActivityStateEnum.Defaulted
+ Return "D"C
+ Case Else
+ Return ""
+ End Select
+ End Function
+
End Module
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/IworkItemManager.vb
===================================================================
diff -u -r1736 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/IworkItemManager.vb (.../IworkItemManager.vb) (revision 1736)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/IworkItemManager.vb (.../IworkItemManager.vb) (revision 1744)
@@ -11,4 +11,7 @@
Sub FinishActivity(activity As IActivity)
Sub StopActivity(activity As IActivity)
+
+ Sub PauseActivities()
+
End Interface
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/DomainController.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/DomainController.vb (.../DomainController.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/DomainController.vb (.../DomainController.vb) (revision 1744)
@@ -87,6 +87,10 @@
_workItemManager.StopActivity(employee.CurrentActivity)
End Sub
+ Public Sub PauseActivitiesFromApp() Implements IDomainController.PauseActivitiesFromApp
+ _workItemManager.PauseActivities()
+ End Sub
+
#End Region
End Class
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/implementations/WorkItemManager.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/implementations/WorkItemManager.vb (.../WorkItemManager.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/managers/implementations/WorkItemManager.vb (.../WorkItemManager.vb) (revision 1744)
@@ -1,20 +1,37 @@
-Public Class WorkItemManager
+Imports ActiviteitenOpvolging.ServiceAgents
+Imports ActiviteitenOpvolging.ServiceAgents.Implementations
+
+Public Class WorkItemManager
Implements IWorkItemManager
+
+ Private ReadOnly _activiteitPerBatchServiceAgent As IActiviteitPerBatchServiceAgent
+ Public Sub New()
+ _ActiviteitPerBatchServiceAgent = New ActiviteitPerBatchServiceAgent
+ End Sub
+
'''
Public Function GiveWorkItems(workPostIndex As Integer, employees As List(Of IEmployee)) As ICollection(Of IWorkItem) Implements IWorkItemManager.GiveWorkItems
Return CacheMapper.GetData(workPostIndex, employees)
End Function
Public Sub StartActivity(activity As IActivity, employee As IEmployee) Implements IWorkItemManager.StartActivity
activity.StartActivity(employee)
+ _ActiviteitPerBatchServiceAgent.SetActivityState(activity, employee)
End Sub
Public Sub FinishActivity(activity As IActivity) Implements IWorkItemManager.FinishActivity
activity.FinishActivity()
+ _ActiviteitPerBatchServiceAgent.SetActivityState(activity)
End Sub
Public Sub StopActivity(activity As IActivity) Implements IWorkItemManager.StopActivity
activity.StopActivity()
+ _ActiviteitPerBatchServiceAgent.SetActivityState(activity)
End Sub
+
+ Public Sub PauseActivities() Implements IWorkItemManager.PauseActivities
+ _activiteitPerBatchServiceAgent.PauseActionsFromApp()
+ End Sub
+
End Class
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServiceAgent.vb
===================================================================
diff -u
--- ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServiceAgent.vb (revision 0)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServiceAgent.vb (revision 1744)
@@ -0,0 +1,39 @@
+Imports System.ServiceModel
+Imports ActiviteitenOpvolging
+Imports ActiviteitenOpvolging.configs
+
+Namespace ServiceAgents.Implementations
+
+ Public Class ActiviteitPerBatchServiceAgent
+ Implements IActiviteitPerBatchServiceAgent
+
+ Private Sub SetActivityState(activity As IActivity, employee As IEmployee) Implements IActiviteitPerBatchServiceAgent.SetActivityState
+ Try
+ Dim stateLetter = ActivityStateEnumMapper.GetLetterFromActivityState(activity.Status)
+ SoapClient().RegistreerActieByKey(activity.Id, stateLetter, employee.Initials, My.Application.Info.AssemblyName, System.Net.Dns.GetHostName())
+ Catch ex As Exception
+ Throw New Exception($"Can't reach the Caché webservice: {vbNewLine}{ex.Message}")
+ End Try
+ End Sub
+
+ Private Sub SetActivityState(activity As IActivity) Implements IActiviteitPerBatchServiceAgent.SetActivityState
+ SetActivityState(activity, activity.CurrentEmployee)
+ End Sub
+
+ Public Sub PauseActionsFromApp() Implements IActiviteitPerBatchServiceAgent.PauseActionsFromApp
+ Try
+ SoapClient().PauzeerActiesVanApp(My.Application.Info.AssemblyName, System.Net.Dns.GetHostName())
+ Catch ex As Exception
+ Throw New Exception($"Can't reach the Caché webservice: {vbNewLine}{ex.Message}")
+ End Try
+ End Sub
+
+ Private Function SoapClient() As ActiviteitPerBatchServerSoapClient
+ Dim binding = New BasicHttpBinding()
+ Dim address = New EndpointAddress(ConfigsLoader.CacheWebserviceUrl.Value)
+ Dim activiteitPerBatchClient = new ActiviteitPerBatchServerSoapClient(binding, address)
+ Return activiteitPerBatchClient
+ End Function
+
+ End Class
+End NameSpace
\ No newline at end of file
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServer.vb
===================================================================
diff -u
--- ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServer.vb (revision 0)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/Implementations/ActiviteitPerBatchServer.vb (revision 1744)
@@ -0,0 +1,106 @@
+'------------------------------------------------------------------------------
+'
+' Deze code is gegenereerd met een hulpprogramma.
+' Runtime-versie:4.0.30319.42000
+'
+' Als u wijzigingen aanbrengt in dit bestand, kan dit onjuist gedrag veroorzaken wanneer
+' de code wordt gegenereerd.
+'
+'------------------------------------------------------------------------------
+
+Option Strict Off
+Option Explicit On
+
+Imports System.Data
+
+Namespace ServiceAgents.Implementations
+
+
+ _
+ Public Interface ActiviteitPerBatchServerSoap
+
+ _
+ Function GeefActies(ByVal Werkpost As String) As System.Data.DataSet
+
+ _
+ Function GeefActiesAsync(ByVal Werkpost As String) As System.Threading.Tasks.Task(Of System.Data.DataSet)
+
+ _
+ Function PauzeerActiesVanApp(ByVal AppNaam As String, ByVal ComputerNaam As String) As String
+
+ _
+ Function PauzeerActiesVanAppAsync(ByVal AppNaam As String, ByVal ComputerNaam As String) As System.Threading.Tasks.Task(Of String)
+
+ _
+ Function RegistreerActieByKey(ByVal BatchResActKey As String, ByVal Status As String, ByVal Gebruiker As String, ByVal AppNaam As String, ByVal ComputerNaam As String) As String
+
+ _
+ Function RegistreerActieByKeyAsync(ByVal BatchResActKey As String, ByVal Status As String, ByVal Gebruiker As String, ByVal AppNaam As String, ByVal ComputerNaam As String) As System.Threading.Tasks.Task(Of String)
+ End Interface
+
+ _
+ Public Interface ActiviteitPerBatchServerSoapChannel
+ Inherits ActiviteitPerBatchServerSoap, System.ServiceModel.IClientChannel
+ End Interface
+
+ _
+ Partial Public Class ActiviteitPerBatchServerSoapClient
+ Inherits System.ServiceModel.ClientBase(Of ActiviteitPerBatchServerSoap)
+ Implements ActiviteitPerBatchServerSoap
+
+ Public Sub New()
+ MyBase.New
+ End Sub
+
+ Public Sub New(ByVal endpointConfigurationName As String)
+ MyBase.New(endpointConfigurationName)
+ End Sub
+
+ Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String)
+ MyBase.New(endpointConfigurationName, remoteAddress)
+ End Sub
+
+ Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As System.ServiceModel.EndpointAddress)
+ MyBase.New(endpointConfigurationName, remoteAddress)
+ End Sub
+
+ Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, ByVal remoteAddress As System.ServiceModel.EndpointAddress)
+ MyBase.New(binding, remoteAddress)
+ End Sub
+
+ Public Function GeefActies(ByVal Werkpost As String) As System.Data.DataSet Implements ActiviteitPerBatchServerSoap.GeefActies
+ Return MyBase.Channel.GeefActies(Werkpost)
+ End Function
+
+ Public Function GeefActiesAsync(ByVal Werkpost As String) As System.Threading.Tasks.Task(Of System.Data.DataSet) Implements ActiviteitPerBatchServerSoap.GeefActiesAsync
+ Return MyBase.Channel.GeefActiesAsync(Werkpost)
+ End Function
+
+ Public Function PauzeerActiesVanApp(ByVal AppNaam As String, ByVal ComputerNaam As String) As String Implements ActiviteitPerBatchServerSoap.PauzeerActiesVanApp
+ Return MyBase.Channel.PauzeerActiesVanApp(AppNaam, ComputerNaam)
+ End Function
+
+ Public Function PauzeerActiesVanAppAsync(ByVal AppNaam As String, ByVal ComputerNaam As String) As System.Threading.Tasks.Task(Of String) Implements ActiviteitPerBatchServerSoap.PauzeerActiesVanAppAsync
+ Return MyBase.Channel.PauzeerActiesVanAppAsync(AppNaam, ComputerNaam)
+ End Function
+
+ Public Function RegistreerActieByKey(ByVal BatchResActKey As String, ByVal Status As String, ByVal Gebruiker As String, ByVal AppNaam As String, ByVal ComputerNaam As String) As String Implements ActiviteitPerBatchServerSoap.RegistreerActieByKey
+ Return MyBase.Channel.RegistreerActieByKey(BatchResActKey, Status, Gebruiker, AppNaam, ComputerNaam)
+ End Function
+
+ Public Function RegistreerActieByKeyAsync(ByVal BatchResActKey As String, ByVal Status As String, ByVal Gebruiker As String, ByVal AppNaam As String, ByVal ComputerNaam As String) As System.Threading.Tasks.Task(Of String) Implements ActiviteitPerBatchServerSoap.RegistreerActieByKeyAsync
+ Return MyBase.Channel.RegistreerActieByKeyAsync(BatchResActKey, Status, Gebruiker, AppNaam, ComputerNaam)
+ End Function
+ End Class
+End NameSpace
\ No newline at end of file
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/IDomainController.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/IDomainController.vb (.../IDomainController.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/controllers/IDomainController.vb (.../IDomainController.vb) (revision 1744)
@@ -48,5 +48,8 @@
Sub FinishActivity(employeeNumber As Integer)
Sub StopActivity(employeeNumber As Integer)
+
+ Sub PauseActivitiesFromApp()
+
#End Region
End Interface
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb (.../EmployeeDetailUserControl.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb (.../EmployeeDetailUserControl.vb) (revision 1744)
@@ -107,7 +107,8 @@
Dim currentlySelectedActivity = _parentUserControl.GetCurrentlySelectedActivity()
'Update enable status of buttons.
- If IsNothing(employee.CurrentActivity) Then
+ Dim defaultStates() As ActivityStateEnum = {ActivityStateEnum.Finished }
+ If IsNothing(employee.CurrentActivity) Then
'No current activity.
StopButton.visible = False
FinishButton.visible = False
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb (.../EmployeeDetailUserControl.Designer.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb (.../EmployeeDetailUserControl.Designer.vb) (revision 1744)
@@ -119,9 +119,9 @@
'
Me.StartButton.Dock = System.Windows.Forms.DockStyle.Fill
Me.StartButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
- Me.StartButton.Location = New System.Drawing.Point(167, 363)
+ Me.StartButton.Location = New System.Drawing.Point(155, 363)
Me.StartButton.Name = "StartButton"
- Me.StartButton.Size = New System.Drawing.Size(158, 57)
+ Me.StartButton.Size = New System.Drawing.Size(178, 62)
Me.StartButton.TabIndex = 2
Me.StartButton.Text = "START"
Me.StartButton.UseVisualStyleBackColor = true
@@ -130,9 +130,9 @@
'
Me.StopButton.Dock = System.Windows.Forms.DockStyle.Fill
Me.StopButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
- Me.StopButton.Location = New System.Drawing.Point(167, 444)
+ Me.StopButton.Location = New System.Drawing.Point(155, 444)
Me.StopButton.Name = "StopButton"
- Me.StopButton.Size = New System.Drawing.Size(158, 57)
+ Me.StopButton.Size = New System.Drawing.Size(178, 62)
Me.StopButton.TabIndex = 5
Me.StopButton.TabStop = false
Me.StopButton.Text = "X"
@@ -142,9 +142,9 @@
'
Me.FinishButton.Dock = System.Windows.Forms.DockStyle.Fill
Me.FinishButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
- Me.FinishButton.Location = New System.Drawing.Point(167, 525)
+ Me.FinishButton.Location = New System.Drawing.Point(155, 525)
Me.FinishButton.Name = "FinishButton"
- Me.FinishButton.Size = New System.Drawing.Size(158, 57)
+ Me.FinishButton.Size = New System.Drawing.Size(178, 62)
Me.FinishButton.TabIndex = 4
Me.FinishButton.Text = "AFGEWERKT"
Me.FinishButton.UseVisualStyleBackColor = true
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1744)
@@ -30,6 +30,8 @@
'Load the user controls with the employees.
LoadEmployeeUserControls()
+ PauseActivitiesFromApp()
+
'Load all the data. Not done with the general method, because we want to catch the exceptions.
RefreshAllData()
@@ -43,6 +45,10 @@
End Try
End Sub
+ Private Sub PauseActivitiesFromApp()
+ _domainController.PauseActivitiesFromApp()
+ End Sub
+
'Refreshes all data. If fails, updates label with last timestamp of refresh.
Private Sub RefreshAllData()
dim allSuccessfulRefresh = RefreshUserGridsData()
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj
===================================================================
diff -u -r1743 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1743)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1744)
@@ -69,6 +69,7 @@
+
@@ -176,6 +177,9 @@
UserControl
+
+
+
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb
===================================================================
diff -u -r1737 -r1744
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb (.../Activity.vb) (revision 1737)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/Activity.vb (.../Activity.vb) (revision 1744)
@@ -34,10 +34,12 @@
'''
Public Sub StopActivity() Implements IActivityActions.StopActivity
State.StopActivity()
+ CurrentEmployee.CurrentActivity = Nothing
End Sub
'''
Public Sub FinishActivity() Implements IActivityActions.FinishActivity
State.FinishActivity()
+ CurrentEmployee.CurrentActivity = Nothing
End Sub
End Class
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/IActiviteitPerBatchServiceAgent.vb
===================================================================
diff -u
--- ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/IActiviteitPerBatchServiceAgent.vb (revision 0)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/ServiceAgents/IActiviteitPerBatchServiceAgent.vb (revision 1744)
@@ -0,0 +1,11 @@
+Namespace ServiceAgents
+ Public Interface IActiviteitPerBatchServiceAgent
+
+ Sub SetActivityState(activity As IActivity, employee As IEmployee)
+
+ Sub SetActivityState(activity As IActivity)
+
+ Sub PauseActionsFromApp()
+
+ End Interface
+End NameSpace
\ No newline at end of file