public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest) { WeiXinHelper.UpdateRencentOpenID(clickEventRequest.FromUserName); Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(Convert.ToInt32(clickEventRequest.EventKey)); if (menu == null) { return(null); } Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId); if (reply == null) { return(null); } AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest); if (keyResponse != null) { return(keyResponse); } AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName); if (response == null) { this.GotoManyCustomerService(clickEventRequest); } response.ToUserName = clickEventRequest.FromUserName; response.FromUserName = clickEventRequest.ToUserName; return(response); }
public bool UpdateMenu(MenuInfo menu) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE vshop_Menu SET ParentMenuId = @ParentMenuId, Name = @Name, Type = @Type, ReplyId = @ReplyId, DisplaySequence = @DisplaySequence, Bind = @Bind, [Content] = @Content WHERE MenuId = @MenuId"); this.database.AddInParameter(sqlStringCommand, "ParentMenuId", DbType.Int32, menu.ParentMenuId); this.database.AddInParameter(sqlStringCommand, "Name", DbType.String, menu.Name); this.database.AddInParameter(sqlStringCommand, "Type", DbType.String, menu.Type); this.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, menu.ReplyId); this.database.AddInParameter(sqlStringCommand, "DisplaySequence", DbType.Int32, menu.DisplaySequence); this.database.AddInParameter(sqlStringCommand, "MenuId", DbType.Int32, menu.MenuId); this.database.AddInParameter(sqlStringCommand, "Bind", DbType.Int32, (int) menu.BindType); this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, menu.Content); return (this.database.ExecuteNonQuery(sqlStringCommand) == 1); }
public bool SaveMenu(MenuInfo menu) { int allMenusCount = this.GetAllMenusCount(); DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO vshop_Menu (ParentMenuId, Name, Type, ReplyId, DisplaySequence, Bind, [Content]) VALUES(@ParentMenuId, @Name, @Type, @ReplyId, @DisplaySequence, @Bind, @Content)"); this.database.AddInParameter(sqlStringCommand, "ParentMenuId", DbType.Int32, menu.ParentMenuId); this.database.AddInParameter(sqlStringCommand, "Name", DbType.String, menu.Name); this.database.AddInParameter(sqlStringCommand, "Type", DbType.String, menu.Type); this.database.AddInParameter(sqlStringCommand, "ReplyId", DbType.Int32, menu.ReplyId); this.database.AddInParameter(sqlStringCommand, "DisplaySequence", DbType.Int32, allMenusCount); this.database.AddInParameter(sqlStringCommand, "Bind", DbType.Int32, (int) menu.BindType); this.database.AddInParameter(sqlStringCommand, "Content", DbType.String, menu.Content); return (this.database.ExecuteNonQuery(sqlStringCommand) == 1); }
private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam) { Articles articles = new Articles { toUserId = FromUserId, msgType = "text", text = new MessageText { content = "系统未找到相关信息!" } }; if (eventType != "") { if ("follow".Equals(eventType)) { if (!string.IsNullOrEmpty(FromUserId)) { MemberProcessor.AddFuwuFollowUser(FromUserId); } string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle; Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply(); if (subscribeReply != null) { if (subscribeReply.MessageType == MessageType.Text) { TextReplyInfo textReplyInfo = subscribeReply as TextReplyInfo; articles.text.content = textReplyInfo.Text; } else if (subscribeReply.ArticleID > 0) { ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID); if (articleInfo != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId); } else { articles.text.content = aliOHFollowRelayTitle; } } } else { articles.text.content = aliOHFollowRelayTitle; } } else if ("unfollow".Equals(eventType)) { if (!string.IsNullOrEmpty(FromUserId)) { MemberProcessor.DelFuwuFollowUser(FromUserId); } } else if ("click".Equals(eventType)) { int num = 0; if (ActionParam != "" && int.TryParse(ActionParam, out num) && num > 0) { Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(num); if (fuwuMenu != null) { Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId); if (reply != null) { ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(reply.ArticleID); if (articleInfo2 != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo2, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId); } } } } } else if ("enter".Equals(eventType)) { if (!string.IsNullOrEmpty(this.UserInfo)) { MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu"); if (openIdMember != null && openIdMember.AlipayLoginId.StartsWith("FW*")) { JObject jObject = JsonConvert.DeserializeObject(this.UserInfo) as JObject; string alipayLoginId = ""; string text = ""; if (jObject["logon_id"] != null) { alipayLoginId = jObject["logon_id"].ToString(); } if (jObject["user_name"] != null) { text = jObject["user_name"].ToString(); } if (text != "" && text != "") { openIdMember.AlipayLoginId = alipayLoginId; openIdMember.AlipayUsername = text; MemberProcessor.SetAlipayInfos(openIdMember); } } } if (!ActionParam.Contains("sceneId")) { return; } JObject jObject2 = JsonConvert.DeserializeObject(ActionParam) as JObject; if (jObject2["scene"]["sceneId"] != null) { string text2 = jObject2["scene"]["sceneId"].ToString(); if (text2.StartsWith("bind")) { if (AlipayFuwuConfig.BindAdmin.Count > 10) { AlipayFuwuConfig.BindAdmin.Clear(); } if (AlipayFuwuConfig.BindAdmin.ContainsKey(text2)) { AlipayFuwuConfig.BindAdmin[text2] = FromUserId; } else { AlipayFuwuConfig.BindAdmin.Add(text2, FromUserId); } articles.text.content = "您正在尝试绑定服务窗管理员身份!"; } } } } else if (textContent != "") { articles = null; System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys); if (replies != null && replies.Count > 0) { foreach (Hidistro.Entities.VShop.ReplyInfo current in replies) { if (current != null) { if (current.MatchType == MatchType.Equal && current.Keys == textContent) { if (current.MessageType == MessageType.Text) { articles = new Articles { toUserId = FromUserId, msgType = "text", text = new MessageText { content = "" } }; TextReplyInfo textReplyInfo2 = current as TextReplyInfo; articles.text.content = textReplyInfo2.Text; break; } if (current.ArticleID > 0) { ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(current.ArticleID); if (articleInfo3 != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo3, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } if (current.MatchType == MatchType.Like && current.Keys.Contains(textContent)) { if (current.MessageType == MessageType.Text) { articles = new Articles { toUserId = FromUserId, msgType = "text", text = new MessageText { content = "" } }; TextReplyInfo textReplyInfo3 = current as TextReplyInfo; articles.text.content = textReplyInfo3.Text; break; } if (current.ArticleID > 0) { ArticleInfo articleInfo4 = ArticleHelper.GetArticleInfo(current.ArticleID); if (articleInfo4 != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo4, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } } } } } if (articles == null) { System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch); if (replies2 != null && replies2.Count > 0) { using (System.Collections.Generic.IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator2 = replies2.GetEnumerator()) { while (enumerator2.MoveNext()) { Hidistro.Entities.VShop.ReplyInfo current2 = enumerator2.Current; if (current2.MessageType == MessageType.Text) { articles = new Articles { toUserId = FromUserId, msgType = "text", text = new MessageText { content = "" } }; TextReplyInfo textReplyInfo4 = current2 as TextReplyInfo; articles.text.content = textReplyInfo4.Text; break; } if (current2.ArticleID > 0) { ArticleInfo articleInfo5 = ArticleHelper.GetArticleInfo(current2.ArticleID); if (articleInfo5 != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo5, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } goto IL_674; } } articles = new Articles { toUserId = FromUserId, msgType = "text", text = new MessageText { content = "系统未找到相关信息!" } }; } IL_674: AliOHHelper.log(AliOHHelper.CustomSend(articles).Body); }
private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam) { Articles articles6 = new Articles { toUserId = FromUserId, msgType = "text" }; MessageText text5 = new MessageText { content = "系统未找到相关信息!" }; articles6.text = text5; Articles articles = articles6; if (eventType != "") { if ("follow".Equals(eventType)) { if (!string.IsNullOrEmpty(FromUserId)) { MemberProcessor.AddFuwuFollowUser(FromUserId); } string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle; Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply(); if (subscribeReply != null) { if (subscribeReply.MessageType == Hidistro.Entities.VShop.MessageType.Text) { TextReplyInfo info2 = subscribeReply as TextReplyInfo; articles.text.content = info2.Text; } else if (subscribeReply.ArticleID > 0) { ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID); if (articleInfo != null) { articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId); } else { articles.text.content = aliOHFollowRelayTitle; } } } else { articles.text.content = aliOHFollowRelayTitle; } } else if ("unfollow".Equals(eventType)) { if (!string.IsNullOrEmpty(FromUserId)) { MemberProcessor.DelFuwuFollowUser(FromUserId); } } else if ("click".Equals(eventType)) { int result = 0; if (((ActionParam != "") && int.TryParse(ActionParam, out result)) && (result > 0)) { Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(result); if (fuwuMenu != null) { Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId); if (reply != null) { ArticleInfo info6 = ArticleHelper.GetArticleInfo(reply.ArticleID); if (info6 != null) { articles = this.GetAlipayArticlesFromArticleInfo(info6, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId); } } } } } else if ("enter".Equals(eventType)) { if (!string.IsNullOrEmpty(this.UserInfo)) { MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu"); if ((openIdMember != null) && openIdMember.AlipayLoginId.StartsWith("FW*")) { JObject obj2 = JsonConvert.DeserializeObject(this.UserInfo) as JObject; string str2 = ""; string str3 = ""; if (obj2["logon_id"] != null) { str2 = obj2["logon_id"].ToString(); } if (obj2["user_name"] != null) { str3 = obj2["user_name"].ToString(); } if ((str3 != "") && (str3 != "")) { openIdMember.AlipayLoginId = str2; openIdMember.AlipayUsername = str3; MemberProcessor.SetAlipayInfos(openIdMember); } } } if (!ActionParam.Contains("sceneId")) { return; } JObject obj3 = JsonConvert.DeserializeObject(ActionParam) as JObject; if (obj3["scene"]["sceneId"] != null) { string key = obj3["scene"]["sceneId"].ToString(); if (key.StartsWith("bind")) { if (AlipayFuwuConfig.BindAdmin.Count > 10) { AlipayFuwuConfig.BindAdmin.Clear(); } if (AlipayFuwuConfig.BindAdmin.ContainsKey(key)) { AlipayFuwuConfig.BindAdmin[key] = FromUserId; } else { AlipayFuwuConfig.BindAdmin.Add(key, FromUserId); } articles.text.content = "您正在尝试绑定服务窗管理员身份!"; } } } } else if (textContent != "") { articles = null; IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys); if ((replies != null) && (replies.Count > 0)) { foreach (Hidistro.Entities.VShop.ReplyInfo info8 in replies) { if (info8 != null) { if ((info8.MatchType == MatchType.Equal) && (info8.Keys == textContent)) { if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text) { Articles articles2 = new Articles { toUserId = FromUserId, msgType = "text" }; MessageText text = new MessageText { content = "" }; articles2.text = text; articles = articles2; TextReplyInfo info9 = info8 as TextReplyInfo; articles.text.content = info9.Text; break; } if (info8.ArticleID > 0) { ArticleInfo info10 = ArticleHelper.GetArticleInfo(info8.ArticleID); if (info10 != null) { articles = this.GetAlipayArticlesFromArticleInfo(info10, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } if ((info8.MatchType == MatchType.Like) && info8.Keys.Contains(textContent)) { if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text) { Articles articles3 = new Articles { toUserId = FromUserId, msgType = "text" }; MessageText text2 = new MessageText { content = "" }; articles3.text = text2; articles = articles3; TextReplyInfo info11 = info8 as TextReplyInfo; articles.text.content = info11.Text; break; } if (info8.ArticleID > 0) { ArticleInfo info12 = ArticleHelper.GetArticleInfo(info8.ArticleID); if (info12 != null) { articles = this.GetAlipayArticlesFromArticleInfo(info12, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } } } } } if (articles == null) { IList <Hidistro.Entities.VShop.ReplyInfo> list2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch); if ((list2 != null) && (list2.Count > 0)) { foreach (Hidistro.Entities.VShop.ReplyInfo info13 in list2) { if (info13.MessageType == Hidistro.Entities.VShop.MessageType.Text) { Articles articles4 = new Articles { toUserId = FromUserId, msgType = "text" }; MessageText text3 = new MessageText { content = "" }; articles4.text = text3; articles = articles4; TextReplyInfo info14 = info13 as TextReplyInfo; articles.text.content = info14.Text; break; } if (info13.ArticleID > 0) { ArticleInfo info15 = ArticleHelper.GetArticleInfo(info13.ArticleID); if (info15 != null) { articles = this.GetAlipayArticlesFromArticleInfo(info15, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId); if (articles != null) { break; } } } } } else { Articles articles5 = new Articles { toUserId = FromUserId, msgType = "text" }; MessageText text4 = new MessageText { content = "系统未找到相关信息!" }; articles5.text = text4; articles = articles5; } } AliOHHelper.log(AliOHHelper.CustomSend(articles).Body); }
public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest) { string userOpenId = clickEventRequest.FromUserName; WeiXinHelper.UpdateRencentOpenID(userOpenId); AbstractResponse result; try { int menuId = System.Convert.ToInt32(clickEventRequest.EventKey); Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(menuId); if (menu == null) { result = null; } else { if (menu.BindType == BindType.StoreCard) { try { SiteSettings siteSettings = SettingsManager.GetMasterSettings(false); string access_token = TokenApi.GetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret); access_token = JsonConvert.DeserializeObject <Token>(access_token).access_token; MemberInfo member = MemberProcessor.GetOpenIdMember(userOpenId, "wx"); if (member == null) { this.CreatMember(userOpenId, 0, access_token); member = MemberProcessor.GetOpenIdMember(userOpenId, "wx"); } string userHead = member.UserHead; string storeLogo = siteSettings.DistributorLogoPic; string webStart = Globals.GetWebUrlStart(); string imageUrl = "/Storage/master/DistributorCards/MemberCard" + member.UserId + ".jpg"; string mediaid = string.Empty; int ReferralId = 0; string storeName = siteSettings.SiteName; string NotSuccessMsg = string.Empty; DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(member.UserId); if (distributorInfo != null) { ReferralId = member.UserId; if (siteSettings.IsShowDistributorSelfStoreName) { storeName = distributorInfo.StoreName; storeLogo = distributorInfo.Logo; } imageUrl = "/Storage/master/DistributorCards/StoreCard" + ReferralId + ".jpg"; } else if (!siteSettings.IsShowSiteStoreCard) { string content = "您还不是分销商,不能为您生成推广图片,立即<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>"; if (!string.IsNullOrEmpty(siteSettings.ToRegistDistributorTips)) { content = System.Text.RegularExpressions.Regex.Replace(siteSettings.ToRegistDistributorTips, "{{申请分销商}}", "<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>"); } result = new TextResponse { CreateTime = System.DateTime.Now, ToUserName = userOpenId, FromUserName = clickEventRequest.ToUserName, Content = content }; return(result); } string postData = string.Empty; string creatingStoreCardTips = siteSettings.CreatingStoreCardTips; if (!string.IsNullOrEmpty(creatingStoreCardTips)) { postData = string.Concat(new string[] { "{\"touser\":\"", userOpenId, "\",\"msgtype\":\"text\",\"text\":{\"content\":\"", Globals.String2Json(creatingStoreCardTips), "\"}}" }); NewsApi.KFSend(access_token, postData); } string filePath = System.Web.HttpContext.Current.Request.MapPath(imageUrl); Task.Factory.StartNew(delegate { try { System.IO.File.Exists(filePath); string setJson = System.IO.File.ReadAllText(System.Web.HttpRuntime.AppDomainAppPath + "/Storage/Utility/StoreCardSet.js"); string codeUrl = webStart + "/Follow.aspx?ReferralId=" + ReferralId.ToString(); ScanInfos scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX"); if (scanInfosByUserId == null) { ScanHelp.CreatNewScan(ReferralId, "WX", 0); scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX"); } if (scanInfosByUserId != null && !string.IsNullOrEmpty(scanInfosByUserId.CodeUrl)) { codeUrl = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl); } else { string token_Message = TokenApi.GetToken_Message(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret); if (TokenApi.CheckIsRightToken(token_Message)) { string text = BarCodeApi.CreateTicket(token_Message, scanInfosByUserId.Sceneid, "QR_LIMIT_SCENE", "2592000"); if (!string.IsNullOrEmpty(text)) { codeUrl = BarCodeApi.GetQRImageUrlByTicket(text); scanInfosByUserId.CodeUrl = text; scanInfosByUserId.CreateTime = System.DateTime.Now; scanInfosByUserId.LastActiveTime = System.DateTime.Now; ScanHelp.updateScanInfosCodeUrl(scanInfosByUserId); } } } StoreCardCreater storeCardCreater = new StoreCardCreater(setJson, userHead, storeLogo, codeUrl, member.UserName, storeName, ReferralId, member.UserId); if (storeCardCreater.ReadJson() && storeCardCreater.CreadCard(out NotSuccessMsg)) { if (ReferralId > 0) { DistributorsBrower.UpdateStoreCard(ReferralId, NotSuccessMsg); } string media_IDByPath = NewsApi.GetMedia_IDByPath(access_token, webStart + imageUrl); mediaid = NewsApi.GetJsonValue(media_IDByPath, "media_id"); } else { Globals.Debuglog(NotSuccessMsg, "_DebugCreateStoreCardlog.txt"); } postData = string.Concat(new string[] { "{\"touser\":\"", userOpenId, "\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"", mediaid, "\"}}" }); NewsApi.KFSend(access_token, postData); } catch (System.Exception ex3) { postData = string.Concat(new string[] { "{\"touser\":\"", userOpenId, "\",\"msgtype\":\"text\",\"text\":{\"content\":\"生成图片失败,", Globals.String2Json(ex3.ToString()), "\"}}" }); NewsApi.KFSend(access_token, postData); } }); result = null; return(result); } catch (System.Exception ex) { result = new TextResponse { CreateTime = System.DateTime.Now, ToUserName = userOpenId, FromUserName = clickEventRequest.ToUserName, Content = "问题:" + ex.ToString() }; return(result); } } Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId); if (reply == null) { result = null; } else { if (reply.MessageType != MessageType.Image) { AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest); if (keyResponse != null) { result = keyResponse; return(result); } } AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName); if (response == null) { this.GotoManyCustomerService(clickEventRequest); } response.ToUserName = clickEventRequest.FromUserName; response.FromUserName = clickEventRequest.ToUserName; result = response; } } } catch (System.Exception ex2) { result = new TextResponse { CreateTime = System.DateTime.Now, ToUserName = clickEventRequest.FromUserName, FromUserName = clickEventRequest.ToUserName, Content = "问题:" + ex2.ToString() }; } return(result); }
private void btnAddMenu_Click(object sender, EventArgs e) { MenuInfo menu = new MenuInfo { Name = this.txtCategoryName.Text, ParentMenuId = base.GetUrlIntParam("pid") }; if (!VShopHelper.CanAddMenu(menu.ParentMenuId)) { this.ShowMsg("一级菜单不能超过三个,对应二级菜单不能超过五个", false); } else { menu.Bind = Convert.ToInt32(this.ddlType.SelectedValue); BindType bindType = menu.BindType; switch (bindType) { case BindType.Key: menu.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue); break; case BindType.Topic: menu.Content = this.ddlValue.SelectedValue; break; default: if (bindType == BindType.Url) { menu.Content = this.txtUrl.Text.Trim(); } break; } menu.Type = "click"; if (menu.ParentMenuId == 0) { menu.Type = "view"; } else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || (this.ddlType.SelectedValue == "0")) { this.ShowMsg("二级菜单必须绑定一个对象", false); return; } if (VShopHelper.SaveMenu(menu)) { base.Response.Redirect("ManageMenu.aspx"); } else { this.ShowMsg("添加失败", false); } } }
private SingleButton BuildMenu(MenuInfo menu) { switch (menu.BindType) { case BindType.Key: return new SingleClickButton { name = menu.Name, key = menu.MenuId.ToString() }; case BindType.Topic: case BindType.HomePage: case BindType.ProductCategory: case BindType.ShoppingCar: case BindType.OrderCenter: case BindType.MemberCard: case BindType.Url: return new SingleViewButton { name = menu.Name, url = menu.Url }; } return new SingleClickButton { name = menu.Name, key = "None" }; }
public static bool UpdateMenu(MenuInfo menu) { return new MenuDao().UpdateMenu(menu); }
public static bool SaveMenu(MenuInfo menu) { return new MenuDao().SaveMenu(menu); }