private void btnSave_Click(object sender, EventArgs e) { if (!ValidatePage()) { return; } if (CurrEditMode == eEditMode.新增) { if (this.Output == null) { return; } CmcsGoodsType entity = new CmcsGoodsType(); entity.TreeCode = commonDAO.GetGoodsNewChildCode(this.Output.TreeCode); entity.GoodsName = txt_GoodsName.Text; entity.OrderNumber = dbi_OrderNumber.Value; entity.ParentId = this.Output.Id; entity.IsValid = chb_IsUse.Checked ? 1 : 0; entity.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Insert <CmcsGoodsType>(entity); } else if (CurrEditMode == eEditMode.修改) { if (this.Output == null) { return; } //是否更新子节点状态 if (this.Output.IsValid != (chb_IsUse.Checked ? 1 : 0)) { if (MessageBoxEx.Show("是否将启用状态应用到子节点", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { commonDAO.UpdateGoodsChildsIsUse(this.Output.Id, chb_IsUse.Checked ? 1 : 0); } } this.Output.GoodsName = txt_GoodsName.Text; this.Output.OrderNumber = dbi_OrderNumber.Value; this.Output.IsValid = chb_IsUse.Checked ? 1 : 0; this.Output.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Update <CmcsGoodsType>(this.Output); } InitTree(); }
private void btnSave_Click(object sender, EventArgs e) { if (!ValidatePage()) { return; } if (CurrEditMode == eEditMode.新增) { if (this.Output == null) { return; } CmcsGoodsType entity = new CmcsGoodsType(); entity.TreeCode = commonDAO.GetGoodsNewChildCode(this.Output.TreeCode); entity.GoodsName = txt_GoodsName.Text; entity.OrderNumber = Convert.ToInt32(dbi_OrderNumber.Text); entity.ParentId = this.Output.Id; entity.IsValid = chb_IsUse.Checked ? 1 : 0; entity.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Insert <CmcsGoodsType>(entity); } else if (CurrEditMode == eEditMode.修改) { if (this.Output == null) { return; } this.Output.GoodsName = txt_GoodsName.Text; this.Output.OrderNumber = Convert.ToInt32(dbi_OrderNumber.Text); this.Output.IsValid = chb_IsUse.Checked ? 1 : 0; this.Output.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Update <CmcsGoodsType>(this.Output); } InitTree(); }