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); }
public void Apply() { if (Model.Type && string.IsNullOrEmpty(Model.Title)) { Helper.NotifyWarning("لطفا هنوان را وارد کنید"); } if (!Model.Type) { CreatePerson(); if (imageChanged) { SetImage(); } } var request = new IntroducerRequest { UserID = GlobalVar.User.ID, DTO = new IntroducerDTO { ID = Model.ID, PersonID = Model.Type ? null : (int?)Person.ID, Title = Model.Title, Type = Model.Type } }; var response = Helper.Call(s => s.IntroducerSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "IntroducerSet", request); Helper.NotifySuccess($"ثبت معرف با موفقیت انجام شد", "ثبت معرف"); Listener?.OnIntroducerInputApply(true); }
private void CreatePerson() { var request = new PersonRequest { DTO = Mapper.Map(Person, new PersonDTO()) }; var response = Helper.Call(s => s.PersonSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "PersonSet", request); Person.ID = response.ResultID; }
public void Confirm() { var request = new AddressRequest { DTO = Mapper.Map(Model, new AddressDTO()) }; var response = Helper.Call(s => s.AddressSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "AddressSet", request); Messenger.Default.Send(Messages.Address.Refresh); SliderHelper.Close(); }
public void Apply() { Model.PatronID = Patron.ID; var request = new RequestRequest { UserID = GlobalVar.UserID, DTO = Mapper.Map(Model, new RequestDTO()) }; var response = Helper.Call(s => s.RequestSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "RequestSet", request); Helper.NotifySuccess("درخواست با موفقیت ثبت شد"); }
public void Confirm() { var request = new ResearchRequest { DTO = Mapper.Map(Model, new ResearchDTO()), UserID = GlobalVar.UserID }; var response = Helper.Call(s => s.ResearchSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "ResearchSet", request); Messenger.Default.Send(Messages.Research.Refresh); SliderHelper.Close(); }
public void Research() { var request = new RequestRequest { DTO = new RequestDTO { ID = Model.ID }, UserID = GlobalVar.UserID }; var response = Helper.Call(s => s.RequestResearch(request)); ServiceResponseHelper.CheckServiceResponse(response, "RequestResearch", request); Helper.NotifySuccess("درخواست تحقیق با موفقیت ثبت شد"); }
protected void OnSelectedUserChanged() { var request = new UserRequest { Filter = new UserFilter { ID = SelectedUser.ID } }; var response = Helper.Call(s => s.GetUserLogins(request)); ServiceResponseHelper.CheckServiceResponse(response, "GetUserLogins", request); LastLogin = response.ResultList.LastOrDefault()?.CreateDate; }
public RequestInputViewModel() { Model = new RequestModel { TypeEntityID = AppConfigs.RequestTypes.FirstOrDefault()?.ID ?? 0, IssueDate = DateTime.Now, }; var response = Helper.Call(s => s.RequestLastNo()); ServiceResponseHelper.CheckServiceResponse(response, "RequestLastNo", null); Model.No = (response.MaxNo + 1).ToString(); }
private void CreatePerson() { if (Person.Validate() == false) { throw new Exception("لطفا موارد مشخص شده را اصلاح کنید"); } var request = new PersonRequest { DTO = Mapper.Map(Person, new PersonDTO()) }; var response = Helper.Call(s => s.PersonSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "PersonSet", request); Person.ID = response.ResultID; }
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 UpdateResearches() { if (!(Model?.ID > 0)) { return; } var request = new ResearchRequest { Filter = new ResearchFilter { RequestID = Model.ID } }; var response = Helper.Call(s => s.ResearchGetList(request)); ServiceResponseHelper.CheckServiceResponse(response, "ResearchGetList", request); var temp = response.ResultList.Select(x => Mapper.Map(x, new ResearchModel())); Helper.InvokeMainThread(() => Researches.AddRange(temp)); }
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); }
private void CreateUser() { if (Person.ID == 0) { CreatePerson(); } var request = new UserRequest { DTO = new UserDTO { PersonID = Person.ID, UserName = UserName, Password = Password, } }; var response = Helper.Call(s => s.UserSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "UserSet", request); FormState = "Message"; Listener?.OnUserAdded(); }
private void RefreshIntroducers() { int selectedId = SelectedModel?.ID ?? 0; var request = new IntroducerRequest { UserID = GlobalVar.User.ID, Filter = new IntroducerFilter(), LoadPerson = true }; var response = Helper.Call(s => s.IntroducerGetList(request)); ServiceResponseHelper.CheckServiceResponse(response, "IntroducerGetList"); var temp = response.ResultList.Select(i => Mapper.SmartMap(i, new IntroducerModel(), (dto, model) => model.Person = Mapper.Map(dto.Person, new PersonModel()))); Helper.InvokeMainThread(() => { Models.Clear(); Models.AddRange(temp); SelectedModel = Models.FirstOrDefault(i => i.ID == selectedId); }); }
private void SetImage() { if (Person.Image == null) { return; } var imageBytes = Person.Image.ToByteArray(); imageBytes = imageBytes ?? Helper.ImageUriToByteArray(Person.Image.UriSource.AbsolutePath); PersonRequest request = new PersonRequest { Picture = new PictureDTO { PersonID = Person.ID, Data = imageBytes, CreateUser = GlobalVar.User.ID, } }; var response = Helper.Call(s => s.PersonPictureSet(request)); ServiceResponseHelper.CheckServiceResponse(response, "PersonPictureSet"); }