public void AddMenus(HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; context.Response.Charset = "utf-8"; string s = "{\"status\":\"1\"}"; ShopMenuInfo shopMenuInfo = new ShopMenuInfo(); shopMenuInfo.Content = context.Request["Content"].Trim(); shopMenuInfo.Name = Globals.UrlDecode(context.Request["Name"].Trim()); if (context.Request["ParentMenuId"] != null) { shopMenuInfo.ParentMenuId = ((!(context.Request["ParentMenuId"] == "")) ? int.Parse(context.Request["ParentMenuId"]) : 0); } else { shopMenuInfo.ParentMenuId = 0; } shopMenuInfo.Type = context.Request["Type"]; shopMenuInfo.ClientType = context.Request["clientType"].ToInt(0); shopMenuInfo.ShopMenuPic = this.SaveMenuPic(context.Request["ShopMenuPic"]); if (ShopMenuHelper.CanAddMenu(shopMenuInfo.ParentMenuId, 0)) { if (ShopMenuHelper.SaveMenu(shopMenuInfo)) { s = "{\"status\":\"0\"}"; } } else { s = "{\"status\":\"2\"}"; } context.Response.Write(s); }
public void GetMenu(HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; context.Response.Charset = "utf-8"; string str = "{"; ShopMenuInfo shopMenuInfo = new ShopMenuInfo(); int menuId = 0; if (!int.TryParse(context.Request["MenuId"], out menuId)) { str = "\"status\":\"1\""; } else { shopMenuInfo = ShopMenuHelper.GetMenu(menuId); if (shopMenuInfo != null) { str += "\"status\":\"0\",\"data\":["; str = str + "{\"menuid\": \"" + shopMenuInfo.MenuId + "\","; str = str + "\"type\": \"" + shopMenuInfo.Type + "\","; str = str + "\"name\": \"" + shopMenuInfo.Name + "\","; str = str + "\"shopmenupic\": \"" + shopMenuInfo.ShopMenuPic + "\","; str = str + "\"content\": \"" + shopMenuInfo.Content + "\"}"; str += "]"; } str += "}"; context.Response.Write(str); } }
public void updatename(HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; context.Response.Charset = "utf-8"; string s = "{\"status\":\"1\"}"; int num = 0; if (!int.TryParse(context.Request["MenuId"], out num)) { s = "{\"status\":\"1\"}"; } else { if (num > 0) { ShopMenuInfo menu = ShopMenuHelper.GetMenu(num); menu.Name = context.Request["Name"]; menu.MenuId = num; if (ShopMenuHelper.UpdateMenu(menu)) { s = "{\"status\":\"0\"}"; } } context.Response.Write(s); } }
public void EditMenus(HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; context.Response.Charset = "utf-8"; string s = "{\"status\":\"1\"}"; ShopMenuInfo shopMenuInfo = new ShopMenuInfo(); shopMenuInfo.Content = context.Request["Content"]; shopMenuInfo.Name = context.Request["Name"]; shopMenuInfo.Type = context.Request["Type"]; if (!string.IsNullOrEmpty(context.Request["ParentMenuId"])) { shopMenuInfo.ParentMenuId = int.Parse(context.Request["ParentMenuId"]); } else { shopMenuInfo.ParentMenuId = 0; } int menuId = 0; if (!int.TryParse(context.Request["MenuId"], out menuId)) { s = "{\"status\":\"1\"}"; } else { shopMenuInfo.MenuId = menuId; shopMenuInfo.ShopMenuPic = this.SaveMenuPic(context.Request["ShopMenuPic"]); if (ShopMenuHelper.UpdateMenu(shopMenuInfo)) { s = "{\"status\":\"0\"}"; } context.Response.Write(s); } }
public IList <ShopMenuInfo> GetAllMenu(HttpContext context) { IList <ShopMenuInfo> list = new List <ShopMenuInfo>(); int num = 1; if (context.Request.Url.ToString().ToLower().Contains("vshop")) { num = 1; } if (context.Request.Url.ToString().ToLower().Contains("wapshop")) { num = 2; } if (context.Request.Url.ToString().ToLower().Contains("alioh")) { num = 4; } list = ShopMenuHelper.GetMenus(0); for (int i = 0; i < list.Count; i++) { if (!list[i].Content.StartsWith("/")) { list[i].Content = "/" + list[i].Content; } list[i].Content = list[i].Content.ToLower().Replace("/wapshop/", "").Replace("/vshop/", "") .Replace("/alioh/", ""); switch (num) { case 1: list[i].Content = "/Vshop/" + list[i].Content; break; case 2: list[i].Content = "/WapShop/" + list[i].Content; break; case 4: list[i].Content = "/AliOH/" + list[i].Content; break; } } return(list); }
public void delmenu(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{\"status\":\"1\"}"; int menuId = 0; if (!int.TryParse(context.Request["MenuId"], out menuId)) { s = "{\"status\":\"1\"}"; } else { if (ShopMenuHelper.DeleteMenu(menuId)) { s = "{\"status\":\"0\"}"; } context.Response.Write(s); } }
public void GetTopMenus(HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; string str = "{"; IList <ShopMenuInfo> topMenus = ShopMenuHelper.GetTopMenus(0); if (topMenus.Count <= 0) { str += "\"status\":\"-1\""; } else { str += "\"status\":\"0\",\"shopmenustyle\":\"\",\"enableshopmenu\":\"True\",\"data\":["; foreach (ShopMenuInfo item in topMenus) { IList <ShopMenuInfo> menusByParentId = ShopMenuHelper.GetMenusByParentId(item.MenuId, 0); str = str + "{\"menuid\": \"" + item.MenuId + "\","; str += "\"childdata\":["; if (menusByParentId.Count > 0) { foreach (ShopMenuInfo item2 in menusByParentId) { str = str + "{\"menuid\": \"" + item2.MenuId + "\","; str = str + "\"parentmenuid\": \"" + item2.ParentMenuId + "\","; str = str + "\"type\": \"" + item2.Type + "\","; str = str + "\"name\": \"" + item2.Name + "\","; str = str + "\"content\": \"" + item2.Content + "\"},"; } str = str.Substring(0, str.Length - 1); } str += "],"; str = str + "\"type\": \"" + item.Type + "\","; str = str + "\"name\": \"" + item.Name + "\","; str = str + "\"shopmenupic\": \"" + item.ShopMenuPic + "\","; str = str + "\"content\": \"" + item.Content + "\"},"; } str = str.Substring(0, str.Length - 1); str += "]"; str += "}"; context.Response.Write(str); } }
protected override void AttachChildControls() { string text = HttpContext.Current.Request.Url.ToString().ToLower(); HtmlAnchor htmlAnchor = this.FindControl("WeixinGuideAttention") as HtmlAnchor; htmlAnchor.Visible = false; if (text.Contains("/vshop/default") || text.Contains("/vshop/groupbuyproductdetails") || text.Contains("/vshop/countdownproductsdetails") || text.Contains("/vshop/productdetails")) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.WeixinGuideAttention && (HiContext.Current.UserId <= 0 || !HiContext.Current.User.IsSubscribe)) { htmlAnchor.Visible = false; htmlAnchor.HRef = string.Format("/vshop/AttentionYDGZ.aspx"); } } Literal literal = this.FindControl("ltlFooter") as Literal; object obj = HiCache.Get($"DataCache-FooterMenuCacheKey-{0}"); string empty = string.Empty; if (obj == null) { StringBuilder stringBuilder = new StringBuilder(); IList <ShopMenuInfo> topMenus = ShopMenuHelper.GetTopMenus(0); if (topMenus.Count != 0) { string str = 100 / topMenus.Count + "%"; foreach (ShopMenuInfo item in topMenus) { if (!item.Content.StartsWith("http://") && !item.Content.StartsWith("https://")) { if (!item.Content.StartsWith("/")) { item.Content = "/" + item.Content; } item.Content = item.Content.ToLower().Replace("/wapshop/", "").Replace("/vshop/", "") .Replace("/alioh/", ""); switch (base.ClientType) { case ClientType.VShop: item.Content = "/Vshop/" + item.Content; break; case ClientType.WAP: item.Content = "/WapShop/" + item.Content; break; case ClientType.AliOH: item.Content = "/AliOH/" + item.Content; break; } } stringBuilder.Append("<li style='width:" + str + "'>"); stringBuilder.Append("<div class=\"navcontent\" data=\"0\">"); if (item.Content.ToLower().Contains("/default") && base.site.OpenMultStore) { string store_PositionRouteTo = base.site.Store_PositionRouteTo; if (!(store_PositionRouteTo == "NearestStore")) { if (store_PositionRouteTo == "StoreList") { stringBuilder.Append("<a href=\"" + item.Content.Substring(0, item.Content.LastIndexOf("/")) + "/storeList?from\">"); } else { stringBuilder.Append("<a href=\"" + item.Content + "\">"); } } else { stringBuilder.Append("<a href=\"" + item.Content.Substring(0, item.Content.LastIndexOf("/")) + "/StoreHome\">"); } } else if (item.Content.ToLower().Contains("/productlist") && base.site.OpenMultStore) { int num = WebHelper.GetCookie(Common_WapFooter.UserCoordinateCookieName, "StoreId").ToInt(0); string store_PositionRouteTo = base.site.Store_PositionRouteTo; if (!(store_PositionRouteTo == "NearestStore")) { if (store_PositionRouteTo == "StoreList") { stringBuilder.Append("<a href=\"" + item.Content.Substring(0, item.Content.LastIndexOf("/")) + "/ProductSearch\">"); } else { stringBuilder.Append("<a href=\"" + item.Content + "\">"); } } else { stringBuilder.Append("<a href=\"" + item.Content.Substring(0, item.Content.LastIndexOf("/")) + "/ProductSearch?StoreId=" + num + "\">"); } } else { stringBuilder.Append("<a href=\"" + item.Content + "\">"); } if (!string.IsNullOrEmpty(item.ShopMenuPic)) { stringBuilder.Append("<img src=\"" + item.ShopMenuPic + "\" style=\"width:20px;height:20px;\"/>"); } stringBuilder.Append(item.Name); stringBuilder.Append("</a></div>"); stringBuilder.Append("</li>"); } empty = stringBuilder.ToString(); HiCache.Insert($"DataCache-FooterMenuCacheKey-{(int)base.ClientType}", stringBuilder.ToString(), 1800); goto IL_052e; } return; } empty = (obj as string); goto IL_052e; IL_052e: literal.Text = empty.ToString(); }