public ActionResult GetList() { using (ISectionBarService server = GetService <ISectionBarService>()) { Expression <Func <VD_SectionBar, bool> > where = null; if (!Request.QueryString["keyword"].IsEmpty()) { var qs = JsonHelper.ToObject <List <QuickSearch> >(Request.QueryString["keyword"]); var props = typeof(VD_SectionBar).GetPropertiesEx(); foreach (var q in qs) { if (!q.SearchValue.IsEmpty()) { var p = props.FirstOrDefault(w => w.Name == q.FieldName); if (p != null) { switch (p.Name) { case "Code": where = where.And(w => w.Code.Contains(q.SearchValue)); break; case "Name": where = where.And(w => w.Name.Contains(q.SearchValue)); break; case "CustomerCode": where = where.And(w => w.CustomerCode.Contains(q.SearchValue)); break; default: break; } } } } } var pageinfo = new PageInfo() { PageIndex = Request.QueryString["page"].IsEmpty() ? 1 : int.Parse(Request.QueryString["page"]), PageSize = Request.QueryString["limit"].IsEmpty() ? 20 : int.Parse(Request.QueryString["limit"]) }; var list = server.GetList(where, ref pageinfo); return(JsonNet(CreateJsonData_DataTable(pageinfo.RowCount, list))); // return JsonNet(CreateJsonData_DataGrid(pageinfo.RowCount, list)); } }
public SectionBarController(ISectionBarService sectionBarService, IMapper mapper) { this.sectionBarService = sectionBarService; this.Mapper = mapper; }