private void button_Add_Click(object sender, EventArgs e) { VipSoft.BLL.GoodsClass gc = new VipSoft.BLL.GoodsClass(); if (this.textBox_ClassName.Text == "新类别" || this.textBox_ClassName.Text == "") { MessageBox.Show("请输入分类名称。"); return; } if (this.label_ID.Text == "label_ID" && this.label_ParentID.Text == "label_ParentID") { MessageBox.Show("请先在左侧列表中选择对应操作!"); return; } if (this.button_Add.Text == "增加分类") { if (this.label_ParentID.Text == "") { MessageBox.Show("请先在左侧列表中选择对应操作!"); return; } VipSoft.Model.GoodsClass model = new Model.GoodsClass(); model.ClassName = this.textBox_ClassName.Text; model.ParentID = int.Parse(this.label_ParentID.Text); model.ShopID = PublicState.Master.ShopID; model.ShopName = PublicState.Master.ShopName; gc.Add(model); // 写入日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master, "商品分类管理", string.Format("增加分类成功,名称:{0}父类:{1}", this.textBox_ClassName.Text, this.textBox_Parent.Text), DateTime.Now)); // 文本框清空 this.label_ID.Text = ""; this.label_ParentID.Text = ""; this.textBox_Parent.Text = ""; this.textBox_ClassName.Text = ""; } else { VipSoft.Model.GoodsClass gci = new VipSoft.Model.GoodsClass(); gci.ClassName = this.textBox_ClassName.Text.Trim(); gci.ID = int.Parse(this.label_ID.Text); gc.Update(gci); // 写入日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master, "商品分类管理", string.Format("修改分类成功,名称:{0}父类:{1}", this.textBox_ClassName.Text, this.textBox_Parent.Text), DateTime.Now)); } // 重新绑定 BindClass(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(VipSoft.Model.GoodsClass model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(VipSoft.Model.GoodsClass model) { return(dal.Add(model)); }