Exemplo n.º 1
0
        private PagedList<Department> QueryListData(DepartmentSearch searchModel)
        {
            int recordCount = 0;
            int pageSize = ConstantManager.PageSize;
            DepartmentService service = new DepartmentService();

            string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending";

            IList<Department> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount);

            var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel);
            return new PagedList<Department>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition);
        }
Exemplo n.º 2
0
 private void LoadSearchViewBag(DepartmentSearch searchModel)
 {
     #region sort
     ViewBag.IsAsc = !searchModel.IsAsc;
     ViewBag.SortBy = searchModel.SortBy;
     #endregion
         var orgchartService = new OrgChartService();
         if (!searchModel.OrgChartId.HasValue)
         {
             ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name");
         }
         else
         {
             ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId);
         }
 }
Exemplo n.º 3
0
 public ActionResult SearchListPartialView(DepartmentSearch searchModel)
 {
     #region sort
     ViewBag.IsAsc = !searchModel.IsAsc;
     ViewBag.SortBy = searchModel.SortBy;
     #endregion
     return PartialView("SearchListPartialView",this.QueryListData(searchModel));
 }
Exemplo n.º 4
0
        private Expression<Func<Department, bool>> GetSearchFilter(DepartmentSearch searchModel)
        {
            Expression<Func<Department, bool>> filter = p => p.IsActive=="1" ;
                 if (searchModel.OrgChartId.HasValue)
                 {
                    filter = filter.And(q => q.OrgChartId == searchModel.OrgChartId.Value);
                 }

            return filter;
        }
Exemplo n.º 5
0
 //
 // GET: /Department/
 //[PermissionFilter]
 public ViewResult Index(DepartmentSearch searchModel)
 {
     this.LoadSearchViewBag(searchModel);
     return View(this.QueryListData(searchModel));
 }