示例#1
0
        /// <summary>
        ///取消操作
        /// </summary>
        /// <param name="sender">对象</param>
        /// <param name="e">参数</param>
        private void btnHospCancel_Click(object sender, EventArgs e)
        {
            btnAddHosp.Visible = true;
            bar1.Refresh();
            //frmForm3.Clear();
            //CurrentHospDic = null;
            btnHospCancel.Visible = false;
            if (dgHisDic.CurrentCell == null)
            {
                frmForm3.Clear();
                CurrentHospDic = null;
                return;
            }

            CurrentHospDic = null;
            int             rowindex = dgHisDic.CurrentCell.RowIndex;
            DataTable       dt       = (DataTable)dgHisDic.DataSource;
            DG_HospMakerDic dic      = new DG_HospMakerDic();

            dic            = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <DG_HospMakerDic>(dt, rowindex);
            CurrentHospDic = dic;
            this.cbRoundOff.SelectedIndex = dic.RoundingMode;
            this.cbMaker.SelectedIndex    = dic.Maker;
            frmForm3.Load <DG_HospMakerDic>(dic);
        }
示例#2
0
        /// <summary>
        /// 选中发生变化事件
        /// </summary>
        /// <param name="sender">对象</param>
        /// <param name="e">参数</param>
        private void dgHisDic_CurrentCellChanged(object sender, EventArgs e)
        {
            if (dgHisDic.CurrentCell == null)
            {
                frmForm3.Clear();
                CurrentHospDic = null;
                return;
            }

            CurrentHospDic = null;
            int             rowindex = dgHisDic.CurrentCell.RowIndex;
            DataTable       dt       = (DataTable)dgHisDic.DataSource;
            DG_HospMakerDic dic      = new DG_HospMakerDic();

            dic            = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <DG_HospMakerDic>(dt, rowindex);
            CurrentHospDic = dic;
            this.cbRoundOff.SelectedIndex = dic.RoundingMode;
            this.cbMaker.SelectedIndex    = dic.Maker;
            frmForm3.Load <DG_HospMakerDic>(dic);
        }
示例#3
0
        /// <summary>
        ///保存操作
        /// </summary>
        /// <param name="sender">对象</param>
        /// <param name="e">参数</param>
        private void btnSaveHosp_Click(object sender, EventArgs e)
        {
            btnHospCancel.Visible = false;
            btnAddHosp.Visible    = true;
            bar1.Refresh();
            bool isNew = false;

            if (frmForm3.Validate())
            {
                if (cbRoundOff.SelectedIndex == -1)
                {
                    MessageBoxEx.Show("不能为空");
                    cbRoundOff.Focus();
                    return;
                }

                if (cbMaker.SelectedIndex == -1)
                {
                    MessageBoxEx.Show("不能为空");
                    cbMaker.Focus();
                    return;
                }

                if (CurrentData == null)
                {
                    MessageBoxEx.Show("请选择中心典记录");
                    return;
                }

                if (txtStockPrice.Value < 0.01)
                {
                    MessageBoxEx.Show("进价不能为0");
                    return;
                }

                if (txtRetailPrice.Value < 0.01)
                {
                    MessageBoxEx.Show("售价不能为0");
                    return;
                }

                if (txtStockPrice.Value > txtRetailPrice.Value)
                {
                    MessageBoxEx.Show("售价必须大于进价");
                    return;
                }

                DG_HospMakerDic dic = null;
                if (CurrentHospDic != null)
                {
                    dic = CurrentHospDic;
                    if (dic.IsStop == 1)
                    {
                        this.ckHospStop.Enabled = true;
                    }

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

                int id = dic.ProductID;
                try
                {
                    frmForm3.GetValue <DG_HospMakerDic>(dic);

                    dic.PYCode = string.IsNullOrEmpty(txtHDicPY.Text) == true?EFWCoreLib.CoreFrame.Common.SpellAndWbCode.GetSpellCode(dic.TradeName) : txtHDicPY.Text;

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

                    dic.RoundingMode = this.cbRoundOff.SelectedIndex;
                    dic.Maker        = this.cbMaker.SelectedIndex;
                    CurrentHospDic   = dic;
                    dic.CenteDrugID  = CurrentData.CenteDrugID;
                    InvokeController("ChangeView", frmName);
                    InvokeController("SaveHisDic");
                    if (isNew)
                    {
                        setGridSelectIndex(this.dgHisDic, this.dgHisDic.Rows.Count - 1);
                    }
                    else
                    {
                        setGridSelectIndex(this.dgHisDic);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
示例#4
0
 /// <summary>
 /// 保存本院典
 /// </summary>
 /// <param name="p">本院典对象</param>
 public void SaveHospDic(DG_HospMakerDic p)
 {
     p.save();
 }