protected void SubmitButton_Click(object sender, EventArgs e) { if (Page.IsValid) { if (!StringHelper.IsNumber(FatherId.Value)) { WebUtility.ShowAlertMessage("请填写父级ID!", null); } systemMenu.Title = MyTitle.Value; systemMenu.Url = LinkUrl.Value; systemMenu.AddPageUrl = AddPageUrl.Value; systemMenu.IsOpen = IsOpen.Checked; systemMenu.Enabled = Enabled.Checked; if (systemMenu.Pkid > 0) { //更改 bll_systemMenu.Update(systemMenu, FatherId.Value, Request.Form["sort"]); WebUtility.ShowAlertMessage("保存成功!", "sysMenuManage.aspx"); } else { //增加 systemMenu.FatherId = Convert.ToInt32(FatherId.Value); systemMenu.CreateTime = DateTime.Now.ToString(); bll_systemMenu.Insert(systemMenu); bll_systemMenu.Update(systemMenu, FatherId.Value, Request.Form["sort"]); WebUtility.ShowAlertMessage("新增成功!", Request.RawUrl); } } }
/// <summary> /// 执行操作的方法 /// </summary> private void Action() { string cmd = Request["cmd"]; if (String.IsNullOrEmpty(cmd)) { return; } string ids = Request.QueryString["ids"]; if (cmd == "moveup") { bll_systemMenu.MoveUp(ids); } else if (cmd == "movedown") { bll_systemMenu.MoveDown(ids); } else if (cmd == "onoff") { bll_systemMenu.UpdateStatus(ids, "onoff"); } else if (cmd == "enab") { bll_systemMenu.UpdateStatus(ids, "enab"); } else if (cmd == "del") { bll_systemMenu.Delete(ids); } else if (cmd == "updateall") { foreach (string key in Request.Form.AllKeys) { if (key.StartsWith("title")) { string title = Request.Form[key]; string url = Request.Form[key.Replace("title", "url")]; if (String.IsNullOrEmpty(title)) { continue; } if (key.IndexOf("#") > 0) { string fid = Request.Form[key.Replace("title", "fid")]; if (!StringHelper.IsNumber(fid)) { continue; } SystemMenuModel systemMenu = new SystemMenuModel(); systemMenu.Title = title; systemMenu.Url = url; systemMenu.FatherId = Convert.ToInt32(fid); bll_systemMenu.Insert(systemMenu); } else { string id = key.Replace("title", ""); SystemMenuModel systemMenu = bll_systemMenu.GetModel(id); if (systemMenu == null) { continue; } systemMenu.Title = title; systemMenu.Url = url; bll_systemMenu.Update(systemMenu); } } } WebUtility.ShowAlertMessage("全部保存成功!", Request.RawUrl); } Response.Redirect(Request.Url.AbsolutePath); }