Beispiel #1
0
 private void getEmployeeCustomFields()
 {
     customFieldService.GetAllCustomFields((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         if (exp == null)
         {
             CustomFieldValueList =
                 CheckBoxListViewHelper <CustomFieldValueDTO> .PrepareListForCheckBoxListView(
                     res.Select(r => new CustomFieldValueDTO {
                 Id = r.Id, IsReadOnly = r.IsReadOnly, Name = r.Name
             }).ToList());
             if (actionType != ActionType.ModifyEmployee || Employee.CustomFields == null)
             {
                 return;
             }
             foreach (var itm in CustomFieldValueList)
             {
                 if (Employee.CustomFields.Select(c => c.Id).Contains(itm.Data.Id))
                 {
                     itm.IsChecked  = true;
                     itm.Data.Value = Employee.CustomFields.Single(e => e.Id == itm.Data.Id).Value;
                 }
                 else
                 {
                     itm.IsChecked = false;
                 }
             }
         }
         else
         {
             appController.HandleException(exp);
         }
     }), "Employee");
 }
        private void addInquirer()
        {
            if (SelectedEmployee == null || SelectedInquirySubjectWithInquirers.CustomInquirers.Select(c => c.EmployeeNo).Contains(SelectedEmployee.PersonnelNo))
            {
                return;
            }
            employeeService.GetEmployeeUnitsInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                if (exp == null)
                {
                    //foreach (var jobPosition in res.EmployeeJobPositionAssignmentList)
                    //{
                    //    var customInquirer = new InquirerDTO()
                    //        {
                    //            EmployeeNo = SelectedEmployee.PersonnelNo,
                    //            FullName = SelectedEmployee.FirstName + " " + SelectedEmployee.LastName,
                    //            EmployeeJobPositionId = jobPosition.JobPositionId,
                    //            EmployeeJobPositionName = jobPosition.JobPositionName
                    //        };

                    //    if (!SelectedInquirySubjectWithInquirers.Inquirers.Any(r => r.EmployeeNo == customInquirer.EmployeeNo && r.EmployeeJobPositionId == customInquirer.EmployeeJobPositionId)
                    //         && !SelectedInquirySubjectWithInquirers.CustomInquirers.Any(r => r.EmployeeNo == customInquirer.EmployeeNo && r.EmployeeJobPositionId == customInquirer.EmployeeJobPositionId))
                    //        SelectedInquirySubjectWithInquirers.CustomInquirers.Add(customInquirer);
                    //}
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), SelectedEmployee.PersonnelNo, period.Id);
        }
Beispiel #3
0
        //public void Load(UnitInPrdField unitInPrdFieldParam, ActionType actionTypeParam)
        public void Load(long periodId, UnitInPeriodDTO unitInPeriod, ActionType actionTypeParam)
        {
            if (unitInPeriod == null)
            {
                return;
            }

            actionType = actionTypeParam;
            preLoad(periodId);
            ShowBusyIndicator("در حال دریافت اطلاعات...");
            unitService.GetUnit((res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    Unit = res;
                    UnitCustomFieldDescriptionList = new List <AbstractCustomFieldDescriptionDTO>(Unit.CustomFields
                                                                                                  .Select(f => new AbstractCustomFieldDescriptionDTO()
                    {
                        Name = f.Name, Id = f.Id
                    }).ToList());

                    unitCustomFieldDescriptionList.Where(allFields => unitInPeriod.CustomFields.Select(f => f.Id).Contains(allFields.Id))
                    .ToList()
                    .ForEach(field => field.IsChecked = true);
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), unitInPeriod.UnitId);
        }
Beispiel #4
0
 private void load()
 {
     ShowBusyIndicator("در حال دریافت اطلاعات...");
     unitInPeriodService.GetUnitInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp == null)
         {
             UnitInPeriod = res;
         }
     }), Period.Id, UnitInPeriod.UnitId);
 }
Beispiel #5
0
        public void Load(JobIndexCategoryDTO jobIndexCategoryParam, ActionType actionTypeParam)
        {
            actionType       = actionTypeParam;
            JobIndexCategory = jobIndexCategoryParam;

            if (JobIndexCategory != null && jobIndexCategory.ParentId.HasValue)
            {
                ShowBusyIndicator();
                jobIndexCategoryService.GetJobIndexCategory((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    ParentCategoryName = res.Name;
                }), jobIndexCategory.ParentId.Value);
            }
        }
Beispiel #6
0
 public void DoAction(EmployeeClaimListVM vm)
 {
     if (vm.SelectedClaim != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف درخواست اعتراض اطمینان دارید؟", "حذف درخواست اعتراض"))
         {
             claimService.DeleteClaim((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف درخواست اعتراض با موفقیت انجام شد");
                     pmsController.Publish(new UpdateClaimListArgs(vm.SelectedClaim.EmployeeNo));
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             }), vm.SelectedClaim.PeriodId, vm.SelectedClaim.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات درخواست اعتراض جهت حذف معتبر نمی باشد");
     }
 }
Beispiel #7
0
        public void DoAction(PeriodListVM vm)
        {
            var period = vm.SelectedPeriod;

            if (period == null)
            {
                pmsController.ShowMessage("دوره ای انتخاب نشده است");
                return;
            }
            if (pmsController.ShowConfirmationBox("برگشت دوره میتواند موجب حذف بخشی از اطلاعات شود، آیا از برگشت دوره به وضعیت قبل اطمینان دارید ؟", "برگشت دوره"))
            {
                periodService.RollBackPeriodState(exp => pmsController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        pmsController.HandleException(exp);
                    }
                    else
                    {
                        pmsController.Publish(new UpdatePeriodListArgs());
                        pmsController.GetCurrentPeriod();
                    }
                }), period.Id);
            }
        }
Beispiel #8
0
 public void DoAction(UnitListVM vm)
 {
     if (vm != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف واحد سازمانی اطمینان دارید؟", "حذف واحد سازمانی"))
         {
             unitService.DeleteUnit((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف واحد سازمانی با موفقیت انجام شد");
                     pmsController.Publish(new UpdateUnitListArgs());
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             }), vm.SelectedUnit.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات واحد سازمانی جهت حذف معتبر نمی باشد");
     }
 }
        public void DoAction(CalculationListVM vm)
        {
            var period = vm.SelectedCalculation;

            if (period == null)
            {
                pmsController.ShowMessage("محاسبه ای انتخاب نشده است");
                return;
            }
            if (pmsController.ShowConfirmationBox("آیا می خواهید محاسبه انجام شود؟", "اجرای محاسبه"))
            {
                calculationService.ChangeCalculationState((exp) => pmsController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        pmsController.HandleException(exp);
                    }
                    else
                    {
                        pmsController.Publish(new UpdateCalculationListArgs());
                        var action = new ShowPeriodCalculationStateService(periodController, pmsController, calculationService);
                        action.DoAction(vm);
                    }
                }), pmsController.CurrentPriod.Id, vm.SelectedCalculation.Id, new CalculationStateDTO {
                    State = (int)CalculationStateEnum.Running
                });
            }
        }
Beispiel #10
0
        private void refresh()
        {
            var sortBy = Users.SortDescriptions.ToDictionary(sortDesc => sortDesc.PropertyName, sortDesc =>
                                                             (sortDesc.Direction == ListSortDirection.Ascending ? "ASC" : "DESC"));

            ShowBusyIndicator("در حال دریافت اطلاعات...");

            userService.GetAllUsers(
                (res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    if (res.Result != null)
                    {
                        Users.SourceCollection = res.Result;
                    }
                    else
                    {
                        Users.SourceCollection = new Collection <UserDTOWithActions>();
                    }
                    Users.TotalItemCount = res.TotalCount;
                    Users.PageIndex      = Math.Max(0, res.CurrentPage - 1);
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), Users.PageSize, Users.PageIndex + 1, sortBy, UserCriteria);
        }
Beispiel #11
0
 private void save()
 {
     if (!ChangePassword.Validate())
     {
         return;
     }
     if (ChangePassword.NewPassword != ReEnterNewPassword)
     {
         appController.ShowMessage("رمز عبور و تکرار رمزعبور می بایست یکسان باشد");
         return;
     }
     if (ChangePassword.NewPassword.Length < 6)
     {
         appController.ShowMessage("رمز عبور باید حداقل 6 کارکتر باشد");
         return;
     }
     ShowBusyIndicator();
     userService.ChangePassword((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp != null)
         {
             appController.HandleException(exp);
         }
         else
         {
             if (appController.ShowMessage("تغییر رمز با موفقیت انجام شد", "پیام", MessageBoxButton.OK) == MessageBoxResult.OK)
             {
                 OnRequestClose();
             }
         }
     }), ChangePassword);
 }
Beispiel #12
0
 private void preLoad()
 {
     ShowBusyIndicator("در حال دریافت اطلاعات");
     ruleService.GetRuleExcuteTimes((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp == null)
         {
             ExcuteTimeList = res;
         }
         else
         {
             appController.HandleException(exp);
         }
     }));
 }
Beispiel #13
0
 public void DoAction(UserListVM vm)
 {
     if (vm != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف  اطمینان دارید؟", "حذف کاربر"))
         {
             userService.DeleteUser((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف  با موفقیت انجام شد");
                     pmsController.Publish(new UpdateUserListArgs());
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             }
                                                                                        ), vm.SelectedUser.PartyName);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات  جهت حذف معتبر نمی باشد");
     }
 }
        public void DoAction(PeriodListVM vm)
        {
            var period = vm.SelectedPeriod;

            if (period == null)
            {
                pmsController.ShowMessage("دوره ای انتخاب نشده است");
                return;
            }
            if (pmsController.ShowConfirmationBox("آيا می خواهید برای محاسبه قطعی در این دوره نمرات کارکنان را آماده تایید کنید  ؟", "آغاز زمان تایید نمرات دوره "))
            {
                periodService.ChangePeriodState(exp => pmsController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        pmsController.HandleException(exp);
                    }
                    else
                    {
                        pmsController.Publish(new UpdatePeriodListArgs());
                        //pmsController.GetCurrentPeriod();
                        //var action = new ShowPeriodCalculationStateService(periodController, pmsController, calculationService);
                        //action.DoAction(vm);
                    }
                }), period.Id, new PeriodStateDTO {
                    State = (int)PeriodStateEnum.Confirmation
                });
            }
        }
 public void DoAction(UnitIndexTreeVM vm)
 {
     if (vm != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف دسته شاخص اطمینان دارید؟", "حذف دسته شاخص"))
         {
             unitIndexCategoryService.DeleteUnitIndexCategory((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف دسته شاخص با موفقیت انجام شد");
                     pmsController.Publish(new UpdateUnitIndexTreeArgs());
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             }
                                                                                                                  ), vm.SelectedUnitIndex.Data.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات دسته شاخص جهت  حذف معتبر نمی باشد");
     }
 }
Beispiel #16
0
 private void loadAllPeriods()
 {
     ShowBusyIndicator("در حال دریافت اطلاعات");
     periodService.GetAllPeriods((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp == null)
         {
             SourcePeriods = new ObservableCollection <PeriodDescriptionDTO>(res.Where(p => p.Id != Period.Id).ToList());
         }
         else
         {
             appController.HandleException(exp);
         }
     }));
 }
Beispiel #17
0
 private void save()
 {
     if (!EmailDTO.Validate())
     {
         return;
     }
     if (EmailDTO.Email != ReEnterEmail)
     {
         appController.ShowMessage("پست الکترونیکی و تکرار پست الکترونیکی می بایست یکسان باشد");
         return;
     }
     //if (EmailDTO.Email.Length<6)
     //{
     //    appController.ShowMessage("رمز عبور باید حداقل 6 کارکتر باشد");
     //    return;
     //}
     ShowBusyIndicator();
     userService.UpdateEmail((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp != null)
         {
             appController.HandleException(exp);
         }
         else
         {
             if (appController.ShowMessage("برای فعال سازی پست الکترونیکی به آدرس پست الکترونیکی وارد شده مراجعه کنید ", "پیام", MessageBoxButton.OK) == MessageBoxResult.OK)
             {
                 OnRequestClose();
             }
         }
     }), EmailDTO);
 }
Beispiel #18
0
 public void DoAction(JobInPeriodListVM vm)
 {
     if (vm != null && vm.SelectedJobInPeriod != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف شغل از دوره اطمینان دارید؟", "حذف شغل از دوره"))
         {
             jobInPeriodService.DeleteJobInPeriod((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 {
                     if (exp == null)
                     {
                         pmsController.ShowMessage("عملیات حذف شغل از دوره با موفقیت انجام شد");
                         pmsController.Publish(new UpdateJobInPeriodListArgs());
                     }
                     else
                     {
                         pmsController.HandleException(exp);
                     }
                 }
             }), vm.Period.Id, vm.SelectedJobInPeriod.JobId);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات شغل دوره جهت حذف معتبر نمی باشد");
     }
 }
 public void DoAction(CustomFieldListVM vm)
 {
     if (vm != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف فیلد اطمینان دارید؟", "حذف فیلد"))
         {
             customFieldService.DeleteCustomField((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف فیلد با موفقیت انجام شد");
                     pmsController.Publish(new UpdateCustomFieldListArgs());
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             }
                                                                                                      ), vm.SelectedCustomField.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات فیلد جهت حذف معتبر نمی باشد");
     }
 }
 public void DoAction(JobIndexInPeriodTreeVM vm)
 {
     if (vm != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف شاخص اطمینان دارید؟", "حذف شاخص"))
         {
             jobIndexInPeriodService.DeleteJobIndexInPeriod((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف شاخص با موفقیت انجام شد");
                     pmsController.Publish(new UpdateJobIndexInPeriodTreeArgs());
                 }
                 else
                 {
                     pmsController.HandleException(exp);
                 }
             })
                                                            , vm.Period.Id, vm.SelectedAbstractIndexInPeriod.Data.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات شاخص جهت حذف معتبر نمی باشد");
     }
 }
        public void DoAction(PeriodListVM vm)
        {
            var period = vm.SelectedPeriod;

            if (period == null)
            {
                pmsController.ShowMessage("دوره ای انتخاب نشده است");
                return;
            }
            if (pmsController.ShowConfirmationBox("آیا می خواهید دوره انتخاب شده را برای ارزیابی آماده کنید ؟", "آماده سازی برای ارزیابی"))
            {
                periodService.ChangePeriodState(exp => pmsController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        pmsController.HandleException(exp);
                    }
                    else
                    {
                        pmsController.Publish(new UpdatePeriodListArgs());
                        periodController.ShowPeriodStatusView(period, ActionType.GetPeriodInitializingInquiryStatus);
                    }
                }), period.Id, new PeriodStateDTO {
                    State = (int)PeriodStateEnum.InitializingForInquiry
                });
            }
        }
        private void refresh()
        {
            ShowBusyIndicator("در حال دریافت اطلاعات...");
            inquiryService.GetInquirerInquirySubjects(
                (res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    var res1 = new List <InquiryUnitDTO>();
                    res.ForEach(c =>
                    {
                        if (res1.SingleOrDefault(d => d.UnitId == c.UnitId) == null)
                        {
                            res1.Add(c);
                        }
                    });

                    InquirySubjects        = new ObservableCollection <InquiryUnitDTO>(res1);
                    SelectedInquirySubject = res1.FirstOrDefault();

                    //InquirySubjects = new ObservableCollection<InquiryUnitDTO>(res);
                    //SelectedInquirySubject = res.FirstOrDefault();
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), periodId, inquirerEmployeeNo);
        }
Beispiel #23
0
        public void DoAction(PeriodListVM vm)
        {
            var period = vm.SelectedPeriod;

            if (period == null)
            {
                pmsController.ShowMessage("دوره ای انتخاب نشده است");
                return;
            }
            if (pmsController.ShowConfirmationBox("آیا می خواهید ارزیابی را تمام کنید ؟", "اتمام ارزیابی"))
            {
                periodService.ChangePeriodState(exp => pmsController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp != null)
                    {
                        pmsController.HandleException(exp);
                    }
                    else
                    {
                        pmsController.Publish(new UpdatePeriodListArgs());
                        //pmsController.GetCurrentPeriod();
                        //var action = new ShowPeriodCalculationStateService(periodController, pmsController, calculationService);
                        //action.DoAction(vm);
                    }
                }), period.Id, new PeriodStateDTO {
                    State = (int)PeriodStateEnum.InquiryCompleted
                });
            }
        }
Beispiel #24
0
 public void DoAction(CalculationListVM vm)
 {
     if (vm.SelectedCalculation != null)
     {
         if (pmsController.ShowConfirmationBox("آیا از عملیات حذف محاسبه دوره اطمینان دارید؟", "حذف محاسبه"))
         {
             calculationService.DeleteCalculation((res, exp) => pmsController.BeginInvokeOnDispatcher(() =>
             {
                 if (exp == null)
                 {
                     pmsController.ShowMessage("عملیات حذف محاسبه با موفقیت انجام شد");
                     pmsController.Publish(new UpdateCalculationListArgs());
                 }
                 else if (exp != null)
                 {
                     pmsController.HandleException(exp);
                 }
             })
                                                  , pmsController.CurrentPriod.Id, vm.SelectedCalculation.Id);
         }
     }
     else
     {
         pmsController.ShowMessage("اطلاعات محاسبه جهت حذف معتبر نمی باشد");
     }
 }
Beispiel #25
0
 private void preLoad()
 {
     ShowBusyIndicator("در حال دریافت اطلاعات...");
     jobPositionInPeriodService.GetAllJobPositions(
         (res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         if (exp == null)
         {
             JobPositionTree = SilverLightTreeViewHelper <JobPositionInPeriodDTO> .prepareListForTreeView(res);
             HideBusyIndicator();
         }
         else
         {
             HideBusyIndicator();
             appController.HandleException(exp);
         }
     }), Period.Id);
 }
Beispiel #26
0
        public void Load(long periodId, JobInPeriodDTO jobInPeriodParam, ActionType actionTypeParam)
        {
            if (jobInPeriodParam == null)
            {
                return;
            }
            JobInPeriod = jobInPeriodParam;
            actionType  = actionTypeParam;
            preLoad(periodId);

            jobIndexInPeriodService.GetAllPeriodJobIndexes((res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                if (exp == null)
                {
                    foreach (var jobIndex in res)
                    {
                        var jobInPeriodJobIndex = JobInPeriod.JobIndices.SingleOrDefault(j => j.Id == jobIndex.Id);
                        if (jobInPeriodJobIndex != null)
                        {
                            jobInPeriodJobIndex.IsChecked = true;
                            JobIndexInPeriodList.Add(jobInPeriodJobIndex);
                        }
                        else
                        {
                            JobIndexInPeriodList.Add(new JobInPeriodJobIndexDTO
                            {
                                Id               = jobIndex.Id,
                                Name             = jobIndex.Name,
                                IsInquireable    = jobIndex.IsInquireable,
                                ShowforLowLevel  = true,
                                ShowforSameLevel = true,
                                ShowforTopLevel  = true
                            });
                        }
                    }
                    HideBusyIndicator();
                }
                else
                {
                    HideBusyIndicator();
                    appController.HandleException(exp);
                }
            }), periodId);
        }
        private void refresh()
        {
            var trigger = new AutoResetEvent(false);
            var success = false;

            ShowBusyIndicator();
            string oldStateName = string.Empty;

            if (summary != null)
            {
                oldStateName = summary.StateName;
            }

            ThreadPool.QueueUserWorkItem(s =>
            {
                periodService.GetPeriodStatus((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    success = exp == null;
                    if (exp == null)
                    {
                        Summary = res;
                    }
                    else
                    {
                        appController.HandleException(exp);
                    }
                    trigger.Set();
                }), Period.Id);
                trigger.WaitOne();
                appController.BeginInvokeOnDispatcher(HideBusyIndicator);
                if (success)
                {
                    if (summary.StateName == "PeriodInitializingForInquiryState")
                    {
                        appController.BeginInvokeOnDispatcher(() => timer.Start());
                    }
                    else if (summary.StateName != oldStateName)
                    {
                        appController.BeginInvokeOnDispatcher(() =>
                                                              appController.Publish(new UpdatePeriodListArgs()));
                    }
                }
            });
        }
Beispiel #28
0
        public void Load(long periodId, long?UnitId, long?parentId, ActionType actionTypeParam)
        {
            this.parentId = parentId;
            actionType    = actionTypeParam;
            preLoad(periodId, UnitId);

            if (UnitId.HasValue) // modify Unit
            {
                Units = new List <UnitInPeriodDTO>();
                ShowBusyIndicator("در حال دریافت اطلاعات...");
                UnitInPeriodService.GetUnitInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp == null)
                    {
                        Units.Add(res);
                        SelectedUnitInPeriod = res;
                    }
                }), periodId, UnitId.Value);
            }
            else // add new Unit => action is  ActionType.AddUnitInPrdField
            {
                ShowBusyIndicator();
                UnitInPeriodService.GetAllUnitInPeriod((UnitInPeriodListRes, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp == null)
                    {
                        UnitService.GetAllUnits((UnitsRes, UnitsExp) => appController.BeginInvokeOnDispatcher(() =>
                        {
                            HideBusyIndicator();

                            if (UnitsExp == null)
                            {
                                var jList = UnitsRes.Where(r => !UnitInPeriodListRes.Select(jip => jip.UnitId).Contains(r.Id)).ToList();
                                Units     = jList.Select(
                                    j => new UnitInPeriodDTO()
                                {
                                    Name = j.Name, UnitId = j.Id, CustomFields = new List <CustomFieldDTO>()
                                }).ToList();
                            }
                            else
                            {
                                appController.HandleException(UnitsExp);
                            }
                        }));
                    }
                    else
                    {
                        appController.HandleException(exp);
                    }
                }), periodId);
            }
        }
Beispiel #29
0
        public void Load(long periodId, long?jobId, ActionType actionTypeParam)
        {
            actionType = actionTypeParam;
            preLoad(periodId, jobId);

            if (jobId.HasValue) // modify job
            {
                Jobs = new List <JobInPeriodDTO>();
                ShowBusyIndicator("در حال دریافت اطلاعات...");
                jobInPeriodService.GetJobInPeriod((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp == null)
                    {
                        Jobs.Add(res);
                        SelectedJobInPeriod = res;
                    }
                }), periodId, jobId.Value);
            }
            else // add new job => action is  ActionType.AddJobInPrdField
            {
                ShowBusyIndicator();
                jobInPeriodService.GetAllJobInPeriod((jobInPeriodListRes, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    if (exp == null)
                    {
                        jobService.GetAllJobs((jobsRes, jobsExp) => appController.BeginInvokeOnDispatcher(() =>
                        {
                            HideBusyIndicator();

                            if (jobsExp == null)
                            {
                                var jList = jobsRes.Where(r => !jobInPeriodListRes.Select(jip => jip.JobId).Contains(r.Id)).ToList();
                                Jobs      = jList.Select(
                                    j => new JobInPeriodDTO()
                                {
                                    Name = j.Name, JobId = j.Id, CustomFields = new List <CustomFieldDTO>()
                                }).ToList();
                            }
                            else
                            {
                                appController.HandleException(jobsExp);
                            }
                        }));
                    }
                    else
                    {
                        appController.HandleException(exp);
                    }
                }), periodId);
            }
        }
Beispiel #30
0
 private void preLoad()
 {
     ShowBusyIndicator("در حال دریافت اطلاعات...");
     periodService.GetPeriodsWithConfirmedResult((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         HideBusyIndicator();
         if (exp == null)
         {
             PeriodsWithConfirmedResult = res;
             if (PeriodsWithConfirmedResult.Any())
             {
                 SelectedPeriod = PeriodsWithConfirmedResult.First();
             }
         }
         else
         {
             appController.HandleException(exp);
         }
     }));
 }