public ActionResult Index(FormCollection collection, int p = 0) { MenuModel.MeunOrderbyTypeEnum _MeunOrderbyTypeEnum = (MenuModel.MeunOrderbyTypeEnum)Enum.Parse(typeof(MenuModel.MeunOrderbyTypeEnum), collection["Sort"], true); List <AuthorsModel> AuthorsModelList = AuthorsModel.GetAuthorList(collection["AuthorsCName"], p + 1, take, _MeunOrderbyTypeEnum); if (AuthorsModelList.Count == (take + 1)) { ViewBag.pn = p + 1; AuthorsModelList.RemoveAt(take); } else { ViewBag.pn = 0; } ViewBag.pi = p; ViewBag.pt = take.ToString(); setSortDropDown(_MeunOrderbyTypeEnum); return(View(AuthorsModelList)); }
// GET: Author public ActionResult Index(int p = 0) { List <AuthorsModel> AuthorsModelList = AuthorsModel.GetAuthorList("", p + 1, take); //多取一,若有表示有下一頁 if (AuthorsModelList.Count == (take + 1)) { ViewBag.pn = p + 1; AuthorsModelList.RemoveAt(take); } else { ViewBag.pn = 0; } ViewBag.pi = p; ViewBag.pt = take.ToString(); setSortDropDown(); return(View(AuthorsModelList)); }
private void CreateSelect() { MenuModel mm = new MenuModel(); List <SelectListItem> WorksAuthors = new List <SelectListItem>(); var _WorksAuthors = AuthorsModel.GetAuthorList(); for (int i = 0; i < _WorksAuthors.Count; i++) { WorksAuthors.Add(new SelectListItem() { Text = _WorksAuthors[i].AuthorsCName, Value = _WorksAuthors[i].AuthorsNo.ToString() }); } ViewBag.WorksAuthors = WorksAuthors; List <SelectListItem> WorksModuleList = new List <SelectListItem>(); var _WorksModuleList = mm.GetMenu(MenuModel.MenuClassEnum.Material); for (int i = 0; i < _WorksModuleList.Count; i++) { WorksModuleList.Add(new SelectListItem() { Text = _WorksModuleList[i].MenuName, Value = _WorksModuleList[i].MenuID.ToString() }); } ViewBag.WorksModuleList = WorksModuleList; List <SelectListItem> WorksPropGenreList = new List <SelectListItem>(); var _WorksPropGenreList = mm.GetMenu(MenuModel.MenuClassEnum.Genre); for (int i = 0; i < _WorksPropGenreList.Count; i++) { WorksPropGenreList.Add(new SelectListItem() { Text = _WorksPropGenreList[i].MenuName, Value = _WorksPropGenreList[i].MenuID.ToString() }); } ViewBag.WorksPropGenreList = WorksPropGenreList; List <SelectListItem> WorksPropOwnerList = new List <SelectListItem>(); var _WorksPropOwnerList = mm.GetMenu(MenuModel.MenuClassEnum.Owner); for (int i = 0; i < _WorksPropOwnerList.Count; i++) { WorksPropOwnerList.Add(new SelectListItem() { Text = _WorksPropOwnerList[i].MenuName, Value = _WorksPropOwnerList[i].MenuID.ToString() }); } ViewBag.WorksPropOwnerList = WorksPropOwnerList; List <SelectListItem> WorksPropStyleList = new List <SelectListItem>(); var _WorksPropStyleList = mm.GetMenu(MenuModel.MenuClassEnum.Style); for (int i = 0; i < _WorksPropStyleList.Count; i++) { WorksPropStyleList.Add(new SelectListItem() { Text = _WorksPropStyleList[i].MenuName, Value = _WorksPropStyleList[i].MenuID.ToString() }); } ViewBag.WorksPropStyleList = WorksPropStyleList; List <SelectListItem> WorksPropWareTypeList = new List <SelectListItem>(); var _WorksPropWareTypeList = mm.GetMenu(MenuModel.MenuClassEnum.WareType); for (int i = 0; i < _WorksPropWareTypeList.Count; i++) { WorksPropWareTypeList.Add(new SelectListItem() { Text = _WorksPropWareTypeList[i].MenuName, Value = _WorksPropWareTypeList[i].MenuID.ToString() }); } ViewBag.WorksPropWareTypeList = WorksPropWareTypeList; ViewBag.GradedNoList = new List <SelectListItem>(); List <SelectListItem> WorksCountNounList = new List <SelectListItem>(); var _WorksCountNounList = mm.GetMenu(MenuModel.MenuClassEnum.CountNoun); for (int i = 0; i < _WorksCountNounList.Count; i++) { WorksCountNounList.Add(new SelectListItem() { Text = _WorksCountNounList[i].MenuName, Value = _WorksCountNounList[i].MenuID.ToString() }); } ViewBag.WorksCountNounList = WorksCountNounList; }
// GET: Works public ActionResult Index(int p = 0, string artlist = "", string name = "", string mip = "", string mxp = "", string sort = "") { List <WorksViewModel> model = new List <WorksViewModel>(); ViewBag.OrderbyType = ""; ViewBag.WorksName = ""; ViewBag.AuthorNoList = ""; ViewBag.MinePrice = ""; ViewBag.MaxPrice = ""; WorksSearchModel value = new WorksSearchModel(); value.OrderbyType = MenuModel.WorkOrderbyTypeEnum.作品起始年代大至小; if (!string.IsNullOrEmpty(artlist)) { value.AuthorNoList = artlist.Split(',').ToList(); ViewBag.AuthorNoList = artlist; } if (!string.IsNullOrEmpty(name)) { value.WorksName = name; ViewBag.WorksName = name; } if (!string.IsNullOrEmpty(mip)) { value.MinePrice = Convert.ToInt32(mip); ViewBag.MinePrice = mip; } if (!string.IsNullOrEmpty(mxp)) { value.MaxPrice = Convert.ToInt32(mxp); ViewBag.MaxPrice = mxp; } if (!string.IsNullOrEmpty(sort)) { MenuModel.WorkOrderbyTypeEnum _MeunOrderbyTypeEnum = (MenuModel.WorkOrderbyTypeEnum)Enum.Parse(typeof(MenuModel.WorkOrderbyTypeEnum), sort, true); value.OrderbyType = _MeunOrderbyTypeEnum; ViewBag.OrderbyType = sort; } var _value = value.Search(p + 1, take); //多取一,若有表示有下一頁 if (_value.Count == (take + 1)) { ViewBag.pn = p + 1; _value.RemoveAt(take); } else { ViewBag.pn = 0; } ViewBag.pi = p; for (int i = 0; i < _value.Count; i++) { model.Add(new WorksViewModel() { WorksNo = _value[i].WorksNo, WorksName = _value[i].WorksName, AuthorsName = _value[i].AuthorsName, YearStart = _value[i].YearStart, YearEnd = _value[i].YearEnd, Cost = _value[i].Cost, Price = _value[i].Price, CreateUser = _value[i].CreateUser, Material = _value[i].MaterialsName }); } MenuModel mm = new MenuModel(); List <SelectListItem> WorksAuthors = new List <SelectListItem>(); var _WorksAuthors = AuthorsModel.GetAuthorList(); for (int i = 0; i < _WorksAuthors.Count; i++) { WorksAuthors.Add(new SelectListItem() { Text = _WorksAuthors[i].AuthorsCName, Value = _WorksAuthors[i].AuthorsNo.ToString() }); } ViewBag.WorksAuthors = WorksAuthors; var MeunOrderList = new Dictionary <string, string>(); foreach (var item in Enum.GetValues(typeof(MenuModel.WorkOrderbyTypeEnum))) { MeunOrderList.Add(item.ToString(), item.ToString()); } ViewBag.MeunOrderList = new SelectList(MeunOrderList, "Key", "Value", ViewBag.OrderbyType); ViewBag.pt = take.ToString(); return(View(model)); }
public ActionResult Index(FormCollection collection, int p = 0) { List <WorksViewModel> model = new List <WorksViewModel>(); MenuModel.WorkOrderbyTypeEnum _MeunOrderbyTypeEnum = (MenuModel.WorkOrderbyTypeEnum)Enum.Parse(typeof(MenuModel.WorkOrderbyTypeEnum), collection["Sort"], true); WorksSearchModel value = new WorksSearchModel() { WorksName = collection["WorksName"], OrderbyType = _MeunOrderbyTypeEnum }; ViewBag.OrderbyType = ""; if (!string.IsNullOrEmpty(collection["Sort"])) { ViewBag.OrderbyType = collection["Sort"]; } ViewBag.WorksName = ""; if (!string.IsNullOrEmpty(collection["WorksName"])) { ViewBag.WorksName = collection["WorksName"].ToString(); } ViewBag.AuthorNoList = ""; if (!string.IsNullOrEmpty(collection["AuthorNoList"])) { value.AuthorNoList = collection["AuthorNoList"].Split(',').ToList(); ViewBag.AuthorNoList = collection["AuthorNoList"].ToString(); } ViewBag.MinePrice = ""; if (!string.IsNullOrEmpty(collection["MinePrice"])) { value.MinePrice = Convert.ToInt32(collection["MinePrice"]); ViewBag.MinePrice = value.MinePrice.ToString(); } ViewBag.MaxPrice = ""; if (!string.IsNullOrEmpty(collection["MaxPrice"])) { value.MaxPrice = Convert.ToInt32(collection["MaxPrice"]); ViewBag.MaxPrice = value.MaxPrice.ToString(); } var _value = value.Search(1, take); //多取一,若有表示有下一頁 if (_value.Count == (take + 1)) { ViewBag.pn = 1; _value.RemoveAt(take); } else { ViewBag.pn = 0; } ViewBag.pi = 0; for (int i = 0; i < _value.Count; i++) { model.Add(new WorksViewModel() { WorksNo = _value[i].WorksNo, WorksName = _value[i].WorksName, AuthorsName = _value[i].AuthorsName, YearStart = _value[i].YearStart, YearEnd = _value[i].YearEnd, Cost = _value[i].Cost, Price = _value[i].Price, Material = _value[i].MaterialsName }); } MenuModel mm = new MenuModel(); List <SelectListItem> WorksAuthors = new List <SelectListItem>(); var _WorksAuthors = AuthorsModel.GetAuthorList(); for (int i = 0; i < _WorksAuthors.Count; i++) { WorksAuthors.Add(new SelectListItem() { Text = _WorksAuthors[i].AuthorsCName, Value = _WorksAuthors[i].AuthorsNo.ToString() }); } ViewBag.WorksAuthors = WorksAuthors; var MeunOrderList = new Dictionary <string, string>(); foreach (var item in Enum.GetValues(typeof(MenuModel.WorkOrderbyTypeEnum))) { MeunOrderList.Add(item.ToString(), item.ToString()); } ViewBag.MeunOrderList = new SelectList(MeunOrderList, "Key", "Value", ViewBag.OrderbyType); //setSortDropDown(_MeunOrderbyTypeEnum); ViewBag.pt = take.ToString(); return(View(model)); }
public ActionResult Filter(string id = "") { AdSearchViewModel model = new AdSearchViewModel(); if (!string.IsNullOrEmpty(id)) { var value = PackagesModel.GetPackageDetail(id); model = JsonConvert.DeserializeObject <AdSearchViewModel>(value.SearchJson); if (model != null) { model.Budget = value.Budget; model.PG_Name = value.PackagesName; model.PG_No = value.PackagesNo; } else { model = new AdSearchViewModel(); } } MenuModel mm = new MenuModel(); List <SelectListItem> Authorsitems = new List <SelectListItem>(); var _AuthorNoList = AuthorsModel.GetAuthorList(); for (int i = 0; i < _AuthorNoList.Count; i++) { Authorsitems.Add(new SelectListItem() { Text = _AuthorNoList[i].AuthorsCName, Value = _AuthorNoList[i].AuthorsNo.ToString() }); } ViewBag.AuthorNoList = Authorsitems; List <SelectListItem> WorksStyleitems = new List <SelectListItem>(); var _WorksStyleList = mm.GetMenu(MenuModel.MenuClassEnum.Style); for (int i = 0; i < _WorksStyleList.Count; i++) { WorksStyleitems.Add(new SelectListItem() { Text = _WorksStyleList[i].MenuName, Value = _WorksStyleList[i].MenuID.ToString() }); } ViewBag.StyleNoList = WorksStyleitems; List <SelectListItem> WorksGenreitems = new List <SelectListItem>(); var _WorksGenreList = mm.GetMenu(MenuModel.MenuClassEnum.Genre); for (int i = 0; i < _WorksGenreList.Count; i++) { WorksGenreitems.Add(new SelectListItem() { Text = _WorksGenreList[i].MenuName, Value = _WorksGenreList[i].MenuID.ToString() }); } ViewBag.GenreNoList = WorksGenreitems; ViewBag.GradedNoList = new List <SelectListItem>(); return(View(model)); }