protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.BD_SalesMan sale = null; if (KeyID != 0) { sale = new Hi.BLL.BD_SalesMan().GetModel(KeyID); sale.SalesName = Common.NoHTML(txtSaleName.Value.Trim()); sale.SalesCode = Common.NoHTML(txtSaleCode.Value.Trim()); sale.Phone = Common.NoHTML(txtPhone.Value.Trim()); sale.Email = Common.NoHTML(txtEmail.Value.Trim()); sale.Remark = Common.NoHTML(txtRemark.Value.Trim()); if (this.rdoStatus1.Checked) { sale.IsEnabled = 0; } else { sale.IsEnabled = 1; } sale.ts = DateTime.Now; sale.modifyuser = UserID; if (new Hi.BLL.BD_SalesMan().Update(sale)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='SaleManInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("SaleManInfo.aspx?KeyID=" + KeyID + ""); } } else { sale = new Hi.Model.BD_SalesMan(); sale.OrgID = Convert.ToInt32(txtOrg.SelectedValue); sale.SalesName = Common.NoHTML(txtSaleName.Value.Trim()); sale.SalesCode = Common.NoHTML(txtSaleCode.Value.Trim()); sale.Phone = Common.NoHTML(txtPhone.Value.Trim()); sale.Email = Common.NoHTML(txtEmail.Value.Trim()); sale.Remark = Common.NoHTML(txtRemark.Value.Trim()); if (this.rdoStatus1.Checked) { sale.IsEnabled = 0; } else { sale.IsEnabled = 1; } //标准参数 sale.ts = DateTime.Now; sale.modifyuser = UserID; int newuserid = 0; newuserid = new Hi.BLL.BD_SalesMan().Add(sale); if (newuserid > 0) { Response.Redirect("SaleManInfo.aspx?KeyID=" + newuserid); } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.BD_SalesMan model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.BD_SalesMan model) { return(dal.Add(model)); }