private void SetResignTypeList(int?type, bool allowBlank = true) { IResignTypeService cs = new ResignTypeService(Settings.Default.db); ResignTypeSearchModel csm = new ResignTypeSearchModel(); List <ResignType> certType = cs.Search(csm).ToList(); List <SelectListItem> select = new List <SelectListItem>(); if (allowBlank) { select.Add(new SelectListItem { Text = "", Value = "" }); } foreach (var certt in certType) { if (type.HasValue && type.ToString().Equals(certt.id)) { select.Add(new SelectListItem { Text = certt.name, Value = certt.id.ToString(), Selected = true }); } else { select.Add(new SelectListItem { Text = certt.name, Value = certt.id.ToString(), Selected = false }); } } ViewData["resignTypeList"] = select; }
public IQueryable <ResignType> Search(ResignTypeSearchModel searchModel) { IQueryable <ResignType> resignTypes = this.context.ResignType; if (!string.IsNullOrEmpty(searchModel.Name)) { resignTypes = resignTypes.Where(c => c.name.Contains(searchModel.Name.Trim())); } return(resignTypes); }
public ResignTypeInfoModel GetResignTypeInfo(ResignTypeSearchModel searchModel) { ResignTypeInfoModel info = new ResignTypeInfoModel(); DataContext dc = new DataContext(this.DbString); IResignTypeRepository resignTypeRep = new ResignTypeRepository(dc); IQueryable <ResignType> resignTypes = resignTypeRep.Search(searchModel); info.resignTypeCount = dc.Context.GetTable <ResignType>().Where(c => c.id.Equals(resignTypes.Count() > 0 ? resignTypes.First().id : -1)).Count(); return(info); }
public ActionResult Search([Bind(Include = "Name")] ResignTypeSearchModel q) { int pageIndex = 0; int.TryParse(Request.QueryString.Get("page"), out pageIndex); pageIndex = PagingHelper.GetPageIndex(pageIndex); IResignTypeService ss = new ResignTypeService(Settings.Default.db); IPagedList <ResignType> resignTypes = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; return(View("Index", resignTypes)); }
public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); ResignTypeSearchModel q = new ResignTypeSearchModel(); IResignTypeService ss = new ResignTypeService(Settings.Default.db); IPagedList <ResignType> resignTypes = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; ResignTypeInfoModel info = ss.GetResignTypeInfo(q); ViewBag.Info = info; return(View(resignTypes)); }
public IQueryable <ResignType> Search(ResignTypeSearchModel searchModel) { return(resignTypeRep.Search(searchModel)); }