コード例 #1
0
        /// <summary>
        /// 选中厂家显示厂家详情
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void dgHisDic_CurrentCellChanged(object sender, EventArgs e)
        {
            if (dgHisDic.CurrentCell == null)
            {
                frmHosp.Clear();
                CurrentHospDic = null;
                return;
            }

            CurrentHospDic = null;
            int rowindex = dgHisDic.CurrentCell.RowIndex;

            CurrentRowIndex = rowindex;
            DataTable       dt  = (DataTable)dgHisDic.DataSource;
            MW_HospMakerDic dic = new MW_HospMakerDic();

            dic            = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <MW_HospMakerDic>(dt, rowindex);
            CurrentHospDic = dic;
            frmHosp.Load <MW_HospMakerDic>(dic);
        }
コード例 #2
0
        /// <summary>
        /// 保存厂家信息
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void btnSaveHosp_Click(object sender, EventArgs e)
        {
            bool isNew = false;

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

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

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

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

                MW_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
                {
                    dic   = new MW_HospMakerDic();
                    isNew = true;
                }

                try
                {
                    frmHosp.GetValue <MW_HospMakerDic>(dic);
                    dic.PYCode      = EFWCoreLib.CoreFrame.Common.SpellAndWbCode.GetSpellCode(dic.MatName);
                    dic.WBCode      = EFWCoreLib.CoreFrame.Common.SpellAndWbCode.GetWBCode(dic.MatName);
                    CurrentHospDic  = dic;
                    dic.CenterMatID = CurrentData.CenterMatID;
                    InvokeController("SaveHisDic");
                    if (isNew)
                    {
                        setGridSelectIndex(dgHisDic, dgHisDic.RowCount - 1);
                    }
                    else
                    {
                        setGridSelectIndex(dgHisDic);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }