private async void UpdateCommonDisease()
        {
            if (CommonDiseaseModel.HasValidationError())
            {
                return;
            }

            var commonDiseaseRequest = new CommonDiseaseRequest
            {
                TransactionNumber = CommonDiseaseModel.TransactionNumber,
                SymptomName       = CommonDiseaseModel.SymptomName,
                SymptomDetail     = CommonDiseaseModel.SymptomDetail,
                Medication        = CommonDiseaseModel.Medication,
                TreatmentPlan     = CommonDiseaseModel.TreatmentPlan,
                ActionUserID      = CPApplication.CurrentUser.UserName
            };

            var response = await this.commonDiseaseFacade.UpdateCommonDisease(commonDiseaseRequest);

            if (response.IsSucess)
            {
                this.ShowMessage(CommonMsgResource.Msg_SaveSuccess);
                this.DialogResult = true;
            }
        }
        private async void CreateCommonDisease()
        {
            if (CommonDiseaseCreateModel.HasValidationError())
            {
                return;
            }

            var commonDiseaseRequest = new CommonDiseaseRequest
            {
                SymptomName   = CommonDiseaseCreateModel.SymptomName,
                SymptomDetail = CommonDiseaseCreateModel.SymptomDetail,
                Medication    = CommonDiseaseCreateModel.Medication,
                TreatmentPlan = CommonDiseaseCreateModel.TreatmentPlan,
                ActionUserID  = CPApplication.CurrentUser.UserName
            };

            var response = await this.commonDiseaseFacade.CreateCommonDisease(commonDiseaseRequest);

            if (!response.IsSucess)
            {
                this.ShowWarning(response.ErrorMessage);
                return;
            }

            this.ShowMessage(CommonMsgResource.Msg_SaveSuccess);
            this.ResetData();
        }
        public BaseResponse CreateCommonDisease(CommonDiseaseRequest request)
        {
            bool isExists = this.diseaseRepository.IsCommonDiseaseExists(request.SymptomName);

            if (isExists)
            {
                return(this.BuildErrorResponse("001")); //name has exist
            }

            var commonDisease = new CommonDisease
            {
                SymptomName   = request.SymptomName,
                SymptomDetail = request.SymptomDetail,
                Medication    = request.Medication,
                TreatmentPlan = request.TreatmentPlan,
                LastEditUser  = request.ActionUserID,
                LastEditDate  = DateTime.Now,
                InUser        = request.ActionUserID,
                InDate        = DateTime.Now
            };

            this.diseaseRepository.Create(commonDisease);
            this.unitOfWork.Commit();

            return(this.BuildSuccessResponse());
        }
        public BaseResponse UpdateCommonDisease(CommonDiseaseRequest request)
        {
            var commonDisease = this.diseaseRepository.GetCommonDiseaseByKey(request.TransactionNumber);

            if (commonDisease == null)
            {
                return(this.BuildErrorResponse("002")); //does not exist
            }

            commonDisease.SymptomName   = request.SymptomName;
            commonDisease.SymptomDetail = request.SymptomDetail;
            commonDisease.Medication    = request.Medication;
            commonDisease.TreatmentPlan = request.TreatmentPlan;
            commonDisease.LastEditDate  = DateTime.Now;
            commonDisease.LastEditUser  = request.ActionUserID;
            this.diseaseRepository.Update(commonDisease);
            this.unitOfWork.Commit();

            return(this.BuildSuccessResponse());
        }
Пример #5
0
 public BaseResponse UpdateCommonDisease(CommonDiseaseRequest request)
 {
     return(this.diseaseService.UpdateCommonDisease(request));
 }
Пример #6
0
 public async Task <BaseResponse> UpdateCommonDisease(CommonDiseaseRequest request)
 {
     return(await this.PutAsync <CommonDiseaseRequest, BaseResponse>("update", request));
 }
Пример #7
0
 public async Task <BaseResponse> CreateCommonDisease(CommonDiseaseRequest request)
 {
     return(await this.PostAsync <CommonDiseaseRequest, BaseResponse>("create", request));
 }