Ejemplo n.º 1
0
        /// <summary>
        /// 编辑添加一个广告
        /// </summary>
        public void AdvertImage_Edit()
        {
            if (!EX_Admin.Power("advertimage_edit", "编辑广告"))
            {
                AjaxNoPower();
                return;
            }
            int         id    = RequestTool.RequestInt("id", 0);
            Lebi_Advert model = B_Lebi_Advert.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Advert();
                model = B_Lebi_Advert.BindForm(model);
                model.Language_Codes = Language.LanuageidsToCodes(model.Language_ids);
                B_Lebi_Advert.Add(model);
                model.id = B_Lebi_Advert.GetMaxId();
            }
            else
            {
                model = B_Lebi_Advert.BindForm(model);
                model.Language_Codes = Language.LanuageidsToCodes(model.Language_ids);
                B_Lebi_Advert.Update(model);
            }
            string     action = Tag("编辑广告");
            Lebi_Theme theme  = B_Lebi_Theme.GetModel(model.Theme_id);

            if (theme != null)
            {
                ImageHelper.LebiImagesUsed(theme.Path_Files + "/advertment/" + model.Image, "advertment", model.id);
            }
            Log.Add(action, "AdvertImage", model.id.ToString(), CurrentAdmin);
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除一个广告
        /// </summary>
        public void AdvertImage_Del()
        {
            if (!EX_Admin.Power("advertimage_del", "删除广告"))
            {
                AjaxNoPower();
                return;
            }
            string id = RequestTool.RequestString("ids");

            if (id == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请选择要删除的信息") + "\"}");
                return;
            }
            List <Lebi_Advert> models = B_Lebi_Advert.GetList("id in (lbsql{" + id + "})", "");

            foreach (Lebi_Advert model in models)
            {
                B_Lebi_Advert.Delete(model.id);
                //处理图片
                ImageHelper.LebiImagesDelete("advertment", model.id);
            }
            string action = Tag("删除广告");

            Log.Add(action, "AdvertImage", id.ToString(), CurrentAdmin);
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除模板
        /// </summary>
        public void Theme_Del()
        {
            if (!EX_Admin.Power("theme_del", "删除模板"))
            {
                EX_Admin.NoPower();
                return;
            }
            int        id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme model = B_Lebi_Theme.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            int count = B_Lebi_Language.Counts("Theme_id=" + model.id + "");

            if (count > 0)
            {
                Response.Write("{\"msg\":\"" + Tag("模板正在使用中,不能删除") + "\"}");
                return;
            }
            Log.Add("删除模板", "Theme", id.ToString(), CurrentAdmin, model.Name);
            B_Lebi_Theme.Delete(id);
            B_Lebi_Theme_Advert.Delete("Theme_id=" + id + "");
            B_Lebi_Theme_Skin.Delete("Theme_id=" + id + "");
            B_Lebi_Advert.Delete("Theme_id=" + id + "");

            Response.Write("{\"msg\":\"OK\"}");
        }
Ejemplo n.º 4
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");
            tid = RequestTool.RequestInt("tid", 0);
            adv = B_Lebi_Theme_Advert.GetModel(id);
            if (adv == null)
            {
                adv = new Lebi_Theme_Advert();
            }
            theme = B_Lebi_Theme.GetModel(tid);
            if (theme == null)
            {
                theme = new Lebi_Theme();
            }
            string where = "Theme_Advert_id=" + id;
            if (key != "")
            {
                where += " and (Title like lbsql{'%" + key + "%'} or [URL] like lbsql{'%" + key + "%'})";
            }
            imgs = B_Lebi_Advert.GetList(where, "Sort desc", PageSize, page);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 删除一个广告位
        /// </summary>
        public void Advert_Del()
        {
            if (!EX_Admin.Power("advert_del", "删除广告位"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);

            B_Lebi_Theme_Advert.Delete(id);
            B_Lebi_Advert.Delete("Theme_Advert_id=" + id + "");
            string action = Tag("删除广告位");

            Log.Add(action, "Advert", id.ToString(), CurrentAdmin);
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 批量更新广告信息
        /// </summary>
        public void AdvertImage_Update()
        {
            if (!EX_Admin.Power("advertimage_edit", "编辑广告"))
            {
                AjaxNoPower();
                return;
            }
            string             id     = RequestTool.RequestString("Uid");
            List <Lebi_Advert> models = B_Lebi_Advert.GetList("id in (lbsql{" + id + "})", "");

            foreach (Lebi_Advert model in models)
            {
                model.Sort  = RequestTool.RequestInt("Sort" + model.id + "", 0);
                model.Title = RequestTool.RequestString("Title" + model.id);
                model.URL   = RequestTool.RequestString("URL" + model.id);
                B_Lebi_Advert.Update(model);
            }
            Log.Add("编辑广告", "AdvertImage", id.ToString(), CurrentAdmin, id.ToString());
            Response.Write("{\"msg\":\"OK\"}");
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("advertimage_edit", "编辑广告"))
            {
                PageNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int aid = RequestTool.RequestInt("aid");

            advert = B_Lebi_Theme_Advert.GetModel(aid);
            if (advert == null)
            {
                PageError();
                return;
            }
            theme = B_Lebi_Theme.GetModel(advert.Theme_id);
            model = B_Lebi_Advert.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Advert();
                model.Theme_Advert_Code = advert.Code;
                model.Theme_Advert_id   = advert.id;
            }
        }
Ejemplo n.º 8
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") + "\"}");
        }
Ejemplo n.º 9
0
        public List <Lebi_Advert> GetImages(int id)
        {
            List <Lebi_Advert> models = B_Lebi_Advert.GetList("Theme_Advert_id=" + id + "", "Sort desc");

            return(models);
        }