protected void btnAdd_Click(object sender, EventArgs e) { string Areaname = Common.NoHTML(txtAreaName.Value.Trim()); string Parentid = Common.NoHTML(hideAreaId.Value.Trim()); string sortid = Common.NoHTML(txtSortIndex.Value.Trim()); //string areacode = txtAreacode.Value.Trim(); Hi.Model.BD_DisArea DisArea = new Hi.Model.BD_DisArea(); int Result = 0; if (string.IsNullOrEmpty(Areaname)) { JScript.AlertMethod(this, "分类名称不能为空", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }"); return; } if (IsExistsArea("AreaName", Areaname)) { JScript.AlertMethod(this, "此分类名已存在!", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }"); return; } if (string.IsNullOrEmpty(Parentid) || !int.TryParse(Parentid, out Result)) { DisArea.ParentID = 0; } else { DisArea.ParentID = Result; } DisArea.CompanyID = CompID; DisArea.AreaName = Areaname; //DisArea.Areacode = areacode; DisArea.SortIndex = sortid; DisArea.ts = DateTime.Now; DisArea.modifyuser = 0; if (new Hi.BLL.BD_DisArea().Add(DisArea) > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>location.href='DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "&lefttype=" + Request["lefttype"] + "&type=" + Request["type"] + "';</script>"); } else { JScript.AlertMethod(this, "添加失败!", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }"); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.BD_DisArea model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.BD_DisArea model) { return(dal.Add(model)); }