protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("theme_skin_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) { Response.Write("参数错误"); Response.End(); theme = new Lebi_Theme(); } CheckCode(theme); string where = "IsPage=1 and Theme_id=" + id; if (key != "") { where += " and (Code like lbsql{'%" + key + "%'} or Name like lbsql{'%" + key + "%'} or PageName like lbsql{'%" + key + "%'})"; } ispage = RequestTool.RequestInt("ispage", 2); //if (ispage == 0 || ispage == 1) //{ // where += " and IsPage=" + ispage; //} PageSize = RequestTool.getpageSize(25); models = B_Lebi_Theme_Skin.GetList(where, "Code asc,Sort desc", PageSize, page); int recordCount = B_Lebi_Theme_Skin.Counts(where); PageString = Pager.GetPaginationString("?id=" + theme.id + "&ispage=" + ispage + "&page={0}", page, PageSize, recordCount); }
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); }
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); }
/// <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 + "\"}"); }
/// <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\"}"); }
public Lebi_Theme GetTheme(int id) { Lebi_Theme model = B_Lebi_Theme.GetModel(id); if (model == null) { model = new Lebi_Theme(); } return(model); }
/// <summary> /// 主题的名称 /// </summary> /// <param name="theme"></param> /// <returns></returns> public string GetThemeName(int id) { string str = ""; Lebi_Theme model = B_Lebi_Theme.GetModel("id=" + id + ""); if (model != null) { str = model.Name; } return(str); }
/// <summary> /// 编辑模板-页面 /// </summary> public void Skin_Edit() { if (RequestTool.GetConfigKey("OnlineFileEdit").Trim() != "1") { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); Lebi_Theme_Skin model = B_Lebi_Theme_Skin.GetModel(id); if (model == null) { model = new Lebi_Theme_Skin(); } B_Lebi_Theme_Skin.BindForm(model); //if (model.IsPage == 1) // model.Code = ""; if (model.id == 0) { if (!EX_Admin.Power("theme_skin_add", "添加模板页面")) { AjaxNoPower(); return; } B_Lebi_Theme_Skin.Add(model); id = B_Lebi_Theme_Skin.GetMaxId(); Log.Add("添加模板-页面", "Theme_Skin", id.ToString(), CurrentAdmin, model.Name); } else { if (!EX_Admin.Power("theme_skin_edit", "编辑模板页面")) { AjaxNoPower(); return; } B_Lebi_Theme_Skin.Update(model); Log.Add("编辑模板-页面", "Theme_Skin", id.ToString(), CurrentAdmin, model.Name); } //生成页面 string SkinContent = Request["SkinContent"]; if (SkinContent != "" && model.Path_Skin != "") //如果模板内容为空则不生成页面 by lebi.kingdge 2015-02-25 { Lebi_Theme theme = B_Lebi_Theme.GetModel(model.Theme_id); string SkinPath = theme.Path_Files + "/" + model.Path_Skin; GreatSkin(SkinPath, SkinContent); } string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}"; Response.Write(result); }
/// <summary> /// 生成页面皮肤 /// 针对单个皮肤生成的情况 /// </summary> /// <returns></returns> public void CreateSkin() { string Msg = ""; int ThemeID = 0; int SkinID = 0; string Content = ""; string SkinPath = ""; //皮肤路径 string Path = ""; //输入Path要包含路径及文件名 SkinID = RequestTool.RequestInt("id", 0); Lebi_Theme_Skin skin = B_Lebi_Theme_Skin.GetModel(SkinID); Lebi_Theme theme; if (skin == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } ThemeID = skin.Theme_id; theme = B_Lebi_Theme.GetModel(ThemeID); SkinPath = theme.Path_Files + "/" + skin.Path_Skin; SkinPath = ThemeUrl.GetFullPath(SkinPath); Content = HtmlEngine.ReadTxt(SkinPath); List <Lebi_Language> langs = B_Lebi_Language.GetList("Theme_id=" + theme.id + "", ""); if (langs.Count == 0) { Response.Write("{\"msg\":\"" + Tag("请在站点语言设置中关联此模板") + "\"}"); return; } Site site = new Site(); foreach (Lebi_Language lang in langs) { if (lang.Theme_id != ThemeID) { continue; } Lebi_Site s = B_Lebi_Site.GetModel(lang.Site_id); if (s == null) { Path = lang.Path + "/" + skin.PageName; } else { Path = s.Path + lang.Path + "/" + skin.PageName; } Msg = Shop.Bussiness.Theme.CreatAspx(s, lang, theme, skin, Path, Content); } Response.Write("{\"msg\":\"" + Msg + "\"}"); }
/// <summary> /// 升级一个主题 /// </summary> public void Theme_Update() { if (!EX_Admin.Power("theme_edit", "编辑模板")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); Lebi_Theme theme = B_Lebi_Theme.GetModel(id); string res = Shop.LebiAPI.Service.Instanse.Theme_DownLoad(0, theme); Response.Write("{\"msg\":\"" + res + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { int tid = RequestTool.RequestInt("tid", 0); int id = RequestTool.RequestInt("id", 0); if (RequestTool.GetConfigKey("OnlineFileEdit").Trim() != "1") { PageReturnMsg = PageNoEditMsg(); } if (id == 0) { if (!EX_Admin.Power("theme_skin_add", "添加模板页面")) { PageReturnMsg = PageNoPowerMsg(); } } else { if (!EX_Admin.Power("theme_skin_edit", "编辑模板页面")) { PageReturnMsg = PageNoPowerMsg(); } } model = B_Lebi_Theme_Skin.GetModel(id); if (model != null) { tid = model.Theme_id; } else { model = new Lebi_Theme_Skin(); } theme = B_Lebi_Theme.GetModel(tid); if (theme == null) { theme = new Lebi_Theme(); } SkinContent = GetSkinStr(theme, model); tpage = B_Lebi_Theme_Page.GetModel("Code='" + model.Code + "'"); if (tpage == null) { tpage = new Lebi_Theme_Page(); model.IsPage = 1; } }
/// <summary> /// 发布主题 /// </summary> public void Theme_publish() { int id = RequestTool.RequestInt("id", 0); Lebi_Theme model = B_Lebi_Theme.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } B_Lebi_Theme.BindForm(model); model.Path_Advert = model.Path_Files + "/advertment/"; model.Path_Advert = model.Path_Advert.Replace("//", "/"); string res = Shop.LebiAPI.Service.Instanse.Theme_Upload(model); Response.Write("{\"msg\":\"" + res + "\"}"); }
/// <summary> /// 生成页面皮肤 /// 针对生成整个主题-针对一个语言 /// </summary> /// <returns></returns> public void CreateLanguageTheme() { int Language_id = RequestTool.RequestInt("Language_id", 0); Lebi_Language lang = B_Lebi_Language.GetModel(Language_id); Lebi_Theme theme = B_Lebi_Theme.GetModel(lang.Theme_id); if (theme == null) { Response.Write("{\"msg\":\"" + Tag("未关联任何模板") + "\"}"); return; } string Msg = ""; Site site = new Site(); Msg = Shop.Bussiness.Theme.CreateThemeByLanguage(lang, theme); Response.Write("{\"msg\":\"" + Msg + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); if (id == 0) { if (!EX_Admin.Power("theme_add", "添加模板")) { PageReturnMsg = PageNoPowerMsg(); } } else { if (!EX_Admin.Power("theme_edit", "编辑模板")) { PageReturnMsg = PageNoPowerMsg(); } } model = B_Lebi_Theme.GetModel(id); if (model == null) { model = new Lebi_Theme(); model.LebiUser = SYS.LicenseUserName; IsOwner = true; model.ImageBig_Width = 800; model.ImageBig_Height = 800; model.ImageMedium_Width = 320; model.ImageMedium_Height = 320; model.ImageSmall_Width = 200; model.ImageSmall_Height = 200; } else { if (model.LebiUser == SYS.LicenseUserName || SYS.LicenseUserName == "*****@*****.**" || SYS.LicenseUserName == "*****@*****.**" || SYS.LicenseUserName == "*****@*****.**") { IsOwner = true; } else { IsOwner = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("fileedit", "文件编辑")) { PageReturnMsg = PageNoPowerMsg(); } int id = RequestTool.RequestInt("id", 0); theme = B_Lebi_Theme.GetModel(id); if (theme == null) { PageReturnMsg = PageErrorMsg(); } t = RequestTool.RequestString("t", "block"); //file = RequestTool.RequestString("file"); //if (file.IndexOf("/") == 0) // file = file.Substring(1, file.Length - 1); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("advert_edit", "设置广告位")) { WindowNoPower(); } id = RequestTool.RequestInt("id", 0); tid = RequestTool.RequestInt("tid", 0); theme = B_Lebi_Theme.GetModel(tid); if (theme == null) { PageError(); return; } model = B_Lebi_Theme_Advert.GetModel(id); if (model == null) { model = new Lebi_Theme_Advert(); model.Theme_id = theme.id; } }
/// <summary> /// 生成页面皮肤 /// 针对生成整个主题 /// </summary> /// <returns></returns> public void CreateTheme() { int Theme_id = RequestTool.RequestInt("Theme_id", 0); Lebi_Theme theme = B_Lebi_Theme.GetModel(Theme_id); List <Lebi_Language> langs = B_Lebi_Language.GetList("Theme_id=" + theme.id + "", ""); if (langs.Count == 0) { Response.Write("{\"msg\":\"" + Tag("请在站点语言设置中关联此模板") + "\"}"); return; } string Msg = ""; Site site = new Site(); foreach (Lebi_Language lang in langs) { if (lang.Theme_id != theme.id) { continue; } Msg = Shop.Bussiness.Theme.CreateThemeByLanguage(lang, theme); } Response.Write("{\"msg\":\"" + Msg + "\"}"); }
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; } }
/// <summary> /// 编辑广告位 /// </summary> public void Advert_Edit() { if (!EX_Admin.Power("advert_edit", "设置广告位")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); int Theme_id = RequestTool.RequestInt("Theme_id", 0); string code = RequestTool.RequestString("Code"); int count = B_Lebi_Theme_Advert.Counts("Theme_id=" + Theme_id + " and Code=lbsql{'" + code + "'} and id!=" + id + ""); if (count > 0) { Response.Write("{\"msg\":\"代码已存在\"}"); return; } Lebi_Theme theme = B_Lebi_Theme.GetModel(Theme_id); Lebi_Theme_Advert model = B_Lebi_Theme_Advert.GetModel(id); if (model == null) { model = new Lebi_Theme_Advert(); model = B_Lebi_Theme_Advert.BindForm(model); B_Lebi_Theme_Advert.Add(model); } else { model = B_Lebi_Theme_Advert.BindForm(model); B_Lebi_Theme_Advert.Update(model); } string action = Tag("设置广告位"); Log.Add(action, "Theme_Advert", model.id.ToString(), CurrentAdmin); Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}"); }
/// <summary> /// 编辑模板 /// </summary> public void Theme_Edit() { int id = RequestTool.RequestInt("id", 0); Lebi_Theme model = B_Lebi_Theme.GetModel(id); if (model == null) { model = new Lebi_Theme(); } B_Lebi_Theme.BindForm(model); model.ImageSmallUrl = model.ImageUrl.Replace("icon", "icon_small"); if (model.LebiUser == "") { model.LebiUser = SYS.LicenseUserName; } model.Language = RequestTool.RequestSafeString("Language"); model.ImageBig_Height = SYS.ImageBigHeight; model.ImageBig_Width = SYS.ImageBigWidth; model.ImageSmall_Height = SYS.ImageSmallHeight; model.ImageSmall_Width = SYS.ImageSmallWidth; model.Path_Files = RequestTool.RequestString("Path_Files"); model.Path_CSS = RequestTool.RequestString("Path_CSS"); model.Path_Image = RequestTool.RequestString("Path_Image"); model.Path_JS = RequestTool.RequestString("Path_JS"); model.Path_Advert = model.Path_Files + "/advertment/"; model.Path_Files = "/" + model.Path_Files.Trim('/'); model.Path_CSS = "/" + model.Path_CSS.Trim('/'); model.Path_Image = "/" + model.Path_Image.Trim('/'); model.Path_JS = "/" + model.Path_JS.Trim('/'); model.IsUpdate = RequestTool.RequestInt("IsUpdate"); if (model.id == 0) { if (!EX_Admin.Power("theme_add", "添加模板")) { AjaxNoPower(); return; } B_Lebi_Theme.Add(model); id = B_Lebi_Theme.GetMaxId(); //model.Code = SYS.LicenseUserName + "_" + id; model.Code = DateTime.Now.ToString("yyMMddssfff"); model.id = id; B_Lebi_Theme.Update(model); Log.Add("添加模板", "Theme", id.ToString(), CurrentAdmin, model.Name); } else { if (!EX_Admin.Power("theme_edit", "编辑模板")) { AjaxNoPower(); return; } if (model.Code == "") { model.Code = DateTime.Now.ToString("yyMMddssfff"); } //model.Code = SYS.LicenseUserName + "_" + id; B_Lebi_Theme.Update(model); Log.Add("编辑模板", "Theme", id.ToString(), CurrentAdmin, model.Name); } string Language_ids = RequestTool.RequestString("Language_ids"); if (Language_ids != "") { List <Lebi_Language> langs = B_Lebi_Language.GetList("id in (lbsql{" + Language_ids + "})", ""); foreach (Lebi_Language lang in langs) { lang.Theme_id = id; B_Lebi_Language.Update(lang); } } Language.UpdteImageSize(); string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}"; Response.Write(result); }
public void CreatePage() { int id = RequestTool.RequestInt("id", 0); string languageid = RequestTool.RequestString("Language"); Lebi_Theme_Page model = B_Lebi_Theme_Page.GetModel(id); string Path = ""; if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Path = model.StaticPath; string urlpath = "http://" + HttpContext.Current.Request.Url.Authority + WebPath; //string port= List <Lebi_Language> langs; if (languageid == "") { langs = Language.AllLanguages(); } else { langs = B_Lebi_Language.GetList("id in (lbsql{" + languageid + "})", ""); } foreach (Lebi_Language lang in langs) { Lebi_Theme theme = B_Lebi_Theme.GetModel(lang.Theme_id); if (theme == null) { Response.Write("{\"msg\":\"" + Tag("语言与模板关联错误") + "\"}"); return; } } switch (model.Code) { case "P_About": P_About(langs, model, urlpath); break; case "P_ArticleDetails": P_ArticleDetails(langs, model, urlpath); break; case "P_Help": P_Help(langs, model, urlpath); break; case "P_NewsDetails": P_NewsDetails(langs, model, urlpath); break; case "P_Product": P_Product(langs, model, urlpath); break; default: OnePage(langs, model, urlpath); break; } }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; int theme_id = RequestTool.RequestInt("theme_id", 0); Lebi_Theme theme = B_Lebi_Theme.GetModel(theme_id); if (theme == null) { Response.Write("{\"msg\":\"" + Language.Tag("参数错误") + "\"}"); return; } HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(theme.Path_Advert); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; OldImage = ThemeUrl.CheckURL(OldImage); string ImageSmall = name.Replace("_w$h_", "_100$100_"); string size = "100$100"; ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = size; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"url\":\"" + savepath + name + "\",\"Image\":\"" + name + "\",\"ImageSmall\":\"" + ImageSmall + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
/// <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") + "\"}"); }