Example #1
0
 private void startDeleting(Period period, IEventPublisher publisher)
 {
     try
     {
         var employeeIdList = getAllEmployeeNo(period);
         foreach (var employeeNo in employeeIdList)
         {
             var srvManagerEmployeeService = employeeServiceFactory.Create();
             try
             {
                 var empService = srvManagerEmployeeService.GetService();
                 empService.DeleteFinalPoint(new EmployeeId(employeeNo, period.Id));
             }
             finally
             {
                 employeeServiceFactory.Release(srvManagerEmployeeService);
             }
         }
         IsBusy = false;
     }
     catch (Exception)
     {
         IsBusy = false;
     }
 }
Example #2
0
        public void Pause(Calculation calculation)
        {
            lock (operationLock)
            {
                if (string.IsNullOrWhiteSpace(calculation.LibraryText))
                {
                    throw new CalculationInvalidStateOperationException("Calculation", "Compiling", "Pause");
                }
                doPause = true;
                pauseTrigger.WaitOne();

                var employeeManagerService = employeeServiceFactory.Create();
                try
                {
                    var empService = employeeManagerService.GetService();
                    if (progress.LastCalculatedEmployeeId != null)
                    {
                        calculation.UpdateCalculationResult(progress.TotalItem, progress.ItemsCalculated,
                                                            messages, progress.LastCalculatedPath.Value, empService.GetBy(progress.LastCalculatedEmployeeId));
                    }
                    else
                    {
                        calculation.UpdateCalculationResult(progress.TotalItem, progress.ItemsCalculated, messages);
                    }
                }
                finally
                {
                    employeeServiceFactory.Release(employeeManagerService);
                }
            }
        }