protected void btDel_Click(object sender, EventArgs e) { if (Request["sel"] != null) { string[] a = Request["sel"].Split(','); for (int i = 0; i < a.Length; i++) { NewsTypeService.DeleteNewsType(int.Parse(a[i])); } } Response.Redirect(Request.Url.ToString()); }
protected void Page_Load(object sender, EventArgs e) { //if (!LJH.Rank.IsModuleRank(1401)) // { // Response.Write("<div style='width:100%;margin-top:200px;text-align:center;color:red;'>您没有本模块的操作权限! 请与管理员联系!</div>"); // Response.End(); // } if (Request["edit"] != null) { sbEdit.Visible = true; Submit1.Visible = false; btBack.Visible = true; } else { sbEdit.Visible = false; Submit1.Visible = true; btBack.Visible = false; } if (Request["del"] != null) { NewsTypeService.DeleteNewsType(int.Parse(Request["del"])); Response.Redirect(Request["reUrl"].Replace("|", "&")); } if (!IsPostBack) { if (Request["edit"] != null) { hdUrl.Value = Request.UrlReferrer.ToString(); NewsType n = NewsTypeService.GetNewsTypeById(int.Parse(Request["edit"])); if (n != null) { tbTitle.Text = n.typename; rbIssimple.SelectedValue = n.issimple.ToString(); tbSord.Text = n.sort.ToString(); if (n.p_id == 0) { trIssimple.Visible = false; hlBack.Text = "顶级分类"; } else { trIssimple.Visible = true; hlBack.NavigateUrl = "news_type.aspx?id=" + n.p_id.ToString(); hlBack.Text = NewsTypeService.GetTypeName(n.p_id); } } } else if (Request["id"] != null) { trIssimple.Visible = true; NewsType n = NewsTypeService.GetNewsTypeById(int.Parse(Request["id"])); if (n != null) { hlBack.Text = n.typename; if (n.p_id != 0) { hlBack.NavigateUrl = "news_type.aspx?id=" + n.p_id.ToString(); } else { hlBack.NavigateUrl = "news_type.aspx"; } } } else { trIssimple.Visible = false; hlBack.Text = "顶级分类"; } if (Request["isdefault"] != null && Request["eid"] != null) { bool isdefault = Request["isdefault"] == "0" ? false : true; NewsTypeService.SetIsDefault(isdefault, int.Parse(Request["eid"])); Response.Redirect(Request.UrlReferrer.ToString()); } } Bind(); }
public static void DeleteNewsType(NewsType newsType) { NewsTypeService.DeleteNewsType(newsType); }