Esempio n. 1
0
        public ActionResult ViewAllWorkers(string searchName, string orderBy, string roleSpec, string depID, string viewType)
        {
            ViewBag.Supervisor = User.IsInRole("Supervisor");

            var data = _data.Worker.AllWorkers();

            data = SortingAndFilteringData.SortAndFilterWorkers(searchName, orderBy, roleSpec, depID, data);

            if (User.IsInRole("Supervisor"))
            {
                var user = _data.ApplicationUser.FindUserByID(User.Identity.GetUserId());
                data = FilteringServices.FilterWorkersPerDepartment(user.Worker.DepartmentID, data);
            }

            ViewBag.SortOptions = _fillViewBag.WorkerSortingOptionsViewBag();

            ViewBag.RoleOptions = _fillViewBag.AvailableRolesFilteringViewBag();

            ViewBag.DepartmentOptions = _fillViewBag.AvailableDepartmentsFilteringViewBag();

            ViewBag.Names = _fillViewBag.GetWorkerNamesForAutocomplete(data);

            ViewBag.Parameters = new List <string> {
                searchName, orderBy, roleSpec, depID
            };

            if (string.IsNullOrEmpty(viewType))
            {
                return(View(data));
            }
            else
            {
                return(View("ViewAllWorkersList", data));
            }
        }
        public ActionResult Index(string searchName, string orderBy, string status)
        {
            var data = _data.Worker.AllWorkers();

            data = SortingAndFilteringData.SortAndFilteringPayments(searchName, orderBy, data);


            data = FilteringServices.PaymentStatus(status, data);


            ViewBag.PaymentStatus = _fillViewBag.PayStatusSortOptionsViewBag();

            ViewBag.SortSalary = _fillViewBag.SalarySortingOptionsViewBag();

            ViewBag.Names = _fillViewBag.GetWorkerNamesForAutocomplete(data);

            return(View(data));
        }