示例#1
0
        private void LoadPersonInfoByNationalNo()
        {
            if (loadLock)
            {
                return;
            }

            var personReq = new PersonRequest {
                Filter = new PersonFilter {
                    NationalNo = Person.NationalNo
                }
            };
            var personRes = Helper.Call(s => s.PersonGet(personReq));

            if (personRes.Success)
            {
                Mapper.Map(personRes.Result, Person);
                var request = new PatronRequest {
                    Filter = new PatronFilter {
                        PersonID = Person.ID
                    }
                };
                var response = Helper.Call(s => s.PatronGet(request));
                Mapper.Map(response.Result, Model);
                MyParent.PatronID = Model.ID;
                Helper.Notify("شخصی با شماره ملی وارد شده یافت شد");
                changed = false;
            }
        }
示例#2
0
        private void Refresh()
        {
            Models.Clear();
            var response = Helper.Call(s => s.RequestGetList(new RequestRequest()));

            ServiceResponseHelper.CheckServiceResponse(response, "RequestGetList");
            var list = response.ResultList.Select(r => Mapper.Map(r, new RequestModel())).ToList();

            var patronReq = new PatronRequest {
                Filter = new PatronFilter {
                    IDList = list.Select(r => r.PatronID).ToArray()
                }, LoadPerson = true
            };
            var patronRes = Helper.Call(s => s.PatronGetList(patronReq));

            ServiceResponseHelper.CheckServiceResponse(response, "PatronGetList", patronReq);
            if (patronRes.ResultList?.Count() > 0)
            {
                list.ForEach(r =>
                {
                    var person = patronRes.ResultList.FirstOrDefault(p => p.ID == r.PatronID)?.Person;
                    r.Name     = $"{person.FirstName} {person.LastName}";
                });
            }
            Models.AddRange(list);
        }
示例#3
0
        private void MyParent_OnApply()
        {
            if (Person.ID > 0 && !changed)
            {
                return;
            }

            if (!Person.Validate())
            {
                Helper.NotifyWarning("موارد مشخص شده را برطرف کنید");
                return;
            }


            var request = new PersonRequest {
                DTO = Mapper.Map(Person, new PersonDTO())
            };
            var response = Helper.Call(s => s.PersonSet(request));

            if (response.Success)
            {
                Person.ID      = response.ResultID;
                Model.PersonID = response.ResultID;

                SavePicture();

                var patronReq = new PatronRequest {
                    DTO = Mapper.Map(Model, new PatronDTO())
                };
                response = Helper.Call(s => s.PatronSet(patronReq));

                if (response.Success)
                {
                    Helper.NotifySuccess("اطلاعات با موفقیت ذخیره شد");
                    Model.ID          = response.ResultID;
                    MyParent.PatronID = Model.ID;
                }
                else
                {
                    Helper.NotifyError(response.UserMessage);
                }
            }
            else
            {
                Helper.NotifyWarning(response.UserMessage);
            }
        }
        public void Apply()
        {
            OnApply?.Invoke();

            if ((Parameter is PatronModel p) && p.IntroducerID != IntroducerID)
            {
                var request = new PatronRequest {
                    DTO = new PatronDTO {
                        ID = PatronID, IntroducerID = IntroducerID
                    }
                };
                var response = Helper.Call(s => s.PatronIntroducerSet(request));
                ServiceResponseHelper.CheckServiceResponse(response, "PatronIntroducerSet", request);
                Helper.NotifySuccess("معرف با موفقیت ثبت شد.");
            }
            Messenger.Default.Send(PersonViewModel.Message.RefreshPatronList);
        }
        private void RefreshModels()
        {
            var request = new PatronRequest {
                Filter = new PatronFilter(), LoadPerson = true
            };
            var response = Helper.Call(s => s.PatronGetList(request));

            if (response?.Success ?? false)
            {
                AppUIManager.Application.Dispatcher.Invoke(() =>
                {
                    Models.Clear();
                    Models.AddRange(response.ResultList.Select(dto => Mapper.SmartMap(dto, new PatronModel(),
                                                                                      (s, d) => d.Person = Mapper.Map(s.Person, new PersonModel()))));
                });
            }
        }
示例#6
0
        protected void OnSelectedModelChanged()
        {
            var request = new PatronRequest
            {
                Filter = new PatronFilter {
                    ID = SelectedModel.PatronID
                },
                LoadPerson = true,
            };
            var response = Helper.Call(s => s.PatronGet(request));

            ServiceResponseHelper.CheckServiceResponse(response, "PatronGet", request);
            Patron = Mapper.SmartMap(response.Result, new PatronModel(), (s, d) =>
            {
                d.Person = Mapper.Map(response.Result.Person, new PersonModel());
            });
            Image = QuickServiceCall.LoadPersonImage(Patron.PersonID);
        }
示例#7
0
        private void LoadPatronByID(int patronID)
        {
            var patronReq = new PatronRequest {
                Filter = new PatronFilter {
                    ID = patronID
                }, LoadPerson = true,
            };
            var personRes = Helper.Call(s => s.PatronGet(patronReq));

            if (personRes.Success)
            {
                loadLock = true;
                Mapper.SmartMap(personRes.Result, Model);
                Mapper.Map(personRes.Result.Person, Person);
                LoadPicture();
                loadLock = false;
                changed  = false;
            }
        }