public ActionResult Add() { ViewBag.Data_FormatCode = Utilities.GetSelectListData(FormatCateService.GetALL(), x => x.ID, x => x.CateName, true); ViewBag.Data_PeriodCode = Utilities.GetSelectListData(PeriodCateService.GetALL(), x => x.ID, x => x.CateName, true); //ViewBag.Data_OwnerCode = Utilities.GetSelectListData(OwnerCateService.GetALL(), x => x.ID, x => x.CateName, false); return(View(new OutDoorAdminViewModel())); }
public ActionResult Index() { ViewBag.CityTree = GetCityTree(); ViewBag.MediaTree = GetMediaTree(); ViewBag.FormatCate = Utilities.GetSelectListData(FormatCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.IndustryCate = Utilities.GetSelectListData(IndustryCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.CrowdCate = Utilities.GetSelectListData(CrowdCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.PurposeCate = Utilities.GetSelectListData(PurposeCateService.GetALL(), x => x.ID, x => x.CateName, false); //var periodCate = Utilities.GetSelectListData(PeriodCateService.GetALL(), x => x.OrderIndex, x => x.CateName, false); //periodCate.RemoveAt(0); //periodCate.RemoveAt(0); //periodCate.Single(x => x.Value == "30").Selected = true; var periodCate = new List <SelectListItem>(); periodCate.Add(new SelectListItem() { Text = "月", Value = "30" }); ViewBag.PeriodCate = periodCate; //var PriceCate = new List<SelectListItem>(); //PriceCate.Add(new SelectListItem() { Text = "10万以下", Value = ((int)PriceListType.Price10Lower).ToString(), Selected = true }); //PriceCate.Add(new SelectListItem() { Text = "10~50万元", Value = ((int)PriceListType.Price50Lower).ToString() }); //PriceCate.Add(new SelectListItem() { Text = "50~100万元", Value = ((int)PriceListType.Price100Lower).ToString() }); //PriceCate.Add(new SelectListItem() { Text = "100~200万元", Value = ((int)PriceListType.Price200Lower).ToString() }); //PriceCate.Add(new SelectListItem() { Text = "200万元以上", Value = ((int)PriceListType.PriceMax).ToString() }); //ViewBag.PriceCate = PriceCate; return(View()); }
public ActionResult Add() { ViewBag.MenuItem = "media-publish"; if (!CheckMemberStatus()) { return(Redirect(Url.Action("openbiz", "reg"))); } //ViewBag.Data_CrowdCate = Utilities.GetSelectListData(CrowdCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.Data_IndustryCate = Utilities.GetSelectListData(IndustryCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.Data_PurposeCate = Utilities.GetSelectListData(PurposeCateService.GetALL(), x => x.ID, x => x.CateName, false); //ViewBag.Data_AreaCate = Utilities.GetSelectListData(AreaCateService.GetALL(), x => x.ID, x => x.CateName, false); ViewBag.Data_FormatCode = Utilities.GetSelectListData(FormatCateService.GetALL(), x => x.ID, x => x.CateName, true); ViewBag.Data_PeriodCode = Utilities.GetSelectListData(PeriodCateService.GetALL(), x => x.ID, x => x.CateName, true); //ViewBag.Data_OwnerCode = Utilities.GetSelectListData(OwnerCateService.GetALL(), x => x.ID, x => x.CateName, false); return(View(new OutDoorViewModel())); }
private List <SelectListItem> GetSelectList(int value = 0) { var list = Utilities.GetSelectListData( FormatCateService.GetALL().ToList() , item => item.ID , item => item.CateName, true).ToList(); if (value != 0) { list.Single(x => x.Value == value.ToString()).Selected = true; } return(list); }
private List <LinkGroup> GetSearch(QueryTerm queryTerm) { List <LinkGroup> result = new List <LinkGroup>(); Dictionary <string, string> cacheDic = new Dictionary <string, string>(); cacheDic.Add(CacheService.ServiceName, "ListController"); cacheDic.Add(CacheService.ServiceMethod, "GetSearch"); cacheDic.Add("City", queryTerm.City.ToString()); cacheDic.Add("MediaCode", queryTerm.MediaCode.ToString()); cacheDic.Add("FormatCode", queryTerm.FormatCode.ToString()); cacheDic.Add("OwnerCode", queryTerm.OwnerCode.ToString()); cacheDic.Add("PeriodCode", queryTerm.PeriodCode.ToString()); if (CacheService.Exists(cacheDic)) { result = CacheService.Get <List <LinkGroup> >(cacheDic); return(result); } #region CityGroup if (queryTerm.City != 0) { var city = CityCateService.Find(queryTerm.City); var prevCityGroup = new List <LinkGroup>(); GetPrevCityGroup(prevCityGroup, city, queryTerm); prevCityGroup.Reverse(); result.AddRange(prevCityGroup); GetNextCityGroup(result, city, queryTerm); } else { var city = CityCateService.Find(queryTerm.Province); GetNextCityGroup(result, city, queryTerm); } #endregion #region MediaCode if (queryTerm.MediaCode != 0) { var media = MediaCateService.Find(queryTerm.MediaCode); var prevMediaGroup = new List <LinkGroup>(); GetPrevMediaGroup(prevMediaGroup, media, queryTerm); prevMediaGroup.Reverse(); result.AddRange(prevMediaGroup); GetNextMediaGroup(result, media, queryTerm, false); } else { GetNextMediaGroup(result, null, queryTerm, true); } #endregion #region FormatCode LinkGroup formatGroup = new LinkGroup() { Group = new LinkItem() { Name = "媒体形式", Url = Url.Action("index", new { province = queryTerm.Province, city = queryTerm.City, mediacode = queryTerm.MediaCode, formatcode = 0, ownercode = queryTerm.OwnerCode, periodcode = queryTerm.PeriodCode, authstatus = queryTerm.AuthStatus, deadline = queryTerm.DeadLine, price = queryTerm.Price, order = queryTerm.Order, descending = queryTerm.Descending, page = 1 }) } }; formatGroup.Items = FormatCateService.GetALL().Where(x => x.PID.Equals(null)).ToList().Select(x => new LinkItem() { ID = x.ID, Name = x.CateName, Url = Url.Action("index", new { province = queryTerm.Province, city = queryTerm.City, mediacode = queryTerm.MediaCode, formatcode = x.ID, ownercode = queryTerm.OwnerCode, periodcode = queryTerm.PeriodCode, authstatus = queryTerm.AuthStatus, deadline = queryTerm.DeadLine, price = queryTerm.Price, order = queryTerm.Order, descending = queryTerm.Descending, page = 1 }), Selected = queryTerm.FormatCode == x.ID }).ToList(); result.Add(formatGroup); #endregion #region OwnerCode //LinkGroup ownerGroup = new LinkGroup() //{ // Group = new LinkItem() // { // Name = "代理类型", // Url = Url.Action("index", new // { // province = queryTerm.Province, // city = queryTerm.City, // mediacode = queryTerm.MediaCode, // formatcode = queryTerm.FormatCode, // ownercode = 0, // periodcode = queryTerm.PeriodCode, // authstatus = queryTerm.AuthStatus, // deadline = queryTerm.DeadLine, // price = queryTerm.Price, // order = queryTerm.Order, // descending = queryTerm.Descending, // page = 1 // }) // } //}; //ownerGroup.Items = OwnerCateService.GetALL().Where(x => x.PID.Equals(null)).ToList().Select(x => new LinkItem() //{ // ID = x.ID, // Name = x.CateName, // Url = Url.Action("index", new // { // province = queryTerm.Province, // city = queryTerm.City, // mediacode = queryTerm.MediaCode, // formatcode = queryTerm.FormatCode, // ownercode = x.ID, // periodcode = queryTerm.PeriodCode, // authstatus = queryTerm.AuthStatus, // deadline = queryTerm.DeadLine, // price = queryTerm.Price, // order = queryTerm.Order, // descending = queryTerm.Descending, // page = 1 // }), // Selected = queryTerm.OwnerCode == x.ID //}).ToList(); //result.Add(ownerGroup); #endregion #region PeriodCode //LinkGroup periodGroup = new LinkGroup() //{ // Group = new LinkItem() // { // Name = "最短投放周期", // Url = Url.Action("index", new // { // province = queryTerm.Province, // city = queryTerm.City, // mediacode = queryTerm.MediaCode, // formatcode = queryTerm.FormatCode, // ownercode = queryTerm.OwnerCode, // authstatus = queryTerm.AuthStatus, // deadline = queryTerm.DeadLine, // price = queryTerm.Price, // order = queryTerm.Order, // descending = queryTerm.Descending, // page = 1 // }) // } //}; //periodGroup.Items = PeriodCateService.GetALL().Where(x => x.PID.Equals(null)).ToList().Select(x => new LinkItem() //{ // ID = x.ID, // Name = x.CateName, // Url = Url.Action("index", new // { // province = queryTerm.Province, // city = queryTerm.City, // mediacode = queryTerm.MediaCode, // formatcode = queryTerm.FormatCode, // ownercode = queryTerm.OwnerCode, // periodcode = x.ID, // authstatus = queryTerm.AuthStatus, // deadline = queryTerm.DeadLine, // price = queryTerm.Price, // order = queryTerm.Order, // descending = queryTerm.Descending, // page = 1 // }), // Selected = queryTerm.PeriodCode == x.ID //}).ToList(); //result.Add(periodGroup); #endregion CacheService.Add <List <LinkGroup> >(result, cacheDic, 180); return(result); }