Exemple #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //验证单位名称

            if (txtUnit.Text.Trim() == "")
            {
                MessageBoxEx.Show("请输入商品单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUnit.Focus();
                return;
            }



            Dong.BLL.Unit   bUnit = new Dong.BLL.Unit();
            Dong.Model.Unit model = new Dong.Model.Unit();
            model.Name = txtUnit.Text;
            model.Id   = int.Parse(this.Tag.ToString());
            if (bUnit.Update(model))
            {
                MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmUnit fvip = (frmUnit)this.Owner;
                fvip.refreshData();
                this.Close();
            }
            else
            {
                MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void frmEditGoods_Load(object sender, EventArgs e)
        {
            Dong.BLL.Category catebll = new Dong.BLL.Category();
            ddlCategory.DataSource    = catebll.GetAllList().Tables[0];
            ddlCategory.DisplayMember = "Name";
            ddlCategory.ValueMember   = "Id";
            //绑定单位
            Dong.BLL.Unit unitbll = new Dong.BLL.Unit();
            ddlUnit.DataSource    = unitbll.GetAllList().Tables[0];
            ddlUnit.DisplayMember = "Name";
            ddlUnit.ValueMember   = "Id";
            //绑定供应商
            Dong.BLL.Supplier supplierbll = new Dong.BLL.Supplier();
            ddlSupper.DataSource    = supplierbll.GetAllList().Tables[0];
            ddlSupper.DisplayMember = "Name";
            ddlSupper.ValueMember   = "Id";

            Dong.BLL.GoodsInfo   bll   = new Dong.BLL.GoodsInfo();
            Dong.Model.GoodsInfo model = new Dong.Model.GoodsInfo();
            model = bll.GetModelById(int.Parse(this.Tag.ToString()));
            if (model != null)
            {
                tbCode.Text               = model.Code;
                tbName.Text               = model.GoodsName;
                tbFactory.Text            = model.Factory;
                ddlCategory.SelectedValue = model.Category;
                ddlUnit.SelectedValue     = model.Unit;
                ddlSupper.SelectedValue   = model.Supplier;
                txtPrice0.Text            = model.Price0 == null ? "" : model.Price0.ToString();
                txtPrice1.Text            = model.Price1 == null ? "" : model.Price1.ToString();
                txtPrice2.Text            = model.Price2 == null ? "" : model.Price2.ToString();
            }
        }
Exemple #3
0
 private void frmEditUnit_Load(object sender, EventArgs e)
 {
     Dong.BLL.Unit   bll   = new Dong.BLL.Unit();
     Dong.Model.Unit model = new Dong.Model.Unit();
     model = bll.GetModel(int.Parse(this.Tag.ToString()));
     if (model != null)
     {
         txtUnit.Text = model.Name;
     }
 }
Exemple #4
0
        private void fillGVList()
        {
            Dong.BLL.Unit bVip = new Dong.BLL.Unit();
            DataSet       ds   = new DataSet();

            ds = bVip.GetAllList();

            gvList.DataSource = ds.Tables[0];
            if (ds.Tables[0].Rows.Count > 0)
            {
            }
            else
            {
                MessageBoxEx.Show("对不起,没有您搜索的记录!");
            }
        }
Exemple #5
0
 private void frmAddGoods_Load(object sender, EventArgs e)
 {
     //绑定商品类别
     Dong.BLL.Category catebll = new Dong.BLL.Category();
     ddlCategory.DataSource    = catebll.GetAllList().Tables[0];
     ddlCategory.DisplayMember = "Name";
     ddlCategory.ValueMember   = "Id";
     //绑定单位
     Dong.BLL.Unit unitbll = new Dong.BLL.Unit();
     ddlUnit.DataSource    = unitbll.GetAllList().Tables[0];
     ddlUnit.DisplayMember = "Name";
     ddlUnit.ValueMember   = "Id";
     //绑定供应商
     Dong.BLL.Supplier supplierbll = new Dong.BLL.Supplier();
     ddlSupper.DataSource    = supplierbll.GetAllList().Tables[0];
     ddlSupper.DisplayMember = "Name";
     ddlSupper.ValueMember   = "Id";
 }
Exemple #6
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            //删除会员
            string id = gvList.SelectedRows[0].Cells[0].Value.ToString();

            if (id != "")
            {
                if (MessageBoxEx.Show("确定删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    Dong.BLL.Unit bMember = new Dong.BLL.Unit();
                    bMember.Delete(int.Parse(id));
                    this.gvList.Rows[0].Selected = true;
                    fillGVList();
                }
            }
            else
            {
                MessageBoxEx.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }