コード例 #1
0
        private void save()
        {
            if (!employee.Validate())
            {
                return;
            }

            ShowBusyIndicator();
            employee.CustomFields =
                customFieldValueList.Where(c => c.IsChecked).Select(c => c.Data as CustomFieldValueDTO).ToList();
            if (actionType == ActionType.AddEmployee)
            {
                employeeService.AddEmployee((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), employee);
            }
            else if (actionType == ActionType.ModifyEmployee)
            {
                employeeService.UpdateEmployee((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), employee);
            }
            else if (actionType == ActionType.ChangeEmployeePoint)
            {
                employeeService.ChangeEmployeePoint((exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), employee);
            }
        }
コード例 #2
0
        public void ConvertEmployees(Period period, List <JobPositionDTO> jobPositionInPeriodList)
        {
            Console.WriteLine("Starting employees Convert progress...");
            jobPositionList = jobPositionInPeriodList;
            var employeeIdList = employeeDataProvider.GetIds();

            totalEmployeesCount = employeeIdList.Count;

            foreach (var id in employeeIdList)
            {
                var sourceEmployeeDTO      = employeeDataProvider.GetEmployeeDetails(id);
                var desEmployeeDTO         = createDestinationEmployee(sourceEmployeeDTO, period);
                var employee               = employeeService.AddEmployee(desEmployeeDTO);
                var jobPosition            = jobPositionList.Single(c => c.TransferId == sourceEmployeeDTO.JobPositionTransferId);
                var employeeJobPositionDTO = createEmployeeJobPositionDTO(period, employee, jobPosition);//Selected jobPosition
                employeeService.AssignJobPositionsToEmployee(period.Id, employee.PersonnelNo,
                                                             employeeJobPositionDTO);
                employeeList.Add(employee);
                Console.WriteLine("Employee convert progress state: " + employeeList.Count + " From " +
                                  totalEmployeesCount);
            }

            publisher.Publish(new EmployeeConverted(employeeList));
        }