Пример #1
0
        public ActionResult ResignedSearch()
        {
            if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail()))
            {
                var accessLevel = _rolesManager.IdentifyRole();
                if (accessLevel == "FullAccess" || accessLevel == "FullView")
                {
                    ViewBag.Access          = accessLevel;
                    TempData["AccessLevel"] = accessLevel;
                    ViewBag.ProfilePic      = _rolesManager.LoggedInEmployee.Profile.ProfilePic;
                    TempData["ProfilePic"]  = _rolesManager.LoggedInEmployee.Profile.ProfilePic;

                    var searchpackage = new ResignedViewModel()
                    {
                        MovementsList = _employeeDataAccess.GetAllMovements()
                    };
                    return(View(searchpackage));
                }

                ViewBag.ErrorMsg = "You are not authorized to view this page.";
                return(View("Error"));
            }

            ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong.";
            return(View("Error"));
        }
Пример #2
0
        public List <Employee> SearchResignedEmployees(ResignedViewModel resignedSearchViewModel)
        {
            var resignedList = _employeeDataAccess.GetResignedEmployees();

            if (resignedSearchViewModel.Attrition != 0 && resignedSearchViewModel.Attrition != null)
            {
                var emps = _employeeDataAccess.GetResignedEmployeesByAttrition((Attrition)resignedSearchViewModel.Attrition);
                resignedList = resignedList.Intersect(emps).ToList();
            }
            if (resignedSearchViewModel.StartingResignationDate != null)
            {
                if (resignedSearchViewModel.EndingResignationDate == null)
                {
                    resignedSearchViewModel.EndingResignationDate = DateTime.Now;
                }
                var emps = _employeeDataAccess.GetEmployeesByResignationDateInterval(
                    (DateTime)resignedSearchViewModel.StartingResignationDate,
                    (DateTime)resignedSearchViewModel.EndingResignationDate);

                resignedList = resignedList.Intersect(emps).ToList();
            }
            if (resignedSearchViewModel.Movement != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => resignedSearchViewModel.Movement.Any(condition => employee.Movement == condition)).ToList();
                resignedList = resignedList.Intersect(emps).ToList();
            }

            return(resignedList);
        }
Пример #3
0
        public ActionResult ResignedSearchResults(ResignedViewModel resignedSearchViewModel)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Access     = TempData["AccessLevel"].ToString();
                ViewBag.ProfilePic = TempData["ProfilePic"].ToString();

                var resignedEmployees = SearchResignedEmployees(resignedSearchViewModel);
                return(View(resignedEmployees));
            }

            ViewBag.ErrorMsg   = "Failed to search. Check the correctness of your input format";
            ViewBag.Access     = TempData["AccessLevel"].ToString();
            ViewBag.ProfilePic = TempData["ProfilePic"].ToString();
            return(View("ErrorPartial"));
        }