コード例 #1
0
        /// <summary>
        ///保存操作
        /// </summary>
        /// <param name="sender">对象</param>
        /// <param name="e">参数</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            btnAdd.Visible   = true;
            btnCacel.Visible = false;
            bar2.Refresh();
            bool isNew = false;

            if (frmForm2.Validate())
            {
                DG_CenterSpecDic dic = null;
                if (CurrentData != null)
                {
                    dic = CurrentData;
                    if (MessageBox.Show("确定更改记录?", string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                        DialogResult.No)
                    {
                        return;
                    }
                }
                else
                {
                    isNew = true;
                    dic   = new DG_CenterSpecDic();
                }

                try
                {
                    frmForm2.GetValue <DG_CenterSpecDic>(dic);
                    dic.PackUnit = this.tbPackUnit.Text;
                    dic.MiniUnit = this.tbMinUnit.Text;
                    dic.DoseUnit = this.tbcDoseUnit.Text;
                    dic.PYCode   = string.IsNullOrEmpty(txtDicPY.Text) == true?EFWCoreLib.CoreFrame.Common.SpellAndWbCode.GetSpellCode(dic.ChemName) : txtDicPY.Text;

                    dic.WBCode = string.IsNullOrEmpty(txtDicWb.Text) == true?EFWCoreLib.CoreFrame.Common.SpellAndWbCode.GetWBCode(dic.ChemName) : txtDicWb.Text;

                    dic.LunacyGrade = this.cbLunacy.SelectedIndex;
                    CurrentData     = dic;
                    InvokeController("ChangeView", frmName);
                    InvokeController("SaveDrugDic", frmName, isNew);
                    if (isNew)
                    {
                        setGridSelectIndex(dgDrugDic, dgDrugDic.Rows.Count - 1);
                        if (frmName == "FrmHisDrugDic")
                        {
                            this.superTabControl2.SelectedPanel = superTabControlPanel4;
                            btnAddHosp_Click(null, null);
                        }
                    }
                    else
                    {
                        setGridSelectIndex(dgDrugDic);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存失败" + ex.Message);
                    throw;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 中心药典的药品是否有库存
        /// </summary>
        /// <param name="dic">药品中心字典对象</param>
        /// <returns>是否有库存</returns>
        private bool CheckDrugStore(DG_CenterSpecDic dic)
        {
            var t = oleDb.Query <DG_CenterSpecDic>(string.Format("select * from DG_CenterSpecDic where CenteDrugID={0}", dic.CenteDrugID), null).FirstOrDefault();

            if (t.PackUnitID == dic.PackUnitID &&
                t.DoseUnitID == dic.DoseUnitID &&
                t.PackAmount == dic.PackAmount &&
                t.MiniUnitID == dic.MiniUnitID &&
                t.DoseAmount == dic.DoseAmount &&
                t.IsStop == dic.IsStop
                )
            {
                //没有更改药品的系数属性
                return(true);
            }
            else
            {
                return(NewObject <IDGDao>().StoreExsitDrug(dic.CenteDrugID));//中心药典没有库存返回true;
            }
        }
コード例 #3
0
        /// <summary>
        /// 取消操作
        /// </summary>
        /// <param name="sender">对象</param>
        /// <param name="e">参数</param>
        private void btnCacel_Click(object sender, EventArgs e)
        {
            btnAdd.Visible = true;
            bar2.Refresh();
            //CurrentData = null;
            //frmForm2.Clear();
            if (dgDrugDic.CurrentCell == null)
            {
                return;
            }

            CurrentData = null;
            int              rowindex = dgDrugDic.CurrentCell.RowIndex;
            DataTable        dt       = (DataTable)dgDrugDic.DataSource;
            DG_CenterSpecDic dic      = new DG_CenterSpecDic();

            dic = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <DG_CenterSpecDic>(dt, rowindex);
            if (frmName == "FrmHisDrugDic")
            {
                HospAndWhere = new List <Tuple <string, string, SqlOperator> >();
                HospAndWhere.Add(Tuple.Create("d.CenteDrugID", dic.CenteDrugID.ToString(), SqlOperator.Equal));
                InvokeController("LoadHisDic");
            }

            CurrentData = dic;
            frmForm2.Load <DG_CenterSpecDic>(dic);
            if (dic.IsAze == 1)
            {
                this.ckIsAze.Checked = true;
            }

            if (dic.IsRecipe == 1)
            {
                this.ckRecipe.Checked = true;
            }

            if (dic.IsSkin == 1)
            {
                this.ckIsSkin.Checked = true;
            }

            if (dic.IsPosion == 1)
            {
                this.ckIsPosition.Checked = true;
            }

            if (dic.IsBigTransfu == 1)
            {
                this.ckBigTrans.Checked = true;
            }

            if (dic.IsStop == 1)
            {
                this.ckIsStop.Checked = true;
            }

            this.cbLunacy.SelectedIndex = dic.LunacyGrade;
            if (dic.AuditStatus == 1)
            {
                this.txtAutitMan.Text    = dt.Rows[rowindex]["UserName"].ToString();
                this.timeAu.Text         = dt.Rows[rowindex]["AuditTime"].ToString();
                this.txtAuditResult.Text = "已经审核";
            }
            else
            {
                this.txtAuditResult.Text = "未审核";
            }

            btnCacel.Visible = false; //新增的时候才显示取消按钮
        }
コード例 #4
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="p">中心典对象</param>
 public void SaveDrugDic(DG_CenterSpecDic p)
 {
     p.save();
 }