/// <summary> /// 修改信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ok_Click(object sender, EventArgs e) { PatientInfo objPatientInfo = new PatientInfo() { PatientName = this.txt_name.Text.Trim(), PatientAge = this.txt_age.Text.Trim(), PatientGender = this.rad_man.Checked ? "男" : "女", PatientNum = this.txt_zhuyuannum.Text.Trim(), Patientstarttime = dtp_time.Value, PatientDepartment = this.txt_keshi.Text.Trim(), PatientBednum = (this.txt_bedbum.Text.Trim()) }; ShowInfo objShowInfo = objShowInfoService.GetShowInfo(); if (objShowInfo.AllOrPart == 1) { if (Ischange) { FrmMain.MyShowblock1[flag].Peoplename = objPatientInfo.PatientName; FrmMain.MyShowblock1[flag].myBackColor = Color.DeepSkyBlue; int result = objPatientService.AddPatients(objPatientInfo); if (result == 1) { MessageBox.Show("添加成功!", "系统提示!"); } } else { int result = 0; FrmMain.MyShowblock1[flag].Peoplename = objPatientInfo.PatientName; FrmMain.MyShowblock1[flag].myBackColor = Color.DeepSkyBlue; objPatientInfo.PatientBednum = FrmMain.MyShowblock1[flag].Bednum; if (Convert.ToInt16(FrmMain.MyShowblock1[flag].Bednum) > 256) { result = objAdditionalPatientsService.UpdatePatientInfo(objPatientInfo); } else { result = objPatientService.UpdatePatientInfo(objPatientInfo); } if (result == 1) { MessageBox.Show("修改成功!", "系统提示!"); } } } else { FrmMain.MyShowblock[flag].Peoplename = objPatientInfo.PatientName; FrmMain.MyShowblock[flag].myBackColor = Color.DeepSkyBlue; int result = 0; objPatientInfo.PatientBednum = FrmMain.MyShowblock[flag].Bednum; if (Convert.ToInt16(FrmMain.MyShowblock[flag].Bednum) > 256) { result = objAdditionalPatientsService.UpdatePatientInfo(objPatientInfo); } else { result = objPatientService.UpdatePatientInfo(objPatientInfo); } if (result == 1) { MessageBox.Show("修改成功!", "系统提示!"); } } this.Close(); }
private void btn_ok_Click(object sender, EventArgs e) { int result; //信息校验 if (this.txt_bedbum.Text.Trim().Length == 0) { MessageBox.Show("请输入病人床号!", "系统提示!"); this.txt_name.Focus(); return; } //if (this.txt_age.Text.Trim().Length == 0) //{ // MessageBox.Show("请输入病人年龄!", "系统提示!"); // this.txt_age.Focus(); // return; //} //if (this.txt_keshi.Text.Trim().Length == 0) //{ // MessageBox.Show("请输入病人所在科室!", "系统提示"); // this.txt_keshi.Focus(); // return; //} //if (this.txt_zhuyuannum.Text.Trim().Length == 0) //{ // MessageBox.Show("请输入病人住院号!", "系统提示!"); // this.txt_zhuyuannum.Focus(); // return; //} //if (rad_man.Checked == false && rad_woman.Checked == false) //{ // MessageBox.Show("请选择性别!", "系统提示!"); // return; //} //封装病人信息 PatientInfo objPatientInfo = new PatientInfo(); objPatientInfo.PatientName = this.txt_name.Text.Trim(); objPatientInfo.PatientAge = this.txt_age.Text.Trim(); if (this.ckdnewbed.Checked == true) { objPatientInfo.PatientBednum = (Convert.ToInt32(this.txt_bedbum.Text.Trim()) + 256).ToString(); } else { objPatientInfo.PatientBednum = this.txt_bedbum.Text.Trim(); } if (this.rad_man.Checked == true) { objPatientInfo.PatientGender = "男"; } else if (this.rad_woman.Checked == true) { objPatientInfo.PatientGender = "女"; } else { objPatientInfo.PatientGender = "未录入"; } objPatientInfo.PatientDepartment = this.txt_keshi.Text.Trim(); objPatientInfo.PatientNum = this.txt_zhuyuannum.Text.Trim(); objPatientInfo.Patientstarttime = dtp_time.Value; for (int i = 0; i < FrmMain.MyShowblock.Count; i++) { if (objPatientInfo.PatientBednum.ToString() == FrmMain.MyShowblock[i].Bednum) { MessageBox.Show("该床已经存在病人!请查看!", "系统提示!"); this.txt_bedbum.Focus(); return; } } if (this.ckdnewbed.Checked == true) { result = objAdditionalPatientsService.Add_AdditionalPatients(objPatientInfo); Setbed(); } else { result = objPatientService.AddPatients(objPatientInfo); } u3.Bednum = objPatientInfo.PatientBednum.ToString(); u3.Peoplename = objPatientInfo.PatientName; u3.Btnexporttag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.Btnpipeitag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.Btnselecttag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.Btnstarttag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.WriteToolStripMenuItemtag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.GetToolStripMenuItemtag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); u3.EndToolStripMenuItemtag = Convert.ToInt32(this.txt_bedbum.Text.Trim()); // FrmMain.MyShowblock.Add(u3); addinfo(objPatientInfo); if (result == 1) { MessageBox.Show("录入成功!", "系统提示!"); DataHelper.Flagexit = true; } objSetInfo.IsEnable = 1; objSetInfo.PatientBednum = Convert.ToInt32(this.txt_bedbum.Text.Trim()); objSetInfoService.AddSetInfo(objSetInfo); this.Close(); }