protected void btnSave_Click(object sender, EventArgs e) { if (Request.QueryString["Id"] == null) { return; } string content = Request.Form["editor1"] == null ? "" : Request.Form["editor1"]; Maticsoft.BLL.tAbout bll = new Maticsoft.BLL.tAbout(); Maticsoft.Model.tAbout model = bll.GetModel(int.Parse(Request.QueryString["Id"])); if (model == null) { return; } model.AboutContent = content; model.Remark = txtRemark.Text; if (bll.Update(model)) { Alert.ShowInTop("保存成功!"); } else { Alert.ShowInTop("保存失败!"); } }
protected void btnSave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request.QueryString["pageId"])) { Maticsoft.BLL.tAbout BLL = new Maticsoft.BLL.tAbout(); int pageId = int.Parse(Request.QueryString["pageId"]); Maticsoft.Model.tAbout menu = BLL.GetModel(pageId); if (BLL.GetList(string.Format(" Title='{0}' and Id<>{1} ", txtName.Text, pageId)).Tables[0].Rows.Count >= 1) { Alert.ShowInTop("该名称已经存在!"); return; } menu.Id = pageId; menu.Title = txtName.Text.ToString().Trim(); menu.Sort = Convert.ToInt32(txtSort.Text.ToString().Trim()); if (BLL.Update(menu) == true) { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { Alert.ShowInTop("操作失败!"); } } else { Maticsoft.BLL.tAbout BLL = new Maticsoft.BLL.tAbout(); Maticsoft.Model.tAbout menu = new Maticsoft.Model.tAbout(); if (BLL.GetList(string.Format(" Title='{0}' ", txtName.Text)).Tables[0].Rows.Count >= 1) { Alert.ShowInTop("该名称已经存在!"); return; } menu.Title = txtName.Text.ToString().Trim(); menu.Sort = Convert.ToInt32(txtSort.Text.ToString().Trim()); if (BLL.Add(menu) >= 1) { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { Alert.ShowInTop("操作失败!"); } } }