public static string GetMenus() { builder = new StringBuilder(); Menus mainmenus = Consult.GetMenus(0); foreach (Menu menu in mainmenus) { User user = Consult.GetUser(HtmlUser.GetLoggedMemberId()); if (Util.JudgeRights(menu.Rights, user.Admins) || menu.Sub > 0) { Menus submenus = Consult.GetMenus(menu.Id); if (submenus.Count > 0) { if (menu.Sub == 1 && user.GroupId == 1) { builder.Append(string.Format("<div class=\"sub\"><a href=\"javascript:void(0);\">{1}</a></div>\r\n", menu.Url, menu.MenuName)); } //else if (menu.Url == "http://www.andad.net/cjwt/") // builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"_blank\">{1}</a></div>\r\n", menu.Url, menu.MenuName)); else { builder.Append(string.Format("<div class=\"sub1\"><img src=\"../images/dir_2.gif\" onclick=\"hide(this)\" /><a href=\"{0}\" target=\"mainFrame\">{1}</a></div>\r\n", menu.Url, menu.MenuName)); } builder.Append(" <ul style=\"display:block;\">\r\n"); foreach (Menu submenu in submenus) { if (Util.JudgeRights(submenu.Rights, user.Admins)) { builder.Append(string.Format(" <li><a href=\"{0}\" target=\"mainFrame\" title=\"{1}\">{1}</a></li>\r\n", submenu.Url, submenu.MenuName)); } } builder.Append(" </ul>\r\n"); } else { if (menu.Url.ToLower().IndexOf("logout.aspx") != -1) { builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"_top\">{1}</a></div>\r\n", menu.Url, menu.MenuName)); } else { builder.Append(string.Format("<div class=\"sub\"><a href=\"{0}\" target=\"mainFrame\">{1}</a></div>\r\n", menu.Url, menu.MenuName)); } } } } return(builder.ToString()); }
public static void SaveStep1(int siteid) { string website = Common.Util.GetPageParams("txtwebname"); if (string.IsNullOrEmpty(website)) { MsgBox.Alert("WebSiteAdd", "<p>请输入网站名称</p>"); return; } string websiteurl = Common.Util.GetPageParams("txturl"); if (string.IsNullOrEmpty(websiteurl)) { MsgBox.Alert("WebSiteAdd", "<p>请输入网站地址</p>"); return; } websiteurl = websiteurl.ToLower().Replace("http://", "").Replace("/", ""); if (Consult.ExistsWebSite(websiteurl)) { MsgBox.Alert("WebSiteAdd", "<p>网站地址已经存在</p>"); return; } string websitenote = Common.Util.GetPageParams("sitenote"); string curscript = Common.Util.GetPageParams("curscript"); if (curscript.Length <= 0) { MsgBox.Alert("WebSiteAdd", "<p>客户即时通讯代码不能为空!</p>"); return; } if (curscript.Trim().Length > 2000) { MsgBox.Alert("WebSiteAdd", "<p>客户即时通讯代码,请限制在2000个字节内.</p>"); return; } Site site; if (siteid > 0) { site = Logic.Consult.GetWebSite(siteid); } else { site = new Site(); } site.SiteName = website; site.SiteUrl = websiteurl; site.SiteNote = websitenote; site.SiteDomain = Util.GetDomain("http://" + websiteurl); site.UserId = HtmlUser.GetLoggedMemberId(); site.CurScript = curscript; int id = Logic.Consult.SaveStep1(siteid, site); if (id > 0) { HttpContext.Current.Response.Redirect(string.Format("../website/sitestep2.aspx?id={0}", id), true); return; } else { MsgBox.Alert("Save1", "<p>数据保存失败!请检查之后重新保存。</p>"); return; } }
public static void WebSiteAdd() { string website = Common.Util.GetPageParams("txtwebname"); if (string.IsNullOrEmpty(website)) { MsgBox.Alert("WebSiteAdd", "<p>请输入网站名称</p>"); return; } string websiteurl = Common.Util.GetPageParams("txturl"); if (string.IsNullOrEmpty(websiteurl)) { MsgBox.Alert("WebSiteAdd", "<p>请输入网站地址</p>"); return; } websiteurl = websiteurl.ToLower().Replace("http://", "").Replace("/", ""); if (Consult.ExistsWebSite(websiteurl)) { MsgBox.Alert("WebSiteAdd", "<p>网站地址已经存在</p>"); return; } string rangelist = Common.Util.GetPageParams("txtrange"); if (string.IsNullOrEmpty(rangelist)) { MsgBox.Alert("WebSiteAdd", "<p>请选择网站地域</p>"); return; } if (rangelist.Length > 0) { rangelist = rangelist.Substring(0, rangelist.Length - 1); string[] str = rangelist.Split(new char[] { ',' }); rangelist = ""; for (int i = 0; i < str.Length; i++) { str[i] = "$" + str[i] + "$"; rangelist += str[i] + ","; } if (rangelist.Length > 0) { rangelist = rangelist.Substring(0, rangelist.Length - 1); } } int adtype = Common.Util.GetPageParamsAndToInt("adtypeselect"); if (adtype == 0 || adtype == -100) { MsgBox.Alert("WebSiteAdd", "<p>请选择网站地域</p>"); return; } string websitenote = Common.Util.GetPageParams("sitenote"); string curscript = Common.Util.GetPageParams("curscript"); if (curscript.Length <= 0) { MsgBox.Alert("WebSiteAdd", "<p>客户即时通讯代码不能为空!</p>"); return; } if (curscript.Trim().Length > 2000) { MsgBox.Alert("WebSiteAdd", "<p>客户即时通讯代码,请限制在2000个字节内.</p>"); return; } string guideccontent = Common.Util.GetPageParams("guideccontent"); if (guideccontent.Length > 2000) { MsgBox.Alert("WebSiteAdd", "<p>叙述文字长度,请限制在2000个字节内.</p>"); return; } int adid = GetAdvertId(adtype); if (adid == 0) { return; } Site site = new Site(); site.SiteName = website; site.SiteUrl = websiteurl; site.SiteNote = websitenote; site.RangeList = rangelist; site.AdDisplay = adtype; site.AdId = adid; site.SiteDomain = Util.GetDomain("http://" + websiteurl); site.UserId = HtmlUser.GetLoggedMemberId(); site.CurScript = curscript; Consult.WebSiteAdd(site); MsgBox.Alert("WebSiteAdd", "<p>网站添加成功!</p>", "../website/index.aspx"); }