Exemplo n.º 1
0
 /// <summary>
 /// 载入主题
 /// </summary>
 /// <param name="code"></param>
 public void LoadTheme(string tcode, string pcode)
 {
     CurrentTheme_              = B_Lebi_Theme.GetList("Code='" + tcode + "'", "").FirstOrDefault();
     CurrentLanguage_           = B_Lebi_Language.GetList("Code='" + CurrentTheme.Language + "'", "").FirstOrDefault();
     Session["CurrentTheme"]    = CurrentTheme_;//session主要是为那些没有LoadTheme方法的页面服务的,如ajax
     Session["CurrentLanguage"] = CurrentLanguage_;
     CurrentPage = B_Lebi_Theme_Page.GetModel("Code='" + pcode + "'");
 }
Exemplo n.º 2
0
        /// <summary>
        /// 根据主题重新设置系统图片尺寸
        /// </summary>
        public static void UpdteImageSize()
        {
            BaseConfig           mx    = ShopCache.GetBaseConfig();
            List <Lebi_Language> langs = B_Lebi_Language.GetList("", "");
            Lebi_ImageSize       model;

            string ids = "0";

            //检查系统默认的规格
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageBigWidth + " and Height=" + mx.ImageBigHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageBigWidth;
                model.Height = mx.ImageBigHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageMediumWidth + " and Height=" + mx.ImageMediumHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageMediumWidth;
                model.Height = mx.ImageMediumHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            model = B_Lebi_ImageSize.GetModel("Width=" + mx.ImageSmallWidth + " and Height=" + mx.ImageSmallHeight + "");
            if (model == null)
            {
                model        = new Lebi_ImageSize();
                model.Width  = mx.ImageSmallWidth;
                model.Height = mx.ImageSmallHeight;
                B_Lebi_ImageSize.Add(model);
                ids += "," + B_Lebi_ImageSize.GetMaxId();
            }
            else
            {
                ids += "," + model.id;
            }
            foreach (Lebi_Language lang in langs)
            {
                Lebi_Theme theme = B_Lebi_Theme.GetModel(lang.Theme_id);
                if (theme == null)
                {
                    continue;
                }
                //model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageBig_Width + " and Height=" + theme.ImageBig_Height + "");
                //if (model == null)
                //{
                //    model = new Lebi_ImageSize();
                //    model.Width = theme.ImageBig_Width;
                //    model.Height = theme.ImageBig_Height;
                //    B_Lebi_ImageSize.Add(model);
                //    ids += "," + B_Lebi_ImageSize.GetMaxId();
                //}
                //else
                //{
                //    ids += "," + model.id;
                //}
                model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageMedium_Width + " and Height=" + theme.ImageMedium_Height + "");
                if (model == null)
                {
                    model        = new Lebi_ImageSize();
                    model.Width  = theme.ImageMedium_Width;
                    model.Height = theme.ImageMedium_Height;
                    B_Lebi_ImageSize.Add(model);
                    ids += "," + B_Lebi_ImageSize.GetMaxId();
                }
                else
                {
                    ids += "," + model.id;
                }
                //model = B_Lebi_ImageSize.GetModel("Width=" + theme.ImageSmall_Width + " and Height=" + theme.ImageSmall_Height + "");
                //if (model == null)
                //{
                //    model = new Lebi_ImageSize();
                //    model.Width = theme.ImageSmall_Width;
                //    model.Height = theme.ImageSmall_Height;
                //    B_Lebi_ImageSize.Add(model);
                //    ids += "," + B_Lebi_ImageSize.GetMaxId();
                //}
                //else
                //{
                //    ids += "," + model.id;
                //}
            }
            B_Lebi_ImageSize.Delete("id not in (" + ids + ")");
        }
Exemplo n.º 3
0
        /// <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)";
        }