예제 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!IsNotEmpty())
            {
                return;
            }
            ProductInfoBLL proBll = new ProductInfoBLL();
            ProductInfo    pro    = new ProductInfo();
            int            i      = 0;

            pro.CId      = Convert.ToInt32(cmbCategory.SelectedValue); //获取选择的类别
            pro.ProCost  = Convert.ToDouble(txtCost.Text);             //价格
            pro.ProName  = txtName.Text;                               //名字
            pro.ProNum   = txtNum.Text;                                //编号
            pro.ProPrice = Convert.ToDouble(txtPrice.Text);            //实际的价格
            pro.ProSpell = txtSpell.Text;                              //拼音
            pro.ProStock = Convert.ToInt32(txtStock.Text);
            pro.ProUnit  = txtUnit.Text;                               //单位
            pro.Remark   = txtRemark.Text;;                            //备注
            if (status == HandleStatus.Insert)
            {
                pro.DelFlag = 0;
                pro.SubBy   = 1;
                pro.SubTime = System.DateTime.Now;//当前时间

                i = proBll.add(pro);
            }
            if (status == HandleStatus.Update)
            {
                pro.ProId   = oldProduct.ProId;
                pro.DelFlag = oldProduct.DelFlag;
                pro.SubBy   = oldProduct.SubBy;
                pro.SubTime = oldProduct.SubTime;

                i = proBll.update(pro);
            }
            string msg = i > 0 ? "操作成功" : "操作失败";

            md.MsgDivShow(msg, 1, Bind);
        }