/// <summary> /// 添加图文事件 /// </summary> protected void AddNews() { string EventId = Request.Form["EventId"]; if (!string.IsNullOrEmpty(EventId)) { menuMol = menuBll.GetModel(Convert.ToInt32(EventId)); menuMol.flat1 = 2; //代表发送图文 menuBll.Update(menuMol); //更新数据 newsMol.EventId = Convert.ToInt32(EventId); newsMol.newsTitle = CommonMethod.CheckParamThrow(Request.Form["newsTitle"]); newsMol.newsDescription = CommonMethod.CheckParamThrow(Request.Form["newsDescription"]); newsMol.newsPicUrl = CommonMethod.CheckParamThrow(Request.Form["newsPicUrl"]); newsMol.newsUrl = CommonMethod.CheckParamThrow(Request.Form["newsUrl"]); newsMol.EventCate = "menu";//事件类型菜单 if (newsBll.Add(newsMol) != 0) { CommonMethod.Alert("添加图文事件成功!", "wei_MenusConfig.aspx?menuFid=" + Request.Form["fid"]); } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } }
/// <summary> /// 添加文本事件 /// </summary> protected void AddText() { string EventId = Request.Form["EventId"]; if (!string.IsNullOrEmpty(EventId)) { menuMol = menuBll.GetModel(Convert.ToInt32(EventId)); menuMol.flat1 = 1; //代表发送文本 menuBll.Update(menuMol); //更新数据 textMol.EventId = Convert.ToInt32(EventId); textMol.msgContent = CommonMethod.CheckParamThrow(Request.Form["msgContent"]); textMol.EventCate = "menu";//事件类型 菜单 if (textBll.Add(textMol) != 0) { CommonMethod.Alert("添加文本事件成功!", "wei_MenusConfig.aspx?menuFid=" + Request.Form["fid"]); } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } }
public string fatherMenu = ""; //父菜单 protected void Page_Load(object sender, EventArgs e) { (Master.FindControl("childmenu") as Label).Text = "微菜单编辑"; if (!Page.IsPostBack) { string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { menuMol = menuBll.GetModel(Convert.ToInt32(id)); if (menuMol.WX_MenuType == "0") { MenuType = "主菜单"; } else { int type = Convert.ToInt32(menuMol.WX_MenuType); MenuType = ((ButtonType)(type - 1)).ToString(); } int Fid = Convert.ToInt32(menuMol.WX_Fid); if (Fid != 0) { BrnShop.Core.Model.YX_weiXinMenus menuMol2 = new BrnShop.Core.Model.YX_weiXinMenus(); menuMol2 = menuBll.GetModel(Fid); fatherMenu = menuMol2.WX_menuName; } } } //编辑微菜单 if (Request.Form["action"] == "action") { WeiMenusEdits(); } }
/// <summary> /// 检测菜单是否可以加事件 /// </summary> /// <param name="Id">菜单Id</param> protected void checkMenu(string Id) { if (!string.IsNullOrEmpty(Id)) { mol = bll.GetModel(Convert.ToInt32(Id)); if (mol.WX_Fid == 0)//如果是一级菜单 则不可以 { Response.Write("NOO"); } else { if (mol.WX_MenuType != "1")//菜单事件不是click { Response.Write("NO"); } else { Response.Write("OK"); } } } else { Response.Write("error"); } Response.End(); }
/// <summary> ///检测是否拥有事件,已拥有,则可编辑事件! /// </summary> /// <param name="id">菜单Id</param> protected void cekevent2(string id) { mol = bll.GetModel(Convert.ToInt32(id)); int flat = Convert.ToInt32(mol.flat1); if (flat != 0)//已添加事件 { Response.Write("OK"); } else { Response.Write("NO"); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { (Master.FindControl("childmenu") as Label).Text = "微事件编辑"; string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { mol = bll.GetModel(Convert.ToInt32(id)); eventType = mol.flat1.ToString(); switch (eventType) { case "1": dt_text = textBll.GetList(" EventId=" + id + " and EventCate='menu'").Tables[0]; break; //文本 case "2": dt_News = newsBll.GetList(" EventId=" + id + " and EventCate='menu'").Tables[0]; break; //图文 } if (dt_text.Rows.Count != 0) { textMol = textBll.GetModel(Convert.ToInt32(dt_text.Rows[0]["Id"])); } if (dt_News.Rows.Count != 0) { newsMol = newsBll.GetModel(Convert.ToInt32(dt_News.Rows[0]["Id"])); } } } if (Request.Form["action"] == "text") { AddText(); } if (Request.Form["action"] == "news") { AddNews(); } }
/// <summary> /// 编辑微菜单 /// </summary> protected void WeiMenusEdits() { string id = Request.Form["menuId"]; if (!string.IsNullOrEmpty(id)) { menuMol = menuBll.GetModel(Convert.ToInt32(id)); menuMol.WX_menuName = Request.Form["WX_menuName"]; menuMol.WX_MenusKey_URL = Request.Form["WX_MenusKey_URL"]; menuMol.flat2 = Convert.ToInt32(Request.Form["flat2"]); if (menuBll.Update(menuMol)) { CommonMethod.Alert("编辑微菜单成功!", "wei_MenusList.aspx?menuFid=" + Request.Form["fid"]); } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } } else { CommonMethod.Alert("系统正忙,请稍后重试!"); } }