public BaseResponse UpdateAviationMedicine(AviationMedicineRequest request) { var aviationMedicine = this.aviationMedicineRepository.GetAviationMedicineByKey(request.TransactionNumber); if (aviationMedicine == null) { return(this.BuildErrorResponse("AM_002")); //does not exist } aviationMedicine.TransactionNumber = request.TransactionNumber; aviationMedicine.Sex = request.Sex; aviationMedicine.Name = request.Name; aviationMedicine.ContactPhone = request.ContactPhone; aviationMedicine.EmploymentDate = request.EmploymentDate.Value; aviationMedicine.GraduationSchool = request.GraduationSchool; aviationMedicine.Professional = request.Professional; aviationMedicine.Qualifications = request.Qualifications; aviationMedicine.LastEditUser = request.ActionUserID; aviationMedicine.LastEditDate = DateTime.Now; this.aviationMedicineRepository.Update(aviationMedicine); this.unitOfWork.Commit(); return(this.BuildSuccessResponse()); }
private async void UpdateAviationMedicine() { if (AviationMedicineModel.HasValidationError()) { return; } var request = new AviationMedicineRequest { TransactionNumber = AviationMedicineModel.TransactionNumber, Name = AviationMedicineModel.Name, Sex = AviationMedicineModel.Sex, Professional = AviationMedicineModel.Professional, Qualifications = AviationMedicineModel.PersonQualification, ContactPhone = AviationMedicineModel.ContactTel, EmploymentDate = AviationMedicineModel.WorkDate, GraduationSchool = AviationMedicineModel.GraduationSchool, ActionUserID = CPApplication.CurrentUser.UserName }; await this.aviationMedicineFacade.UpdateAviationMedicine(request); this.ShowMessage(CommonMsgResource.Msg_SaveSuccess); this.DialogResult = true; }
private async void CreateAviationMedicine() { if (this.AviationMedicineModel.HasValidationError()) { return; } if (!AviationMedicineModel.WorkDate.HasValue) { this.ShowMessage(AviationMedicineResource.Msg_WorkDateEmpty); return; } var request = new AviationMedicineRequest { Name = AviationMedicineModel.Name, Professional = AviationMedicineModel.Professional, ContactPhone = AviationMedicineModel.ContactTel, EmploymentDate = AviationMedicineModel.WorkDate, GraduationSchool = AviationMedicineModel.GraduationSchool, Qualifications = AviationMedicineModel.PersonQualification, Sex = AviationMedicineModel.Sex, ActionUserID = CPApplication.CurrentUser.UserName }; try { var response = await aviationMedicineFacade.CreateAviationMedicine(request); if (response.IsSucess) { this.ShowMessage(CommonMsgResource.Msg_SaveSuccess); ResetData(); } } catch (Exception ex) { this.ShowWarning(ex.Message.ToString()); } }
public BaseResponse CreateAviationMedicine(AviationMedicineRequest request) { var aviationMedicine = new AviationMedicine { Name = request.Name, Sex = request.Sex, ContactPhone = request.ContactPhone, EmploymentDate = request.EmploymentDate.GetValueOrDefault(DateTime.Now), GraduationSchool = request.GraduationSchool, Professional = request.Professional, Qualifications = request.Qualifications, LastEditUser = request.ActionUserID, LastEditDate = DateTime.Now, InUser = request.ActionUserID, InDate = DateTime.Now }; this.aviationMedicineRepository.Create(aviationMedicine); this.unitOfWork.Commit(); return(this.BuildSuccessResponse()); }
public BaseResponse UpdateAviationMedicine(AviationMedicineRequest request) { return(aviationMedicineService.UpdateAviationMedicine(request)); }
public async Task <BaseResponse> UpdateAviationMedicine(AviationMedicineRequest request) { return(await this.PutAsync <AviationMedicineRequest, BaseResponse>("update", request)); }