public ActionResult PendingRequest() { RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc()); IEnumerable<AProjectView> requestList = requestMgr.getRequests(EOpenType.Request, null).Where(x => x.Status.Text.Equals("Moved to Project") && ((RequestView)x).Parent == null).Cast<AProjectView>().OrderBy(x => x.RequestedDueDate); List<RequestView> a = requestList.Cast<RequestView>().ToList(); return PartialView("~/Views/Console/Partial/_PendingPromotes.ascx", a); }
public ActionResult Dashboard(string type = "", int? id = null) { RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc()); IEnumerable<AProjectView> requestList = requestMgr.getRequests(EOpenType.Request, null).Where(x => x.Status.Text.Equals("Moved to Project") && ((RequestView)x).Parent == null).Cast<AProjectView>().OrderBy(x => x.RequestedDueDate); ViewData["pendingRequests"] = requestList.Cast<ARequestView>().Count(); ConsoleController consoleController = new ConsoleController(); ViewData["isAdmin"] = true; ViewData["type"] = null; ViewData["type"] = type; switch (type.ToLower()) { case "pendingpromotes" : ViewData["partialData"] = requestList.Cast<RequestView>().ToList(); break; case "request" : ViewData["partialData"] = requestMgr.getRequest((int)id); break; case "element" : ViewData["partialData"] = requestMgr.getElement((int)id); break; case "project": ViewData["partialData"] = requestMgr.getProject((int)id); break; default : ViewData["type"] = null; ViewData["partialData"] = consoleController.GridHelper(null, null, null, null, null, null, null, null, null, null, null); break; } ViewBag.Message = "Manager - Dashboard"; return View("../Console/ManagerDashboard"); }
private ActionResult AdminDashboard(string type, int? id, IUser user) { List<RequestView> requests = (List<RequestView>)HttpContext.ApplicationInstance.Application["newRequests"]; if (requests != null) { requests = requests.Where(x => !x.AssignedTo.Equals(user)).ToList(); HttpContext.ApplicationInstance.Application["newRequests"] = requests; } RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc()); IEnumerable<AProjectView> requestList = requestMgr.getRequests(EOpenType.Request, user).Where(x => !x.Status.Text.Equals("Moved to Project")).Cast<AProjectView>().OrderBy(x => x.RequestedDueDate); ViewData["openRequests"] = ConsoleFactory.createLink(EOpenType.Request, requestList.Cast<ARequestView>().ToList(), true); ViewData["openElements"] = ConsoleFactory.createLink(EOpenType.Element, requestMgr.getRequests(EOpenType.Element, ((IUser)Session["User"])), true); ViewData["openProjects"] = ConsoleFactory.createLink(EOpenType.Project, requestMgr.getRequests(EOpenType.Project, user).ToList(), true); ViewData["type"] = type == null || type.Length < 1 ? null : type; if (type != null && type.Length > 0) { if (type.ToString().ToLower().Equals("request")) { ViewData["partialData"] = requestMgr.getRequest((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else if (type.ToString().ToLower().Equals("element")) { ViewData["partialData"] = requestMgr.getElement((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else if (type.ToString().ToLower().Equals("project")) { ViewData["partialData"] = requestMgr.getProject((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else throw new HttpException(404, "Not Found"); } else ViewData["partialData"] = GridHelper(null, null, null, null, null, null, null, null, null, null, null); ViewData["id"] = id; ViewData["isAdmin"] = true; ViewData["isAdminManager"] = ((IUser)Session["User"]).isBIManager(); return View("Dashboard"); }
private ActionResult UserDashboard(string type, int? id, IUser user) { RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc()); IEnumerable<AProjectView> requestList = requestMgr.getRequests(EOpenType.Request, ((IUser)Session["User"])).Cast<AProjectView>().OrderBy(x => x.RequestedDueDate); ViewData["openRequests"] = ConsoleFactory.createLink(EOpenType.Request, requestList.Cast<ARequestView>().ToList(), true); ViewData["type"] = type == null || type.Length < 1 ? null : type; if (type != null && type.Length > 0) { if (type.ToString().ToLower().Equals("request")) { ViewData["partialData"] = requestMgr.getRequest((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else if (type.ToString().ToLower().Equals("element")) { ViewData["partialData"] = requestMgr.getElement((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else if (type.ToString().ToLower().Equals("project")) { ViewData["partialData"] = requestMgr.getProject((int)id); if (ViewData["partialData"] == null) throw new HttpException(404, "Not Found"); } else throw new HttpException(404, "Not Found"); } ViewData["id"] = id; ViewData["isAdmin"] = false; ViewData["isAdminManager"] = false; return View("Dashboard"); }
internal DashboardGrid GridHelper(int? ID, int[] requestorIdList, int[] assignedIdList, int[] category, int[] requestType, int[] area, string summary, string submittedRange, string dueDateRange, int[] status, string closedRange) { if (submittedRange != null && submittedRange.Length != 21) submittedRange = null; if (dueDateRange != null && dueDateRange.Length != 21) dueDateRange = null; if (closedRange != null && closedRange.Length != 21) closedRange = null; RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc()); IList<RequestView> requestList = requestMgr .getRequests(EOpenType.Request, null) .Cast<RequestView>() .Where(x => (ID == null || ID == x.ID)) .Where(x => (requestorIdList == null || (requestorIdList.Count() == 1 && requestorIdList[0] == 0) || requestorIdList.Contains(x.RequestedBy.EmployeeID))) .Where(x => (assignedIdList == null || (assignedIdList.Count() == 1 && assignedIdList[0] == 0) || assignedIdList.Contains(x.AssignedTo.EmployeeID))) .Where(x => (category == null || (category.Count() == 1 && category[0] == 0) || category.Contains(x.RequestCategory.ID))) .Where(x => (requestType == null || (requestType.Count() == 1 && requestType[0] == 0) || requestType.Contains(x.CType.ID))) .Where(x => (area == null || (area.Count() == 1 && area[0] == 0) || area.Contains(x.SupportArea.ID))) .Where(x => (submittedRange == null || (x.OpenDate >= DateTime.Parse(submittedRange.Split('-')[0]) && x.OpenDate <= DateTime.Parse(submittedRange.Split('-')[1])))) .Where(x => (dueDateRange == null || (x.RequestedDueDate >= DateTime.Parse(dueDateRange.Split('-')[0]) && x.RequestedDueDate <= DateTime.Parse(dueDateRange.Split('-')[1])))) .Where(x => (status == null || (status.Count() == 1 && status[0] == 0) || status.Contains(x.Status.ID))) .Where(x => (closedRange == null || (x.ClosedDate >= DateTime.Parse(closedRange.Split('-')[0]) && x.ClosedDate <= DateTime.Parse(closedRange.Split('-')[1])))) .ToList(); // filter by summary using wildcard if (summary != null && summary.Length > 0) if (summary.Left(1).Equals("%") && summary.Right(1).Equals("%")) requestList = requestList.Where(x => x.Summary.ToLower().Contains(summary.Substring(1, summary.Length - 2).ToLower())).ToList(); else if (summary.Left(1).Equals("%")) requestList = requestList.Where(x => x.Summary.Right(summary.Length - 1).ToLower().Equals(summary.Right(summary.Length - 1).ToLower())).ToList(); else if (summary.Right(1).Equals("%")) requestList = requestList.Where(x => x.Summary.Left(summary.Length - 1).ToLower().Equals(summary.Left(summary.Length - 1).ToLower())).ToList(); else requestList = requestList.Where(x => x.Summary.ToLower().Equals(summary.ToLower())).ToList(); DashboardGrid gridView = new DashboardGrid(requestList.Select(x => x.RequestedBy).OrderBy(y => y.EnglishName).Distinct().ToList(), requestList.Select(x => x.AssignedTo).OrderBy(y => y.EnglishName).Distinct().ToList(), requestList.Select(x => x.RequestCategory).OrderBy(y => y.Text).Distinct().ToList(), requestList.Select(x => x.CType).OrderBy(y => y.Text).Distinct().ToList(), requestList.Select(x => x.SupportArea).OrderBy(y => y.Text).Distinct().ToList(), summary, submittedRange, dueDateRange, requestList.Select(x => x.Status).OrderBy(y => y.Text).Distinct().ToList(), closedRange, requestList); return gridView; }