Beispiel #1
0
 /// <summary>
 /// 每次排序钱需要进行初始值的选择,避免选取上一个panel中的控件
 /// </summary>
 private void InIMedicinePanel(Panel p)
 {
     if (p.Controls.Count > 0)
     {
         foreach (Control c in p.Controls)
         {
             if (c is MedcineRow)
             {
                 MedcineRow mr = (MedcineRow)c;
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 未选中的恢复颜色
 /// </summary>
 private void MedicineUnChoiceBgColor()
 {
     foreach (Control c in p.Controls)
     {
         if (c is MedcineRow)
         {
             MedcineRow medicine = (MedcineRow)c;
             if (medicine.medCode != medCode)
             {
                 medicine.BackColor = Color.White;
             }
         }
     }
 }
Beispiel #3
0
        /// <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);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 加载药品
        /// </summary>
        /// <param name="wardcode"></param>
        public void ShowMedcine(string wardcode)
        {
            //根据部门编号查询该部门下面的药品信息
            string str = "SELECT MPRuleID, IsMedClass, MedCode, MedName,SeqNo " +
                         "FROM OrderMPRule WHERE WardCode = '" + wardcode + "' ORDER BY SeqNo";

            WardCode = wardcode;//部门编号
            try
            {
                //清空显示区域
                pnlMed1.Controls.Clear(); //高优先级区域
                pnlMed2.Controls.Clear(); //低优先级区域
                DS = DB.GetPIVAsDB(str);
                for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    MedcineRow medcine;

                    //高优先级区域赋值
                    if (Convert.ToInt32(DS.Tables[0].Rows[i]["SeqNo"].ToString()) < 100000000)
                    {
                        medcine = new MedcineRow(pnlMed1);
                        medcine.SetMedcine(DS.Tables[0].Rows[i]);
                        pnlMed1.Controls.Add(medcine);
                    }

                    //低优先级区域赋值
                    else if (Convert.ToInt32(DS.Tables[0].Rows[i]["SeqNo"].ToString()) > 150000000)
                    {
                        medcine = new MedcineRow(pnlMed2);
                        medcine.SetMedcine(DS.Tables[0].Rows[i]);
                        pnlMed2.Controls.Add(medcine);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #5
0
        /// <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);
            }
        }