Beispiel #1
0
        private void ReturnBtn_Click(object sender, RoutedEventArgs e)
        {
            // 保存退款
            if (string.IsNullOrEmpty(this.FeeNumBox.Text))
            {
                return;
            }

            if (Math.Round(Decimal.Parse(this.FeeNumBox.Text), 2) < 0)
            {
                return;
            }

            if (Math.Round(Decimal.Parse(this.BalanceBox.Text), 2) - Math.Round(Decimal.Parse(this.FeeNumBox.Text), 2) < 0)
            {
                return;
            }

            var vm = this.DataContext as HISGUIPatientCardVM;

            CommContracts.PatientCardPrePay prePay = new CommContracts.PatientCardPrePay();
            prePay.PrePayType    = CommContracts.PrePayTypeEnum.退款;
            prePay.PrePayMoney   = Math.Round(Decimal.Parse(this.FeeNumBox.Text), 2);
            prePay.PrePayWayEnum = (CommContracts.PrePayWayEnum) this.PrePayWayCombo.SelectedItem;
            prePay.PatientID     = vm.CurrentPatient.ID;
            prePay.UserID        = vm.CurrentUser.ID;
            prePay.CurrentTime   = DateTime.Now;

            CommClient.PatientCardPrePay prePayClient = new CommClient.PatientCardPrePay();
            int prePayID = 0; string ErrorMsg = "";

            if (prePayClient.SavePrePay(prePay, ref prePayID, ref ErrorMsg))
            {
                CommClient.Patient patientClient = new CommClient.Patient();
                vm.CurrentPatient.PatientCardBalance -= Math.Round(Decimal.Parse(this.FeeNumBox.Text), 2);

                if (patientClient.UpdatePatient(vm.CurrentPatient, ref ErrorMsg))
                {
                    MessageBox.Show("OK");
                    updatePatientsMsg(vm.CurrentPatient.PatientCardNo);
                }
                else
                {
                    vm.CurrentPatient.PatientCardBalance += Math.Round(Decimal.Parse(this.FeeNumBox.Text), 2);
                    prePayClient.DeletePrePay(prePayID);
                    MessageBox.Show("Error:" + ErrorMsg);
                }
            }
            else
            {
                MessageBox.Show("Error" + ErrorMsg);
            }
        }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.Name.Text.Trim()))
            {
                return;
            }

            if (this.GenderCombo.SelectedItem == null)
            {
                return;
            }
            if (bIsEdit)
            {
                Patient.Name         = this.Name.Text.Trim();
                Patient.ZhengJianNum = this.IDCardNo.Text;
                Patient.JiGuan_Sheng = this.JiGuan.Text;
                Patient.Tel          = this.Tel.Text;
                Patient.Gender       = (CommContracts.GenderEnum) this.GenderCombo.SelectedItem;
                Patient.Volk         = (CommContracts.VolkEnum) this.VolkEnumCombo.SelectedItem;
                Patient.BirthDay     = this.BirthDay.SelectedDate;


                CommClient.Patient myd   = new CommClient.Patient();
                string             error = "";
                if (myd.UpdatePatient(Patient, ref error))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
            else
            {
                CommContracts.Patient patient = new CommContracts.Patient();
                patient.Name         = this.Name.Text.Trim();
                patient.ZhengJianNum = this.IDCardNo.Text.Trim();
                patient.JiGuan_Sheng = this.JiGuan.Text.Trim();
                patient.Tel          = this.Tel.Text.Trim();
                patient.Gender       = (CommContracts.GenderEnum) this.GenderCombo.SelectedItem;
                patient.Volk         = (CommContracts.VolkEnum) this.VolkEnumCombo.SelectedItem;
                patient.BirthDay     = this.BirthDay.SelectedDate;

                CommClient.Patient myd = new CommClient.Patient();
                if (myd.SavePatient(patient))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }
 /// <summary>
 /// 更新患者登记信息
 /// </summary>
 public bool UpdatePatientMsg(CommContracts.Patient patient, ref string ErrorMsg)
 {
     CommClient.Patient client = new CommClient.Patient();
     return(client.UpdatePatient(patient, ref ErrorMsg));
 }