private void UpdateGridUserData() { var totalRow = 0; var page = userGrid.Pager; var sort = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "FullName" : page.Sidx, page.Sord == "asc"); var model = userGrid.SearchCriteria ?? new UsersModel(); var user = UsersServices1.GetQuery(x => (string.IsNullOrEmpty(model.UserName) || x.UserName.Contains(model.UserName)) && (string.IsNullOrEmpty(model.FullName) || x.FullName.Contains(model.FullName)) && (string.IsNullOrEmpty(model.RoleName) || x.RoleName == model.RoleName)); user = user.OrderBy(sort); totalRow = user.Count(); userGrid.Pager.Init(totalRow); if (totalRow == 0) { userGrid.Data = new List <UsersModel>(); return; } var list = UsersServices1.GetListPager(user, page.CurrentPage, page.PageSize); var listUserModel = list.Select(u => UsersServicesImpl.ConvertModel(u)).ToList(); userGrid.Data = listUserModel; }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); User1 = (User)Session[AccountController.USER_SESSION_ID]; UsersServices1 = new UsersServicesImpl(); ViewData["Companies"] = new SelectList(UsersServices1.getAllCompany(), "Id", "CompanyName"); ViewData["AllCompanies"] = UsersServices1.getAllCompany(); ViewData["Departments"] = new SelectList(UsersServices1.GetAllDepartmentActive(CurrenUser, true), "Id", "DeptName"); ViewData["Positions"] = Positions; ViewData["PositionsAll"] = PositionsAll; ViewData["Functions"] = Functions; ViewData["Levels"] = Levels; ViewData["SaleTypesEnum"] = SaleTypes; }
protected override void Initialize(RequestContext requestContext) { UsersService1 = new UsersServicesImpl(); newsServices = new NewsServices(); base.Initialize(requestContext); }