public void LoadTheme() { string themecode = ""; string language = ""; int siteid = 0; var nv = CookieTool.GetCookie("ThemeStatus"); if (!string.IsNullOrEmpty(nv.Get("language"))) { language = nv.Get("language"); } if (!string.IsNullOrEmpty(nv.Get("theme"))) { themecode = nv.Get("theme"); } if (!string.IsNullOrEmpty(nv.Get("site"))) { int.TryParse(nv.Get("site"), out siteid); } if (siteid == 0) { siteid = ShopCache.GetMainSite().id; } LoadTheme(themecode, siteid, language, "", false); }
public Site() { BaseConfig bcf = ShopCache.GetBaseConfig(); if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese")) { _SiteName = "LebiShop多语言网店系统"; _title = "LebiShop多语言网店系统"; } else { Lebi_Site s = ShopCache.GetMainSite(); _SiteName = Language.Content(s.Name, "CN"); _title = Language.Content(s.Title, "CN"); } _WebPath = RequestTool.GetConfigKey("WebPath"); _SupplierPath = RequestTool.GetConfigKey("SupplierPath"); _WebPath = _WebPath.TrimEnd('/'); _adminpath = _WebPath + RequestTool.GetConfigKey("AdminPath"); _adminjspath = _WebPath + "/theme/system/systempage/admin/js"; _admincsspath = _WebPath + "/theme/system/systempage/admin/css"; _adminimagepath = _WebPath + "/theme/system/systempage/admin/images"; if (!Shop.LebiAPI.Service.Instanse.Check("lebilicense")) { _SiteName = "LebiShop多语言网店系统"; //Language.Content(bcf.Name, Language.CurrentLanguage().Code); _title = _SiteName; } if (Shop.LebiAPI.Service.Instanse.Check("domain3")) { _SiteCount = B_Lebi_Site.Counts(""); _SiteCount = _SiteCount > 30 ? 30 : 30; //_SiteCount; // _SiteCount; } else if (Shop.LebiAPI.Service.Instanse.Check("domain20")) { _SiteCount = B_Lebi_Site.Counts(""); _SiteCount = _SiteCount > 20 ? 20 : 20; //_SiteCount; // _SiteCount; } else if (Shop.LebiAPI.Service.Instanse.Check("domain10")) { _SiteCount = B_Lebi_Site.Counts(""); _SiteCount = _SiteCount > 10 ? 10 : 10; //_SiteCount; // _SiteCount; } //else if (Shop.LebiAPI.Service.Instanse.Check("domain2")) //{ // _SiteCount = B_Lebi_Site.Counts(""); // _SiteCount = _SiteCount > 2 ? 2 : _SiteCount; // _SiteCount; //} else { _SiteCount = 2; } if (_SiteCount == 0) { _SiteCount = 2; } }
/// <summary> /// 站点名称 /// </summary> /// <param name="siteid"></param> /// <returns></returns> public string SiteName(int siteid) { Lebi_Site model = B_Lebi_Site.GetModel(siteid); if (model == null) { model = ShopCache.GetMainSite(); } return(model.SubName); }
/// <summary> /// 返回默认语言 /// </summary> /// <returns></returns> public static Lebi_Language_Code DefaultLanguage() { Lebi_Site site = ShopCache.GetMainSite(); Lebi_Language_Code lang = B_Lebi_Language_Code.GetList("Code in (select Code from [Lebi_Language] where Site_id=" + site.id + ")", "Code asc").FirstOrDefault(); if (lang == null) { lang = new Lebi_Language_Code(); } return(lang); }
private int _SiteCount = 0;//用户的站点数量 public Site_Supplier() { BaseConfig bcf = ShopCache.GetBaseConfig(); if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese")) { _SiteName = "LebiShop网上商店系统"; _title = "LebiShop网上商店系统"; } else { Lebi_Site s = ShopCache.GetMainSite(); _SiteName = Language.Content(s.Name, "CN"); _title = Language.Content(s.Title, "CN"); } _WebPath = RequestTool.GetConfigKey("WebPath"); _WebPath = _WebPath.TrimEnd('/'); _adminpath = RequestTool.GetConfigKey("SupplierPath"); _adminjspath = _WebPath + "/theme/system/systempage/supplier/js"; _admincsspath = _WebPath + "/theme/system/systempage/supplier/css"; _adminimagepath = _WebPath + "/theme/system/systempage/supplier/images"; _adminassetspath = _WebPath + "/system/systempage/supplier/assets"; _ThemeDomain = RequestTool.GetConfigKey("ThemeDomain"); _ThemeDomain = _ThemeDomain.TrimEnd('/'); if (!string.IsNullOrEmpty(_ThemeDomain)) { _adminjspath = _ThemeDomain + "/system/systempage/supplier/js"; _admincsspath = _ThemeDomain + "/system/systempage/supplier/css"; _adminimagepath = _ThemeDomain + "/system/systempage/supplier/images"; _adminassetspath = _ThemeDomain + "/system/systempage/supplier/assets"; } if (!Shop.LebiAPI.Service.Instanse.Check("lebilicense")) { _SiteName = Language.Content(bcf.Name, Language.CurrentLanguage().Code); _title = _SiteName; } if (!Shop.LebiAPI.Service.Instanse.Check("domain3")) { _SiteCount = 1; } else { _SiteCount = B_Lebi_Site.Counts(""); _SiteCount = _SiteCount > 3 ? 3 : _SiteCount; } }
/// <summary> /// 站点名称 /// </summary> /// <param name="siteid"></param> /// <returns></returns> public string SiteName(int siteid, int DT_id, string LanuageCode) { if (DT_id == 0) { Lebi_Site model = B_Lebi_Site.GetModel(siteid); if (model == null) { model = ShopCache.GetMainSite(); } return(model.SubName); } else { Lebi_DT model = B_Lebi_DT.GetModel(DT_id); if (model == null) { model = new Lebi_DT(); } return(Shop.Bussiness.Language.Content(model.Site_Name, LanuageCode)); } }
protected override void OnLoad(EventArgs e) { //页面载入检查 PageLoadCheck(); site = new Site_Agent(); string themecode = ""; int siteid = 0; string languagecode = ""; var nv = CookieTool.GetCookie("ThemeStatus"); if (!string.IsNullOrEmpty(nv.Get("theme"))) { themecode = nv.Get("theme"); } if (!string.IsNullOrEmpty(nv.Get("language"))) { languagecode = nv.Get("language"); } if (!string.IsNullOrEmpty(nv.Get("theme"))) { int.TryParse(nv.Get("site"), out siteid); } if (siteid == 0) { siteid = ShopCache.GetMainSite().id; } LoadTheme(themecode, siteid, languagecode, "", true); DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } CurrentCurrency = DefaultCurrency; base.OnLoad(e); }
protected override void OnLoad(EventArgs e) { if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang")) { Response.Redirect(WebPath + "/"); Response.End(); return; } PageLoadCheck(); //页面载入检查 #region 当前用户信息 int selectsupplierid = RequestTool.RequestInt("selectsupplierid"); if (selectsupplierid > 0) { //切换超级账号 string msg = ""; EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg); CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011"); } if (CurrentSupplierUser == null) { CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser); } if (CurrentSupplierUser.id == 0) { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id); if (CurrentSupplier.Type_id_SupplierStatus != 442) { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id); if (CurrentSupplierUserGroup == null) { CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup(); } if (CurrentSupplier != null) { CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id); if (CurrentSupplierGroup == null) { CurrentSupplierGroup = new Lebi_Supplier_Group(); } } else { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } DateTime LastDate = CurrentSupplier.Time_This; TimeSpan ts = System.DateTime.Now - LastDate; int NewEventTimes = 0; int.TryParse(SYS.NewEventTimes, out NewEventTimes); LeftNewEventTimes = Convert.ToInt32(ts.TotalSeconds % (NewEventTimes / 1000)); LeftNewEventTimes = NewEventTimes - (LeftNewEventTimes * 1000); #endregion #region 配合前台主题 string themecode = ""; int siteid = 0; var nv = CookieTool.GetCookie("ThemeStatus"); if (!string.IsNullOrEmpty(nv.Get("theme"))) { themecode = nv.Get("theme"); } if (!string.IsNullOrEmpty(nv.Get("site"))) { int.TryParse(nv.Get("site"), out siteid); } if (siteid == 0) { siteid = ShopCache.GetMainSite().id; } LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true); #endregion #region 处理菜单 MenuType = Shop.Tools.CookieTool.GetCookieString("Menu"); if (MenuType == "") { MenuType = "Index"; } string menu_ids = ""; if (CurrentSupplierUserGroup != null && CurrentSupplierUser.User_id != CurrentSupplier.User_id) { menu_ids = CurrentSupplierUserGroup.Menu_ids; } else { CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id); if (CurrentSupplierGroup != null) { menu_ids = CurrentSupplierGroup.Menu_ids; } } //lebi菜单 if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese")) { lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></span></li></ul>"; string license = "Copyright 2003-" + DateTime.Now.Year + " <a href=\"http://www.lebi.cn/\" target=\"_blank\" class=\"footcopy\">Lebi.cn</a> , All Rights Reserved. Powered by <a href=\"http://www.lebi.cn/support/license/?url=" + Request.ServerVariables["SERVER_NAME"] + "\" target=\"_blank\" title=\"LebiShop\" class=\"footcopy\">LebiShop</a> V<a href=\"" + site.AdminPath + "/config/version.aspx\">" + SYS.Version + "." + SYS.Version_Son + "</a>"; try { Label LBLicense = (Label)this.Page.FindControl("LBLicense"); LBLicense.Text = license; } catch { string strscript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><script language='javascript'>"; strscript += "document.onreadystatechange = loadlicense;"; strscript += "function loadlicense(){"; strscript += "if(document.readyState == \"complete\"){"; strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}"; strscript += "$('#lebicopy').html('" + license + "')"; strscript += "}}</script>"; Response.Write(strscript); } } else { lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></ul>"; } //处理菜单 desk = RequestTool.RequestInt("desk", 0); AllMenus = new List <Lebi_Supplier_Menu>(); List <Lebi_Supplier_Menu> All = B_Lebi_Supplier_Menu.GetList("Isshow=1", "Sort desc"); string currentgroupmenu = "," + menu_ids + ","; foreach (Lebi_Supplier_Menu m in All) { if (currentgroupmenu.Contains("," + m.id + ",")) { AllMenus.Add(m); } } TopMenus = (from m in AllMenus where m.parentid == 0 select m).ToList(); if (desk != 1) { try { var temp = from m in AllMenus where reqPage.Contains(m.URL.ToLower()) && m.parentid > 0 && m.URL != "" select m; //if (temp == null) // CurrentLeftMenu = new Lebi_Menu(); //else //{ CurrentLeftMenu = temp.ToList().FirstOrDefault(); CurrentTopMenu = (from m in AllMenus where m.id == CurrentLeftMenu.parentid select m).ToList().FirstOrDefault(); CurrentTopMenu = (from m in TopMenus where m.id == CurrentTopMenu.parentid select m).ToList().FirstOrDefault(); ////写入cookie NameValueCollection nvs = new NameValueCollection(); nvs.Add("top", CurrentTopMenu.id.ToString()); nvs.Add("left", CurrentLeftMenu.id.ToString()); CookieTool.WriteCookie("sMenu", nvs, 365); //} } catch (NullReferenceException) { var menu = CookieTool.GetCookie("sMenu"); int tid = 0; int lid = 0; int.TryParse(menu.Get("top"), out tid); int.TryParse(menu.Get("left"), out lid); CurrentTopMenu = (from m in TopMenus where m.id == tid select m).ToList().FirstOrDefault(); CurrentLeftMenu = (from m in AllMenus where m.id == lid select m).ToList().FirstOrDefault(); } } else { //写入cookie NameValueCollection nvs = new NameValueCollection(); nvs.Add("top", "0"); nvs.Add("left", "0"); CookieTool.WriteCookie("sMenu", nvs, 365); } if (CurrentTopMenu == null) { CurrentTopMenu = new Lebi_Supplier_Menu(); desk = 1; } #endregion Suppliers = GetSuppliers(); base.OnLoad(e); }
protected override void OnLoad(EventArgs e) { if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang")) { Response.Write(""); Response.End(); return; } PageLoadCheck(); //页面载入检查 #region 当前用户信息 int selectsupplierid = RequestTool.RequestInt("selectsupplierid"); if (selectsupplierid > 0) { //切换超级账号 string msg = ""; EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg); CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011"); } if (CurrentSupplierUser == null) { CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser); } if (CurrentSupplierUser.id == 0) { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id); if (CurrentSupplier.Type_id_SupplierStatus != 442) { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id); if (CurrentSupplierUserGroup == null) { CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup(); } if (CurrentSupplier != null) { CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id); if (CurrentSupplierGroup == null) { CurrentSupplierGroup = new Lebi_Supplier_Group(); } } else { Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx"); return; } #endregion #region 配合前台主题 string themecode = ""; int siteid = 0; var nv = CookieTool.GetCookie("ThemeStatus"); if (!string.IsNullOrEmpty(nv.Get("theme"))) { themecode = nv.Get("theme"); } if (!string.IsNullOrEmpty(nv.Get("theme"))) { int.TryParse(nv.Get("site"), out siteid); } if (siteid == 0) { siteid = ShopCache.GetMainSite().id; } LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true); #endregion Suppliers = GetSuppliers(); base.OnLoad(e); }
/// <summary> /// 载入主题 /// </summary> /// <param name="themecode"></param> /// <param name="siteid"></param> /// <param name="languagecode"></param> /// <param name="pcode"></param> /// <param name="checklogin">是否检查用户登录</param> public void LoadTheme(string themecode, int siteid, string languagecode, string pcode, bool checklogin) { CurrentSite_ = B_Lebi_Site.GetModel(siteid); if (ShopCache.GetMainSite().id == CurrentSite_.id || CurrentSite_.Domain == "") { IsMainSite = true; } CurrentLanguage_ = B_Lebi_Language.GetModel("Code='" + languagecode + "' and Site_id=" + siteid + ""); if (CurrentLanguage_ == null) { CurrentLanguage_ = new Lebi_Language(); } if (IsMainSite) { CurrentLanguage_.Path = (CurrentSite_.Path + CurrentLanguage_.Path).Replace("//", "/").TrimEnd('/'); } if (checklogin) { if (CurrentUser.id == 0 || CurrentUser.IsAnonymous == 1) { HttpContext.Current.Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + "")); } } CurrentTheme_ = B_Lebi_Theme.GetModel("Code='" + themecode + "'"); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='" + pcode + "'"); if (CurrentTheme_ == null) { CurrentTheme_ = new Lebi_Theme(); } Lebi_Theme_Skin skin = B_Lebi_Theme_Skin.GetModel("Theme_id=" + CurrentTheme_.id + " and Code='" + pcode + "'"); if (skin != null) { if (skin.PageSize > 0) { PageSize = skin.PageSize; } } if (CurrentSite_ != null) { SYS.Copyright = CurrentSite_.Copyright; SYS.Domain = CurrentSite_.Domain; SYS.Email = CurrentSite_.Email; SYS.Fax = CurrentSite_.Fax; SYS.Keywords = CurrentSite_.Keywords; SYS.Logoimg = CurrentSite_.Logoimg; SYS.Description = CurrentSite_.Description; SYS.Phone = CurrentSite_.Phone; SYS.QQ = CurrentSite_.QQ; SYS.ServiceP = CurrentSite_.ServiceP; SYS.Name = CurrentSite_.Name; SYS.Title = CurrentSite_.Title; SYS.FootHtml = CurrentSite_.FootHtml; SYS.TopAreaid = CurrentLanguage_.TopAreaid.ToString(); } LBTITLE = ""; LBTITLE += " - Powered by LebiShop"; //底部版权信息 //if (CurrentPage != null) //{ // StringBuilder sb = new StringBuilder(); // sb.Append("Powered by <a style=\"font-size:12px;color:#00497f\" href=\"http://www.lebi.cn\" target=\"_blank\" title=\"LebiShop多语言网上商店系统\">LebiShop</a> "); // sb.Append("V" + SYS.Version + "." + SYS.Version_Son); // try // { // Label label = (Label)this.Page.FindControl("LeBiLicense"); // label.Text = sb.ToString(); // } // catch (System.NullReferenceException) // { // Response.Write("<div style=\"height:100px;padding-top:10px;text-align:left;font-size:12;\">内部错误,请到【配置】=》【站点语言】栏目中重新生成网站<br>"); // Response.Write(sb.ToString() + "</div>"); // Response.End(); // } //} Session["CurrentTheme"] = CurrentTheme_;//session主要是为那些没有LoadTheme方法的页面服务的,如ajax Session["CurrentLanguage"] = CurrentLanguage_; Session["CurrentSite"] = CurrentSite_; //写入cookie NameValueCollection nvs = new NameValueCollection(); nvs.Add("theme", CurrentTheme_.Code); nvs.Add("language", CurrentLanguage_.Code); nvs.Add("site", CurrentSite_.id.ToString()); CookieTool.WriteCookie("ThemeStatus", nvs, 10); //多站点商品显示 if (Shop.Bussiness.Site.Instance.SiteCount > 1) { //if (Shop.LebiAPI.Service.Instanse.Check("domain3admin")) //{ if (DataBase.DBType == "sqlserver") { ProductWhere = "(Charindex('," + CurrentSite_.id + ",',','+Site_ids+',')>0 or Site_ids='') and Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "(Charindex('," + CurrentSite_.id + ",',','+Site_ids+',')>0 or Site_ids='')"; } if (DataBase.DBType == "access") { ProductWhere = "(Instr(','+Site_ids+',','," + CurrentSite_.id + ",')>0 or Site_ids='') and Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "(Instr(','+Site_ids+',','," + CurrentSite_.id + ",')>0 or Site_ids='')"; } //} //else //{ // ProductWhere = "Product_id = 0 and Type_id_ProductStatus = 101"; //} } else { ProductWhere = "Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "1=1"; } //ProductWhere += " and (UserLevel_ids_show='' or UserLevel_ids_show is null or ','+UserLevel_ids_show+',' like '%," + CurrentUserLevel.id + ",%' )"; ProductWhere += " and (IsDel!=1 or IsDel is null)"; }