Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("theme_advert_list", "广告位页面列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            id  = RequestTool.RequestInt("id", 0);
            key = RequestTool.RequestString("key");
            //int tid = RequestTool.RequestInt("tid", 0);
            theme = B_Lebi_Theme.GetModel(id);
            if (theme == null)
            {
                PageReturnMsg = PageErrorMsg();

                theme = new Lebi_Theme();
            }
            PageSize     = RequestTool.getpageSize(25);
            string where = "Theme_id=" + id;
            if (key != "")
            {
                where += " and (Code like lbsql{'%" + key + "%'} or [Description] like lbsql{'%" + key + "%'})";
            }
            models = B_Lebi_Theme_Advert.GetList(where, "Sort desc,Code asc", PageSize, page);
            int recordCount = B_Lebi_Theme_Advert.Counts(where);

            PageString = Pager.GetPaginationString("?id=" + id + "&key=" + key + "&page={0}", page, PageSize, recordCount);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("theme_advert_list", "广告位页面列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            PageSize = RequestTool.getpageSize(25);
            id       = RequestTool.RequestInt("id", 0);
            //int tid = RequestTool.RequestInt("tid", 0);
            string themeid = "0";

            themes = B_Lebi_Theme.GetList("id in (select Theme_id from [lebi_Language])", "");
            foreach (Lebi_Theme theme in themes)
            {
                themeid += "," + theme.id;
            }
            key          = RequestTool.RequestString("key");
            string where = "Theme_id in (" + themeid + ")";
            if (key != "")
            {
                where += " and (Code like lbsql{'%" + key + "%'} or [Description] like lbsql{'%" + key + "%'})";
            }
            models = B_Lebi_Theme_Advert.GetList(where, "Theme_id desc,Sort desc", PageSize, page);
            int recordCount = B_Lebi_Theme_Advert.Counts(where);

            PageString = Pager.GetPaginationString("?page={0}&key=" + key, page, PageSize, recordCount);
        }
Beispiel #3
0
        public List <Lebi_Theme_Advert> GetAdvert(int themeid)
        {
            List <Lebi_Theme_Advert> models;

            key          = RequestTool.RequestString("key");
            string where = "Theme_id=" + themeid + "";
            if (key != "")
            {
                where += " and (Code like lbsql{'%" + key + "%'} or [Description] like lbsql{'%" + key + "%'})";
            }
            models = B_Lebi_Theme_Advert.GetList(where, "Sort desc", PageSize, page);
            return(models);
        }
Beispiel #4
0
        /// <summary>
        /// 复制一个主题
        /// </summary>
        public void Theme_Copy()
        {
            if (!EX_Admin.Power("theme_edit", "编辑模板"))
            {
                AjaxNoPower();
                return;
            }
            int        id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme theme = B_Lebi_Theme.GetModel(id);

            if (theme == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            string oldfilepath = theme.Path_Files.Clone().ToString();

            theme.Code        = "";
            theme.LebiUser    = SYS.LicenseUserName;
            theme.LebiUser_id = 0;
            theme.Path_Advert = theme.Path_Advert.Replace(theme.Path_Files, theme.Path_Files + "_[copy]");
            theme.Path_CSS    = theme.Path_CSS.Replace(theme.Path_Files, theme.Path_Files + "_[copy]");
            theme.Path_Image  = theme.Path_Image.Replace(theme.Path_Files, theme.Path_Files + "_[copy]");
            theme.Path_JS     = theme.Path_JS.Replace(theme.Path_Files, theme.Path_Files + "_[copy]");
            theme.Path_Files  = theme.Path_Files + "_[copy]";
            theme.Name        = theme.Name + "_[copy]";
            theme.Time_Add    = System.DateTime.Now;
            B_Lebi_Theme.Add(theme);
            theme.id   = B_Lebi_Theme.GetMaxId();
            theme.Code = SYS.LicenseUserName + "_" + theme.id;
            B_Lebi_Theme.Update(theme);
            //复制皮肤
            List <Lebi_Theme_Skin> skins = B_Lebi_Theme_Skin.GetList("Theme_id=" + id + "", "");

            foreach (Lebi_Theme_Skin skin in skins)
            {
                skin.Theme_id = theme.id;
                B_Lebi_Theme_Skin.Add(skin);
            }
            //复制广告位
            List <Lebi_Theme_Advert> adverts = B_Lebi_Theme_Advert.GetList("Theme_id=" + id + "", "");

            foreach (Lebi_Theme_Advert advert in adverts)
            {
                advert.Theme_id = theme.id;
                B_Lebi_Theme_Advert.Add(advert);
                int adid = B_Lebi_Theme_Advert.GetMaxId();
                //复制广告
                List <Lebi_Advert> ads = B_Lebi_Advert.GetList("Theme_Advert_id=" + advert.id + "", "");
                foreach (Lebi_Advert ad in ads)
                {
                    ad.Theme_id        = theme.id;
                    ad.Theme_Advert_id = adid;
                    B_Lebi_Advert.Add(ad);
                }
            }
            //==============================================
            //复制文件
            string varFromDirectory = HttpContext.Current.Server.MapPath(@"~/" + oldfilepath);
            string varToDirectory   = HttpContext.Current.Server.MapPath(@"~/" + theme.Path_Files);

            FileTool.CopyFiles(varFromDirectory, varToDirectory);
            Response.Write("{\"msg\":\"" + Tag("OK") + "\"}");
        }