public IActionResult GetCountById(int id) { DashboardViewModel dVModel = new DashboardViewModel(); Employee empCheck = empService.GetEmployeeById(id); dVModel.emp = empCheck; if (empCheck.Department.DepartmentName != "Store") { dVModel.deptRep = empService.FindEmployeeWhoIsDeptRep(empCheck.Department); } dVModel.cpList = cpService.GetCPList(); if (empCheck.EmployeeType.EmployeeTypeName == "Employee" || empCheck.EmployeeType.EmployeeTypeName == "Department Representative") { dVModel.TotalRFSubmitted = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.Submitted); dVModel.TotalRFApproved = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.Approved); dVModel.TotalRFRejected = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.Rejected); dVModel.TotalRFNotCompleted = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.NotCompleted); dVModel.TotalRFCompleted = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.Completed); dVModel.TotalRFOngoing = dashservice.TotalRFNosByEmployee(empCheck, RFStatus.Ongoing); } if (empCheck.EmployeeType.EmployeeTypeName == "Department Representative") { dVModel.TotalDFCreated = dashservice.TotalDFNosByDept(empCheck, DFStatus.Created); dVModel.TotalDFPendingAssignment = dashservice.TotalDFNosByDept(empCheck, DFStatus.PendingAssignment); dVModel.TotalDFPendingDelivery = dashservice.TotalDFNosByDept(empCheck, DFStatus.PendingDelivery); dVModel.TotalDFCompleted = dashservice.TotalDFNosByDept(empCheck, DFStatus.Completed); } if (empCheck.EmployeeType.EmployeeTypeName == "Department Head" || empCheck.TempDeptHeadType != null) { dVModel.TotalRFSubmittedDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.Submitted); dVModel.TotalRFApprovedDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.Approved); dVModel.TotalRFRejectedDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.Rejected); dVModel.TotalRFNotCompletedDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.NotCompleted); dVModel.TotalRFCompletedDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.Completed); dVModel.TotalRFOngoingDept = dashservice.TotalRFNosByDept(empCheck, RFStatus.Ongoing); } if (empCheck.EmployeeType.EmployeeTypeName == "Store Clerk" || empCheck.EmployeeType.EmployeeTypeName == "Store Supervisor" || empCheck.EmployeeType.EmployeeTypeName == "Store Manager") { dVModel.TotalRFApproved = dashservice.TotalRFNos(empCheck, RFStatus.Approved); dVModel.TotalRFNotCompleted = dashservice.TotalRFNos(empCheck, RFStatus.NotCompleted); dVModel.TotalSROpen = dashservice.TotalSRNos(empCheck, SRStatus.Open); dVModel.TotalSRPendingAssignment = dashservice.TotalSRNos(empCheck, SRStatus.PendingAssignment); dVModel.TotalSRAssigned = dashservice.TotalSRNos(empCheck, SRStatus.Assigned); dVModel.TotalDFCreated = dashservice.TotalDFNos(empCheck, DFStatus.Created); dVModel.TotalDFPendingAssignment = dashservice.TotalDFNos(empCheck, DFStatus.PendingAssignment); dVModel.TotalDFPendingDelivery = dashservice.TotalDFNos(empCheck, DFStatus.PendingDelivery); dVModel.TotalDFCompleted = dashservice.TotalDFNos(empCheck, DFStatus.Completed); } if (empCheck.EmployeeType.EmployeeTypeName == "Store Supervisor" || empCheck.EmployeeType.EmployeeTypeName == "Store Manager") { dVModel.TotalITPendingApproval = dashservice.TotalITNos(empCheck, ITStatus.PendingApproval); dVModel.TotalITApproved = dashservice.TotalITNos(empCheck, ITStatus.Approved); } return(Ok(dVModel)); }
public IActionResult Dashboard() { DashboardViewModel dVModel = new DashboardViewModel(); empCheck = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee; dVModel.emp = empCheck; if (empCheck.Department.DepartmentName != "Store") { dVModel.deptRep = empService.FindEmployeeWhoIsDeptRep(empCheck.Department); } dVModel.cpList = cpService.GetCPList(); if (empCheck.EmployeeType.EmployeeTypeName == "Employee" || empCheck.EmployeeType.EmployeeTypeName == "Department Representative") { dVModel.TotalRFSubmitted = dashService.TotalRFNosByEmployee(empCheck, RFStatus.Submitted); dVModel.TotalRFApproved = dashService.TotalRFNosByEmployee(empCheck, RFStatus.Approved); dVModel.TotalRFRejected = dashService.TotalRFNosByEmployee(empCheck, RFStatus.Rejected); dVModel.TotalRFNotCompleted = dashService.TotalRFNosByEmployee(empCheck, RFStatus.NotCompleted); dVModel.TotalRFCompleted = dashService.TotalRFNosByEmployee(empCheck, RFStatus.Completed); dVModel.TotalRFOngoing = dashService.TotalRFNosByEmployee(empCheck, RFStatus.Ongoing); } if (empCheck.EmployeeType.EmployeeTypeName == "Department Representative") { dVModel.TotalDFCreated = dashService.TotalDFNosByDept(empCheck, DFStatus.Created); dVModel.TotalDFPendingAssignment = dashService.TotalDFNosByDept(empCheck, DFStatus.PendingAssignment); dVModel.TotalDFPendingDelivery = dashService.TotalDFNosByDept(empCheck, DFStatus.PendingDelivery); dVModel.TotalDFCompleted = dashService.TotalDFNosByDept(empCheck, DFStatus.Completed); } if (empCheck.EmployeeType.EmployeeTypeName == "Department Head" || empCheck.TempDeptHeadType != null) { dVModel.TotalRFSubmittedDept = dashService.TotalRFNosByDept(empCheck, RFStatus.Submitted); dVModel.TotalRFApprovedDept = dashService.TotalRFNosByDept(empCheck, RFStatus.Approved); dVModel.TotalRFRejectedDept = dashService.TotalRFNosByDept(empCheck, RFStatus.Rejected); dVModel.TotalRFNotCompletedDept = dashService.TotalRFNosByDept(empCheck, RFStatus.NotCompleted); dVModel.TotalRFCompletedDept = dashService.TotalRFNosByDept(empCheck, RFStatus.Completed); dVModel.TotalRFOngoingDept = dashService.TotalRFNosByDept(empCheck, RFStatus.Ongoing); } if (empCheck.EmployeeType.EmployeeTypeName == "Store Clerk" || empCheck.EmployeeType.EmployeeTypeName == "Store Supervisor" || empCheck.EmployeeType.EmployeeTypeName == "Store Manager") { dVModel.TotalRFApproved = dashService.TotalRFNos(empCheck, RFStatus.Approved); dVModel.TotalRFNotCompleted = dashService.TotalRFNos(empCheck, RFStatus.NotCompleted); dVModel.TotalSROpen = dashService.TotalSRNos(empCheck, SRStatus.Open); dVModel.TotalSRPendingAssignment = dashService.TotalSRNos(empCheck, SRStatus.PendingAssignment); dVModel.TotalSRAssigned = dashService.TotalSRNos(empCheck, SRStatus.Assigned); dVModel.TotalDFCreated = dashService.TotalDFNos(empCheck, DFStatus.Created); dVModel.TotalDFPendingAssignment = dashService.TotalDFNos(empCheck, DFStatus.PendingAssignment); dVModel.TotalDFPendingDelivery = dashService.TotalDFNos(empCheck, DFStatus.PendingDelivery); dVModel.TotalDFCompleted = dashService.TotalDFNos(empCheck, DFStatus.Completed); } if (empCheck.EmployeeType.EmployeeTypeName == "Store Supervisor" || empCheck.EmployeeType.EmployeeTypeName == "Store Manager") { dVModel.TotalITPendingApproval = dashService.TotalITNos(empCheck, ITStatus.PendingApproval); dVModel.TotalITApproved = dashService.TotalITNos(empCheck, ITStatus.Approved); } return(View("Dashboard", dVModel)); }
//Redirect to a display page for a user's account public IActionResult Index() { emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee; AccountViewModel aVModel = new AccountViewModel(); aVModel.employee = emp; aVModel.cList = cpService.GetCPList(); //int idCheck = (int)HttpContext.Session.GetInt32("id"); //if (HttpContext.Session.GetInt32("id") != null) //{ // Employee empCheck = empService.GetEmployeeById(idCheck); // if (empCheck != null) // { // System.Diagnostics.Debug.WriteLine("This is inside view Id : " + empCheck.Id); // return View("Index", empCheck); // } //} return(View("AccountSummary", aVModel)); }