/// <summary> /// 控件双击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Medcine_DoubleClick(object sender, EventArgs e) { MedList list = new MedList(); MedName = lblMedName.Text; MedCode = lblMedCode.Text; MedID = lblMedID.Text; SeqNo = lblSeqNo.Text; status = "change"; Med = this; switch (list.ShowDialog()) { case DialogResult.OK: lblMedCode.Text = MedList.MeCode; lblMedName.Text = MedList.MeName; lblIsClass.Text = Convert.ToString(MedList.IsClass); break; case DialogResult.Yes: lblMedCode.Text = MedList.MeCode; lblMedName.Text = MedList.MeName; lblIsClass.Text = "0"; break; } }
/// <summary> /// 低优先级新增药品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddLow_Click(object sender, EventArgs e) { try { if (DWard.IsClick) { WardCode = DWard.DWardCode; } string str = "select max(SeqNo) as SeqNo from OrderMPRule where SeqNo > 150000000 and WardCode = '" + WardCode + "'"; DS = DB.GetPIVAsDB(str); if (DS.Tables[0].Rows[0]["SeqNo"].ToString() == "") { SeqNo = "150000000"; } else { SeqNo = DS.Tables[0].Rows[0]["SeqNo"].ToString(); } status = "add"; MedList List = new MedList(); switch (List.ShowDialog()) { case DialogResult.OK: MedcineRow r1 = new MedcineRow(pnlMed2); r1.SetMed(MedList.MeID, MedList.MeCode, MedList.MeName, MedList.MeSeqNo, Convert.ToString(MedList.IsClass)); pnlMed2.Controls.Add(r1); ShowMedcine(WardCode); break; case DialogResult.Yes: MedcineRow r2 = new MedcineRow(pnlMed2); r2.SetMed(MedList.MeID, MedList.MeCode, MedList.MeName, MedList.MeSeqNo, Convert.ToString(MedList.IsClass)); pnlMed2.Controls.Add(r2); ShowMedcine(WardCode); break; } status = ""; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 高优先级添加药品按钮单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddUp_Click(object sender, EventArgs e) { try { if (DWard.IsClick) { WardCode = DWard.DWardCode; } string str = "select max(SeqNo) as SeqNo from OrderMPRule where SeqNo < 100000000 and WardCode = '" + WardCode + "'"; DS = DB.GetPIVAsDB(str); if (DS.Tables[0].Rows[0]["SeqNo"].ToString() == "") { SeqNo = "0"; } else { SeqNo = DS.Tables[0].Rows[0]["SeqNo"].ToString(); } status = "add"; MedList List = new MedList(); switch (List.ShowDialog()) { case DialogResult.OK: if (MedList.MeCode == null) { return; } MedcineRow r1 = new MedcineRow(pnlMed1); r1.SetMed(MedList.MeID, MedList.MeCode, MedList.MeName, MedList.MeSeqNo, Convert.ToString(MedList.IsClass)); if (pnlMed1.Controls.Count > 0) { foreach (Control c in pnlMed1.Controls) { if (c is MedcineRow) { MedcineRow med = (MedcineRow)c; if (r1.medCode == med.medCode) //避免重复添加相同的药品 { //MessageBox.Show("重复!"); break; } else { pnlMed1.Controls.Add(r1); ShowMedcine(WardCode); break; } } } } else { pnlMed1.Controls.Add(r1); ShowMedcine(WardCode); break; } break; case DialogResult.Yes: MedcineRow r2 = new MedcineRow(pnlMed1); r2.SetMed(MedList.MeID, MedList.MeCode, MedList.MeName, MedList.MeSeqNo, Convert.ToString(MedList.IsClass)); if (pnlMed1.Controls.Count > 0) { foreach (Control c in pnlMed1.Controls) { if (c is MedcineRow) { MedcineRow med = (MedcineRow)c; if (r2.medCode == med.medCode) //避免重复添加相同的药品 { break; } else { pnlMed1.Controls.Add(r2); ShowMedcine(WardCode); break; } } } } else { pnlMed1.Controls.Add(r2); ShowMedcine(WardCode); break; } break; } status = ""; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }