Ejemplo n.º 1
0
        public IActionResult GetReqSummary()
        {
            Employee emp;
            RequisitionSummaryViewModel srViewModel = new RequisitionSummaryViewModel();

            /* emp = JsonConvert.DeserializeObject<Employee>(HttpContext.Session.GetString("employee")) as Employee;
             * srViewModel.employee = emp;*/
            emp = eservice.GetEmployeeById(6);  //hard-coded id for test

            if (emp.EmployeeType.EmployeeTypeName == "Store Manager" || emp.EmployeeType.EmployeeTypeName == "Department Head")
            {
                List <RequisitionForm> rfListPending   = rpService.FindPendingRequisitionsByEmployeeAsHead(emp.Department);
                List <RequisitionForm> rfListProcessed = rpService.FindRequisitionsInDept(emp.Department);
                srViewModel.rfListPending   = rfListPending;
                srViewModel.rfListProcessed = rfListProcessed;
            }
            else
            {
                List <RequisitionForm> rfListPending   = rpService.FindPendingRequisitionsByEmployee(emp);
                List <RequisitionForm> rfListProcessed = rpService.FindRequisitionsOtherThanSubmittedByEmployee(emp);
                srViewModel.rfListPending   = rfListPending;
                srViewModel.rfListProcessed = rfListProcessed;
            }
            return(Ok(srViewModel));
        }
        public IActionResult GetReqSummary(string Username)
        {
            Employee emp;
            RequisitionSummaryViewModel srViewModel = new RequisitionSummaryViewModel();

            emp = eservice.GetEmployee(Username);

            srViewModel.employee = emp;
            if (emp.EmployeeType.EmployeeTypeName == "Department Head" || emp.EmployeeType.EmployeeTypeName == "Department Representative")
            {
                srViewModel.rfListPending   = rpservice.FindPendingRequisitionsByEmployeeAsHead(emp.Department);
                srViewModel.rfListProcessed = rpservice.FindRequisitionsInDept(emp.Department);
            }
            else
            {
                srViewModel.rfListPending   = rpservice.FindPendingRequisitionsByEmployee(emp);
                srViewModel.rfListProcessed = rpservice.FindRequisitionsOtherThanSubmittedByEmployee(emp);
            }
            return(Ok(srViewModel));
        }
        public IActionResult Summary()
        {
            RequisitionSummaryViewModel srViewModel = new RequisitionSummaryViewModel();

            emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee;
            srViewModel.employee = emp;

            if (emp.EmployeeType.EmployeeTypeName == "Department Head" || emp.EmployeeType.EmployeeTypeName == "Department Representative")
            {
                srViewModel.rfListPending   = rpService.FindPendingRequisitionsByEmployeeAsHead(emp.Department);
                srViewModel.rfListProcessed = rpService.FindRequisitionsInDept(emp.Department);
            }
            else
            {
                srViewModel.rfListPending   = rpService.FindPendingRequisitionsByEmployee(emp);
                srViewModel.rfListProcessed = rpService.FindRequisitionsOtherThanSubmittedByEmployee(emp);
            }

            return(View("RequisitionFormSummary", srViewModel));
        }