/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { //验证类别名称 if (txtName.Text.Trim() == "") { MessageBoxEx.Show("请输入商品类别名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); txtName.Focus(); return; } Dong.BLL.Category bll = new Dong.BLL.Category(); Dong.Model.Category model = new Dong.Model.Category(); model.Name = txtName.Text; model.Id = int.Parse(this.Tag.ToString()); if (bll.Update(model)) { MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCategory fvip = (frmCategory)this.Owner; fvip.refreshData(); this.Close(); } else { MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { //验证单位名称 if (txtName.Text.Trim() == "") { MessageBoxEx.Show("请输入商品类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); txtName.Focus(); return; } Dong.BLL.Category bll = new Dong.BLL.Category(); Dong.Model.Category model = new Dong.Model.Category(); model.Name = txtName.Text; if (bll.Add(model)) { MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCategory frm = (frmCategory)this.Owner; frm.refreshData(); this.Close(); } else { MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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(); } }
private void frmEditUnit_Load(object sender, EventArgs e) { Dong.BLL.Category bll = new Dong.BLL.Category(); Dong.Model.Category model = new Dong.Model.Category(); model = bll.GetModel(int.Parse(this.Tag.ToString())); if (model != null) { txtName.Text = model.Name; } }
private void fillGVList() { Dong.BLL.Category bVip = new Dong.BLL.Category(); DataSet ds = new DataSet(); ds = bVip.GetAllList(); gvList.DataSource = ds.Tables[0]; if (ds.Tables[0].Rows.Count > 0) { } else { MessageBoxEx.Show("对不起,没有您搜索的记录!"); } }
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"; }
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.Category bll = new Dong.BLL.Category(); bll.Delete(int.Parse(id)); this.gvList.Rows[0].Selected = true; fillGVList(); } } else { MessageBoxEx.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmGoodsSearch_Load(object sender, EventArgs e) { //绑定商品类别 Dong.BLL.Category catebll = new Dong.BLL.Category(); DataTable dt = catebll.GetAllList().Tables[0]; DataRow dr = dt.NewRow(); dr[0] = "0"; dr[1] = "0"; dr[2] = "全部"; dt.Rows.InsertAt(dr, 0); ddlCate.DataSource = dt; ddlCate.DisplayMember = "Name"; ddlCate.ValueMember = "Id"; //设置DataGridView的显示样式 gvList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; gvList.AutoGenerateColumns = false; fillGVList("", intPageSize, 1); //填充数据 //分页 //初始页面显示条数选择框 for (int i = 1; i < 6; i++) { int j = i * 10; cbPageSize.Items.Add(j.ToString()); } cbPageSize.Text = "20"; //页面条数显示框默认显示为20条 //绑定页面显示条数设置控件的TextChanged事件 cbPageSize.TextChanged += new EventHandler(cbPageSize_TextChanged); }