Exemplo n.º 1
0
        private async Task <int> GetJobsAsync(PeriodDTO periodDto)
        {
            var idList = jobDataProvider.GetJobIds();

            foreach (var id in idList)
            {
                Random rndNumber = new Random();

                var jobDetail = jobDataProvider.GetJobDetails(id);
                var desJob    = new JobDTO();
                desJob.Name           = jobDetail.Title;
                desJob.DictionaryName = "DicName" + Guid.NewGuid();
                desJob.CustomFields   = new List <CustomFieldDTO>();

                JobDTO CurrentJob = new JobDTO();
                CurrentJob = GetJob(jobDetail.Id);

                if (CurrentJob.Id != null && CurrentJob.Id != 0)
                {
                    jobService.UpdateJob((res, exp) =>
                    {
                        if (exp != null)
                        {
                            throw new Exception("Error In Update Job!");
                        }
                        //System.Threading.Thread.Sleep(100);
                        //ProgressCount++;
                    }, CurrentJob);
                }
                else
                {
                    jobService.AddJob(
                        (r, e) =>
                    {
                        if (e != null)
                        {
                            throw new Exception("Error In AddJob!");
                        }
                        //System.Threading.Thread.Sleep(100);
                        //ProgressCount++;
                    }, desJob);
                }

                ProgressCount++;
            }
            return(ProgressCount);
        }
Exemplo n.º 2
0
        private void save()
        {
            if (!job.Validate())
            {
                return;
            }

            ShowBusyIndicator();

            job.TransferId = Guid.NewGuid();
            if (actionType == ActionType.CreateJob)
            {
                jobService.AddJob((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), job);
            }
            else if (actionType == ActionType.ModifyJob)
            {
                jobService.UpdateJob((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), job);
            }
        }