Example #1
0
        private async Task <int> GetGeneralJobIndexesAsync(PeriodDTO periodDto)
        {
            var GeneralIndexesList = jobIndexDataProvider.GetGeneralIndexes();

            foreach (var TempGeneralIndex in GeneralIndexesList)
            {
                //var personDetail = employeeDataProvider.GetEmployeeDetails(id);
                var desGeneralJobIndex = new JobIndexDTO();
                desGeneralJobIndex.Name = TempGeneralIndex.IndexTitle;

                desGeneralJobIndex.CustomFields = new List <CustomFieldDTO>();

                jobIndexService.AddJobIndex(
                    (r, e) =>
                {
                    if (e != null)
                    {
                        throw new Exception("Error In General Job Indexes Converting");
                    }
                    ProgressCount++;
                }, desGeneralJobIndex);
                //System.Threading.Thread.Sleep(500);
            }
            return(ProgressCount);
        }
Example #2
0
        public void ConvertJobIndex(Period period)
        {
            Console.WriteLine("Starting job index convert progress...");

            var jobIndexInperiodList = new List <JobIndexInPeriodDTO>();
            var jobIndexList         = new List <JobIndexDTO>();
            var sourceJobIndexListId = jobIndexDataProvider.GetJobIndexListId();

            foreach (var sourceJobIndexId in sourceJobIndexListId)
            {
                var sourceJobIndexDTO = jobIndexDataProvider.GetBy(sourceJobIndexId);
                var jobIndexWithCf    = jobIndexService.GetByTransferId(sourceJobIndexDTO.TransferId);
                if (jobIndexWithCf == null)
                {
                    var desJobIndexDTO    = createDestinationJobIndex(sourceJobIndexDTO);
                    var jobIndexWithOutCf = jobIndexService.AddJobIndex(desJobIndexDTO);

                    jobIndexWithCf = jobIndexService.GetJobIndex(jobIndexWithOutCf.Id);
                }
                jobIndexList.Add(jobIndexWithCf);
                var periodJobIndexDTO = createPeriodJobIndexDTO(jobIndexWithCf, period, sourceJobIndexDTO);
                periodJobIndexDTO.CustomFields[0].Value = sourceJobIndexDTO.Coefficient.ToString();
                var res = jobIndexAssignmentService.AddJobIndexInPeriod(periodJobIndexDTO);
                jobIndexInperiodList.Add(res);
                Console.WriteLine("Job index convert progress state: " + jobIndexInperiodList.Count + " From " + sourceJobIndexListId.Count);
            }
            publisher.Publish(new JobIndexConverted(jobIndexInperiodList, jobIndexList));
        }
Example #3
0
        private void save()
        {
            if (!jobIndex.Validate())
            {
                return;
            }

            ShowBusyIndicator();

            jobIndex.TransferId = Guid.NewGuid();
            if (actionType == ActionType.AddJobIndex)
            {
                jobIndexService.AddJobIndex((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), jobIndex);
            }
            else if (actionType == ActionType.ModifyJobIndex)
            {
                jobIndexService.UpdateJobIndex((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), jobIndex);
            }
        }