public void Save(AdTag AdTag) { AdTag baseAdTag = Entity.AdTag.FirstOrDefault(n => n.Id == AdTag.Id); baseAdTag = Request.ConvertRequestToModel <AdTag>(baseAdTag, AdTag); Entity.SaveChanges(); BaseRedirect(); }
public void Delete(AdTag AdTag, string InfoList, int?IsDel) { if (string.IsNullOrEmpty(InfoList)) { InfoList = AdTag.Id.ToString(); } int Ret = Entity.MoveToDeleteEntity <AdTag>(InfoList, IsDel, AdminUser.UserName); Response.Write(Ret); }
public void ChangeStatus(AdTag AdTag, string InfoList, string Clomn, string Value) { if (string.IsNullOrEmpty(InfoList)) { InfoList = AdTag.Id.ToString(); } int Ret = Entity.ChangeEntity <AdTag>(InfoList, Clomn, Value); Response.Write(Ret); }
public ActionResult Index(AdTag AdTag, EFPagingInfo <AdTag> p) { p.OrderByList.Add("State", "DESC"); p.OrderByList.Add("Sort", "ASC"); IPageOfItems <AdTag> AdTagList = Entity.Selects <AdTag>(p); ViewBag.AdTagList = AdTagList; ViewBag.AdTag = AdTag; ViewBag.Add = this.checkPower("Add"); ViewBag.Edit = this.checkPower("Edit"); ViewBag.Delete = this.checkPower("Delete"); ViewBag.Save = this.checkPower("Save"); return(View()); }
public ActionResult Edit(AdTag AdTag) { if (AdTag.Id != 0) { AdTag = Entity.AdTag.FirstOrDefault(n => n.Id == AdTag.Id); } if (AdTag == null) { ViewBag.ErrorMsg = "数据不存在"; return(View("Error")); } ViewBag.AdTag = AdTag; if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } return(View()); }
public ActionResult Index(SysAgent SysAgent, EFPagingInfo <APPModule> p, int SourceAgentId = 0) { SysAgent.Id = this.BasicAgent.Id; if (this.BasicAgent.IsTeiPai != 1) { ViewBag.IsShowReturn = false; ViewBag.ErrorMsg = "非贴牌代理商无使用该功能"; return(View("Error")); } var APPModuleList = Entity.APPModule.Where(o => o.AgentId == SysAgent.Id && o.Version == 1 && o.State == 1).OrderBy(o => o.Sort).ToList(); ViewBag.APPModuleList = APPModuleList; var APPBlockList = Entity.APPBlock.Where(o => o.AgentId == SysAgent.Id && o.State == 1).OrderBy(o => o.Sort).ToList(); ViewBag.APPBlockList = APPBlockList; //加载类型选项 string filename = HttpContext.Server.MapPath("/ModuleTypeSelectList.json"); string jsonstr = System.IO.File.ReadAllText(filename); var ModuleTypeSelectList = JsonConvert.DeserializeObject <SortedList <string, string> >(jsonstr); ViewBag.ModuleTypeSelectList = ModuleTypeSelectList; string Bottomfilename = HttpContext.Server.MapPath("/ModuleTypeBottomSelectList.json"); string Bottomjsonstr = System.IO.File.ReadAllText(Bottomfilename); var ModuleTypeBottomSelectList = JsonConvert.DeserializeObject <SortedList <string, string> >(Bottomjsonstr); ViewBag.ModuleTypeBottomSelectList = ModuleTypeBottomSelectList; //加载广告及标识 AdTag bannerTag = Entity.AdTag.FirstOrDefault(o => o.Tag == "newBanner" && o.State == 1); ViewBag.BannerTag = bannerTag; if (bannerTag == null) { ViewBag.ErrorMsg = "无法找到广告标识"; return(View("Error")); } var bannerInfos = Entity.AdInfo.OrderBy(o => o.Sort).Where(o => o.TId == bannerTag.Id && o.State == 1 && o.AgentId == SysAgent.Id).ToList(); ViewBag.bannerInfos = bannerInfos; //贴牌代理 var SysAgentList = Entity.SysAgent.Where(o => o.IsTeiPai == 1 && o.State == 1).ToList(); var haofusysagent = new SysAgent() { Id = 0, Name = "好付", AppBtnNumber = BasicSet.AppBtnNumber, APPHasMore = BasicSet.APPHasMore, APPName = BasicSet.Name, }; SysAgentList.Add(haofusysagent); SysAgentList = SysAgentList.OrderBy(o => o.Id).ToList(); ViewBag.SysAgentList = SysAgentList; ViewBag.SysAgent = SysAgentList.FirstOrNew(o => o.Id == SysAgent.Id); ViewBag.SourceAgentId = SourceAgentId; if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } //取得系统图标 string PhysicalApplicationPath = this.HttpContext.Request.PhysicalApplicationPath; string APPModelPath = PhysicalApplicationPath + "UpLoadFiles\\APPModule\\"; var homeDir = new System.IO.DirectoryInfo(APPModelPath + "home2"); var bottomDefDir = new System.IO.DirectoryInfo(APPModelPath + "bottom2\\default"); var bottomActDir = new System.IO.DirectoryInfo(APPModelPath + "bottom2\\activate"); var homeFiles = homeDir.GetFiles(); var bottomDefFiles = bottomDefDir.GetFiles(); var bottomActFiles = bottomActDir.GetFiles(); ViewBag.homeFiles = homeFiles; ViewBag.bottomDefaultFiles = bottomDefFiles; ViewBag.bottomActFiles = bottomActFiles; //公告 var Notice = this.Entity.MsgNotice.Where(o => (o.AgentId == 0 || o.AgentId == SysAgent.Id) && (o.NType == 0 || o.NType == 3) && o.State == 1).OrderByDescending(o => o.Id) .Select(o => new { info = o.Info }).FirstOrDefault(); var ninfo = string.Empty; if (Notice != null) { ninfo += Notice.info.IsNullOrEmpty() ? Notice.info : Utils.RemoveHtml(Notice.info) + " "; } ViewBag.ninfo = ninfo; this.ViewBag.IsSave = this.checkSignPower("Save"); this.ViewBag.IsDelete = this.checkSignPower("Delete"); return(View()); }
public void Add(AdTag AdTag) { Entity.AdTag.AddObject(AdTag); Entity.SaveChanges(); BaseRedirect(); }
public ActionResult Index(SysAgent SysAgent) { if (this.BasicAgent.Tier != 1) { ViewBag.ErrorMsg = "抱歉!该功能只有一级代理可用."; return(View("Error")); } if (this.BasicAgent.IsTeiPai == 0) { ViewBag.ErrorMsg = "非贴牌用户无法使用该功能"; return(View("Error")); } var APPModuleList = Entity.APPModule.Where(o => o.AgentId == this.BasicAgent.Id && o.Version == 0).OrderBy(o => o.Id).ToList(); ViewBag.APPModuleList = APPModuleList; //加载类型选项 string filename = HttpContext.Server.MapPath("/ModuleTypeSelectList.json"); string jsonstr = System.IO.File.ReadAllText(filename); var ModuleTypeSelectList = JsonConvert.DeserializeObject <SortedList <string, string> >(jsonstr); ViewBag.ModuleTypeSelectList = ModuleTypeSelectList; string Bottomfilename = HttpContext.Server.MapPath("/ModuleTypeBottomSelectList.json"); string Bottomjsonstr = System.IO.File.ReadAllText(Bottomfilename); var ModuleTypeBottomSelectList = JsonConvert.DeserializeObject <SortedList <string, string> >(Bottomjsonstr); ViewBag.ModuleTypeBottomSelectList = ModuleTypeBottomSelectList; //加载广告及标识 AdTag scanCodeTag = Entity.AdTag.FirstOrDefault(o => o.Tag == "SaoBg" && o.State == 1); ViewBag.ScanCodeTag = scanCodeTag; AdTag bannerTag = Entity.AdTag.FirstOrDefault(o => o.Tag == "banner" && o.State == 1); ViewBag.BannerTag = bannerTag; if (scanCodeTag == null || bannerTag == null) { ViewBag.ErrorMsg = "无法找到广告标识"; return(View("Error")); } var scanCodeInfo = Entity.AdInfo.FirstOrNew(o => o.TId == scanCodeTag.Id && o.State == 1 && o.AgentId == this.BasicAgent.Id); ViewBag.scanCodeInfo = scanCodeInfo; var bannerInfos = Entity.AdInfo.OrderBy(o => o.Sort).Where(o => o.TId == bannerTag.Id && o.State == 1 && o.AgentId == this.BasicAgent.Id).ToList(); ViewBag.bannerInfos = bannerInfos; if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } //取得系统图标 string PhysicalApplicationPath = this.HttpContext.Request.PhysicalApplicationPath; string APPModelPath = PhysicalApplicationPath + "UpLoadFiles\\APPModule\\"; var homeDir = new System.IO.DirectoryInfo(APPModelPath + "home"); var bottomDefDir = new System.IO.DirectoryInfo(APPModelPath + "bottom\\default"); var bottomActDir = new System.IO.DirectoryInfo(APPModelPath + "bottom\\activate"); var homeFiles = homeDir.GetFiles(); var bottomDefFiles = bottomDefDir.GetFiles(); var bottomActFiles = bottomActDir.GetFiles(); ViewBag.homeFiles = homeFiles; ViewBag.bottomDefaultFiles = bottomDefFiles; ViewBag.bottomActFiles = bottomActFiles; ViewBag.SysAgent = this.BasicAgent; this.ViewBag.IsAdd = this.checkPower("Add"); this.ViewBag.IsSave = this.checkPower("Save"); this.ViewBag.IsDelete = this.checkPower("Delete"); this.ViewBag.IsEdit = this.checkPower("Edit"); return(View()); }