Пример #1
0
 public ActionResult EmployeeList(int? currentPage)
 {
     EmployeeListModel model = new EmployeeListModel
                                   {
                                       CurrentPage = currentPage.HasValue?
                                                     currentPage.Value:1,
                                   };
     EmployeeBl.GetEmployeeListModel(model);
     return View(model);
 }
Пример #2
0
 public ActionResult EmployeeList(EmployeeListModel model)
 {
     EmployeeBl.GetEmployeeListModel(model);
     return View(model);
 }
Пример #3
0
 public void GetEmployeeListModel(EmployeeListModel model)
 {
     int managerId = AuthenticationService.CurrentUser.Id;
     UserRole managerRole = AuthenticationService.CurrentUser.UserRole;
     int? roleId = new int?();
     if ((managerRole & UserRole.Admin) == UserRole.Admin)
     {
         roleId = model.RoleId;
         model.Roles = GetRoleList();
         model.IsRolesVisible = true;
         model.IsUserNameVisible = true;
         model.IsLinkToUser = true;
     }
     else
     {
         if ((managerRole & UserRole.OutsourcingManager) == UserRole.OutsourcingManager || (managerRole & UserRole.Estimator) == UserRole.Estimator)
             model.IsUserNameVisible = true;
         model.Roles = new List<IdNameDto>();
     }
     int numberOfPages;
     int currentPage = model.CurrentPage;
     model.Employees = UserDao.GetUsersForManager(model.UserName, managerId,
         managerRole, roleId, ref currentPage, out numberOfPages).ToList().
         ConvertAll(x => new EmployeeDtoModel
                             {
                                 Code = x.Code,
                                 Id = x.Id,
                                 Name = x.Name,
                             });
     model.NumberOfPages = numberOfPages;
     model.CurrentPage = currentPage;
 }