Index: ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb =================================================================== diff -u -r1784 -r1785 --- ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb (.../CacheMapper.vb) (revision 1784) +++ ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb (.../CacheMapper.vb) (revision 1785) @@ -167,8 +167,18 @@ Dim employee As IEmployee = If(employeeInitials.Equals(String.Empty), Nothing, employees.FirstOrDefault(Function(employeeToCheck) employeeToCheck.Initials.Equals(employeeInitials))) 'Set the current state based on the enum value. If the quantity is 0, the status is automatically zero. Dim stateValue = ActivityStateEnum.Zero - If (.QuantityToProduce > 0) And (employee IsNot Nothing) Then + If (.QuantityToProduce > 0) Then stateValue = ActivityStateEnumMapper.GetActivityStateFromLetter(ExtractItemFromDataReader(Of Char)(dr, $"Status_{i}")) + If (employee Is Nothing) Then + employee = New Employee() + With employee + .FirstName = "VH" + .LastName = "Automation" + .PersonelNumber = 0 + .Number = 0 + .Initials = "" + End With + End If End If .State = ConvertEnumValueToActivityState(stateValue, activity, employee) End With Index: ActiviteitenOpvolging/ProductiePitching/domain/managers/implementations/EmployeeManager.vb =================================================================== diff -u -r1759 -r1785 --- ActiviteitenOpvolging/ProductiePitching/domain/managers/implementations/EmployeeManager.vb (.../EmployeeManager.vb) (revision 1759) +++ ActiviteitenOpvolging/ProductiePitching/domain/managers/implementations/EmployeeManager.vb (.../EmployeeManager.vb) (revision 1785) @@ -22,7 +22,7 @@ End Get End Property - Private ReadOnly _selectedEmployeesDictionary As new Dictionary(Of Integer, IEmployee) + Private ReadOnly _selectedEmployeesDictionary As New Dictionary(Of Integer, IEmployee) ''' Public ReadOnly Property SelectedEmployees As ICollection(Of IEmployee) Implements IEmployeeManager.SelectedEmployees Get @@ -41,7 +41,7 @@ ''' Public Function GetSelectedEmployee(employeeNumber As Integer) As IEmployee Implements IEmployeeManager.GetSelectedEmployee - If not _selectedEmployeesDictionary.ContainsKey(employeeNumber) Then + If Not _selectedEmployeesDictionary.ContainsKey(employeeNumber) Then Throw New InternalException($"Employee number for getting the selected value is invalid, key value: {employeeNumber}.") End If 'Get the value. @@ -51,7 +51,7 @@ ''' Public Sub SelectEmployee(employeeNumber As Integer, employee As IEmployee) Implements IEmployeeManager.SelectEmployee 'Employee number must be valid: exist in the dictionary. - If not _selectedEmployeesDictionary.ContainsKey(employeeNumber) Then + If Not _selectedEmployeesDictionary.ContainsKey(employeeNumber) Then Throw New InternalException($"Employee number for selecting an employee is invalid, key value: {employeeNumber}.") End If 'Employee can't be nothing.