Пример #1
0
        public void setDescription(int id, string value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            if (value == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Conflict) {
                    Content = new StringContent(string.Format("Description value is being set to null")),
                    ReasonPhrase = "Description cannot be null"
                };
                throw new HttpResponseException(response);
            }

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.Description = value;
            requestMgr.updateRequest(request);
        }
Пример #2
0
        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");
        }
Пример #3
0
 public ActionResult createElement(ElementView elementView)
 {
     ElementView element = null;
     if (elementView != null) {
         try {
             RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
             element = requestMgr.saveElement(elementView);
             TempData["error"] = "New Element created";
             TempData["valid"] = true;
             if (element.AssignedTo != (IUser)Session["User"])
                 EmailSvc.Email((string)MainFactory.getConfiguration().get(CONFIG_EMAIL),
                             element.AssignedTo.EmailAddress,
                             "",
                             "New Element #" + element.ID + " - " + element.Summary,
                             ConsoleFactory.elementEmailSupportBody(element, (IUser)Session["User"]));
             return RedirectToAction("Element", "Console", new { id = element.ID });
         } catch (Exception e) {
             TempData["model"] = elementView;
             TempData["error"] = e.Message;
             TempData["valid"] = false;
             return RedirectToAction("createElement", "Console", new { Id = elementView.Parent.ID });
         }
     }
     return Dashboard(null, null);
 }
Пример #4
0
        // POST: Request/SetAssignedTo
        public void setAssignedTo(int id, int value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);
            IUser assignedTo = getUser(value);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }
            // throw exception if bad employeeID
            if (assignedTo == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Employee with ID = {0}", id)),
                    ReasonPhrase = "Employee ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.AssignedTo = (User)assignedTo;
            requestMgr.updateRequest(request);
        }
Пример #5
0
 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);
 }
Пример #6
0
        public ActionResult addNote(string text, int elementId)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());

            Note note = new Note();
            note.UpdatedBy = (IUser)Session["User"];
            note.Text = text;
            requestMgr.saveNote(note, elementId);
            IList<Note> notes = requestMgr.getElement(elementId).Note;

            return PartialView("~/Views/Console/Partial/_NoteList.ascx", notes);
        }
Пример #7
0
 public ActionResult CreateProject(RequestView requestView, DateTime startDate)
 {
     ProjectView project = null;
     try {
         RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
         project = requestMgr.saveProject(requestView, startDate);
         TempData["valid"] = true;
         TempData["error"] = "New project created.";
         return RedirectToAction("Project", "Console", new { id = project.ID });
     } catch (Exception e) {
         TempData["valid"] = false;
         TempData["error"] = "Unable to create Project: " + e.Message;
         return RedirectToAction("Request", "Console", new { id = requestView.ID });
     }
 }
Пример #8
0
        public ActionResult createElement(int type)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());

            EmployeeMgr employeeMgr = new EmployeeMgr(ConsoleFactory.getEmployeeSvc());
            ViewData["statusList"] = requestMgr.getStatusList(EOpenType.Element);
            ViewData["assignedTo"] = employeeMgr.getAdminList();

            ViewData["error"] = TempData["error"] ?? "";
            ViewBag.Message = "New Element";
            ViewData["type"] = EOpenType.Element;
            ViewData["isValidated"] = TempData["valid"] ?? true;
            ViewData["user"] = (IUser)Session["User"];

            ElementView element = requestMgr.createElement(type);
            element.AssignedTo = (User)ViewData["user"];
            return View("FullView", element);
        }
Пример #9
0
        public void setClose(int id, DateTime value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.isNew = true;
            request.ClosedDate = value;
            request.isNew = false;
            requestMgr.updateRequest(request);
        }
Пример #10
0
        public void setValue(int id, decimal value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            if (value < 0) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Conflict) {
                    Content = new StringContent(string.Format("Value requested to be set to {0}", value)),
                    ReasonPhrase = "Cannot set to number less than 0"
                };
                throw new HttpResponseException(response);
            }

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.Value = value;
            requestMgr.updateRequest(request);
        }
Пример #11
0
        public void setTOA(int id, string value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.TopOffnetAttributeNumber = value;
            requestMgr.updateRequest(request);
        }
Пример #12
0
        public void setSupportArea(int id, int value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            LookupMgr lookupMgr = new LookupMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            SupportArea supportArea = lookupMgr.getSupportAreas().Where(x => x.ID == value).FirstOrDefault();
            // throw exception if bad requestType ID
            if (supportArea == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Support Area with ID = {0}", id)),
                    ReasonPhrase = "Request Type Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.SupportArea = supportArea;
            requestMgr.updateRequest(request);
        }
Пример #13
0
        public void setStatus(int id, int value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            LookupSorted status = (LookupSorted)requestMgr.getStatusList(EOpenType.Request).Where(x => x.ID == value);
            // throw exception if bad requestType ID
            if (status == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request Status with ID = {0}", id)),
                    ReasonPhrase = "Request Type Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.Status = status;
            requestMgr.updateRequest(request);
        }
Пример #14
0
        public new ActionResult Request(int? type = null)
        {
            int? id = type;
            if (id == null)
                throw new HttpException(404, "Not Found");

            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            LookupMgr lookupMgr = new LookupMgr(ConsoleFactory.getRequestSvc());
            EmployeeMgr employeeMgr = new EmployeeMgr(ConsoleFactory.getEmployeeSvc());
            RequestView request = requestMgr.getRequest((int)id);
            if (request == null)
                throw new HttpException(404, "Not Found");

            ViewData["statusList"] = requestMgr.getStatusList(EOpenType.Request);
            ViewData["programList"] = lookupMgr.getPrograms();
            ViewData["typeList"] = lookupMgr.getRequestTypes(EOpenType.Request, false);
            ViewData["supportArea"] = lookupMgr.getSupportAreas();
            ViewData["valueDriver"] = lookupMgr.getValueDrivers();
            IList<IEmployee> admin = employeeMgr.getAdminList();
            ViewData["assignedTo"] = employeeMgr.getAdminList();
            ViewData["requestCategory"] = lookupMgr.getRequestCategories(false);
            ViewData["project"] = requestMgr.getProjects();

            ViewBag.Message = "Request #" + request.ID;
            ViewData["type"] = EOpenType.Request;
            ViewData["error"] = TempData["error"] ?? "";
            ViewData["isValidated"] = TempData["valid"] ?? true;
            ViewData["user"] = (IUser)Session["User"];
            return View("FullView", request);
        }
Пример #15
0
        public void setParentProject(int id, int value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            ProjectView projectView = requestMgr.getProject(value);
            // throw exception if bad requestType ID
            if (projectView == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Project with ID = {0}", id)),
                    ReasonPhrase = "Request Type Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.Parent = projectView;
            requestMgr.updateRequest(request);
        }
Пример #16
0
 public ContentResult SearchConsole(string searchContext)
 {
     if (searchContext.Length > 0) {
         RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
         IList<Link> linkList = requestMgr.getItemsLike(searchContext.ToLower());
         return Jsonify<IList<Link>>.Serialize(linkList);
     }
     return null;
 }
Пример #17
0
 public ActionResult PartialRequest(int requestID)
 {
     RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
     ViewData["isAdmin"] = ((IUser)Session["User"]).canImpersonate();
     RequestView v = requestMgr.getRequest(requestID);
     return PartialView("~/Views/Console/Partial/_RequestView.ascx", requestMgr.getRequest(requestID));
 }
Пример #18
0
        public ActionResult SubmitRequest(NewRequestModel request)
        {
            if (request == null)
                return NewRequest();

            MainFactory.getLogSvc().logAction("Console - Submit Request");

            int enteredRequest = 0;
            try {
                RequestView newRequest = submitRequest(request);
                enteredRequest = newRequest.ID;

                IUser assignedTo = newRequest.AssignedTo;
                RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());

                string from = (string)MainFactory.getConfiguration().get(CONFIG_EMAIL);

                EmailSvc.Email(from,
                                assignedTo.EmailAddress,
                                "*****@*****.**",
                                "New Request #" + newRequest.ID + " - " + newRequest.Summary,
                                ConsoleFactory.requestEmailSupportBody(newRequest));
                if (!assignedTo.Equals(newRequest.RequestedBy))
                    EmailSvc.Email(from,
                                newRequest.RequestedBy.EmailAddress,
                                "",
                                "New Request #" + newRequest.ID + " - " + newRequest.Summary,
                                ConsoleFactory.requestEmailSubmitterBody(newRequest));
            } catch (Exception e) {
                return RedirectToAction("NewWithResponse", new { success = false, message = e.Message });
            }
            string response = "Request has been entered. Reference number is " + enteredRequest + ".";
            return RedirectToAction("NewWithResponse", new { success = true, message = response });
        }
Пример #19
0
        public void setValueDriver(int id, int value)
        {
            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            LookupMgr lookupMgr = new LookupMgr(ConsoleFactory.getRequestSvc());
            RequestView request = requestMgr.getRequest(id);

            // throw exception if bad request id
            if (request == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Request with ID = {0}", id)),
                    ReasonPhrase = "Request ID Not Found"
                };
                throw new HttpResponseException(response);
            }

            ValueDriver valueDriver = (ValueDriver)lookupMgr.getValueDrivers().Where(x => x.ID == value);
            // throw exception if bad requestType ID
            if (valueDriver == null) {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest) {
                    Content = new StringContent(string.Format(" No Value Driver with ID = {0}", id)),
                    ReasonPhrase = "Request Type Not Found"
                };
                throw new HttpResponseException(response);
            }

            request.ValueDriver = valueDriver;
            requestMgr.updateRequest(request);
        }
Пример #20
0
        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;
        }
Пример #21
0
        public ActionResult updateRequest(RequestView requestView)
        {
            RequestView request = null;
            UserMgr userMgr = new UserMgr(MainFactory.getUserSvc());
            if (requestView != null) {
                try {
                    RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
                    requestView.RequestedBy = (User)userMgr.getUser(requestView.RequestedBy.EmployeeID);
                    requestView.AssignedTo = (User)userMgr.getUser(requestView.AssignedTo.EmployeeID);
                    request = requestMgr.updateRequest(requestView);
                    TempData["error"] = "Update Successful";
                    TempData["valid"] = true;

                    string from = (string)MainFactory.getConfiguration().get(CONFIG_EMAIL);

                    return RedirectToAction("Request", "Console", new { id = request.ID });
                } catch (Exception e) {
                    request = requestView;
                    request.isNew = false;
                    TempData["error"] = e.Message;
                    TempData["valid"] = false;
                    return RedirectToAction("Request", "Console", new { id = request.ID });
                }
            }
            return Dashboard(null, null);
        }
Пример #22
0
 public ActionResult updateProject(ProjectView projectView)
 {
     ProjectView project = null;
     if (projectView != null) {
         try {
             RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
             project = requestMgr.updateProject(projectView);
             TempData["error"] = "Update Successful";
             TempData["valid"] = true;
             return RedirectToAction("Project", "Console", new { id = project.ID });
         } catch (Exception e) {
             project = projectView;
             project.isNew = false;
             TempData["error"] = e.Message;
             TempData["valid"] = false;
             return RedirectToAction("Project", "Console", new { id = projectView.ID });
         }
     }
     return Dashboard(null, null);
 }
Пример #23
0
 public ActionResult updateElement(ElementView elementView)
 {
     ElementView element = null;
     if (elementView != null) {
         try {
             RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
             element = requestMgr.updateElement(elementView, false);
             TempData["error"] = "Update Successful";
             TempData["valid"] = true;
             return RedirectToAction("Element", "Console", new { id = element.ID });
         } catch (Exception e) {
             elementView.isNew = false;
             TempData["error"] = e.Message;
             TempData["valid"] = false;
             TempData["model"] = elementView;
             return RedirectToAction("Element", "Console", new { id = elementView.ID });
         }
     }
     return Dashboard(null, null);
 }
Пример #24
0
        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");
        }
Пример #25
0
        public ActionResult Project(int? type = null)
        {
            int? id = type;
            if (id == null)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            LookupMgr lookupMgr = new LookupMgr(ConsoleFactory.getRequestSvc());
            ProjectView project = requestMgr.getProject((int)id);

            ViewData["statusList"] = requestMgr.getStatusList(EOpenType.Project);
            ViewData["programList"] = lookupMgr.getPrograms();
            ViewData["typeList"] = lookupMgr.getRequestTypes(EOpenType.Project, false);
            ViewData["supportArea"] = lookupMgr.getSupportAreas();
            ViewData["valueDriver"] = lookupMgr.getValueDrivers();

            ViewData["type"] = EOpenType.Project;
            ViewData["user"] = (IUser)Session["User"];
            ViewData["isValidated"] = TempData["valid"] ?? true;
            ViewData["error"] = TempData["error"] ?? "";
            ViewBag.Message = "Project #" + project.ID;
            if (project == null)
                return Dashboard(null, null);
            return View("FullView", project);
        }
Пример #26
0
        private RequestView submitRequest(NewRequestModel request)
        {
            UserMgr userMgr = new UserMgr(MainFactory.getUserSvc());
            LookupMgr lookupMgr = new LookupMgr(ConsoleFactory.getRequestSvc());
            RequestView submittal = new RequestView();
            submittal.RequestedBy = (User)userMgr.getUser(request.RequestBy);
            submittal.SubmittedBy = (User)userMgr.getUser(request.SubmittedBy);
            submittal.SupportArea = lookupMgr.getSupportAreas().Where(x => x.ID == request.SupportAreaID).FirstOrDefault();
            submittal.CType = lookupMgr.getRequestTypes(EOpenType.Request, true).Where(x => x.ID == request.TypeID).FirstOrDefault();
            submittal.RequestCategory = lookupMgr.getRequestCategories(true).Where(x => x.ID == request.RequestCategory).FirstOrDefault();
            submittal.RequestedDueDate = request.RequestedDueDate;
            submittal.Summary = request.RequestSummary;
            submittal.Description = request.RequestDescription;
            submittal.ValueDriver = lookupMgr.getValueDrivers().Where(x => x.ID == request.ValueDriverID).Cast<ValueDriver>().FirstOrDefault();
            submittal.Value = request.Value;
            submittal.ValueReason = request.ValueReason;

            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            RequestView r = (RequestView)requestMgr.createRequest(submittal);
            addToNewRequests(r);
            return r;
        }
Пример #27
0
        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");
        }
Пример #28
0
 public ActionResult PromoteToProject(int requestID, DateTime startDate)
 {
     RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
     return CreateProject(requestMgr.getRequest(requestID), startDate);
 }
Пример #29
0
        public ActionResult Element(int? type = null)
        {
            int? id = type;
            if (id == null)
                throw new HttpException(404, "Not Found");

            RequestMgr requestMgr = new RequestMgr(ConsoleFactory.getRequestSvc());
            EmployeeMgr employeeMgr = new EmployeeMgr(ConsoleFactory.getEmployeeSvc());
            ElementView element = requestMgr.getElement((int)id);
            if (element == null)
                throw new HttpException(404, "Not Found");

            ViewData["statusList"] = requestMgr.getStatusList(EOpenType.Element);
            ViewData["assignedTo"] = employeeMgr.getAdminList();

            ViewData["error"] = TempData["error"] ?? "";
            ViewBag.Message = "Element #" + element.ID;
            ViewData["type"] = EOpenType.Element;
            ViewData["isValidated"] = TempData["valid"] ?? true;
            ViewData["user"] = (IUser)Session["User"];
            return View("FullView", TempData["model"] == null ? element : (ElementView)TempData["model"]);
        }