public ProjectView(RequestView request) { this.RequestedBy = request.RequestedBy; this.SubmittedBy = request.SubmittedBy; this.AssignedTo = request.AssignedTo; this.CType = request.CType; this.SupportArea = request.SupportArea; this.Program = request.Program; this.ValueDriver = request.ValueDriver; this.RequestedDueDate = request.RequestedDueDate; this.EstimatedDueDate = request.EstimatedDueDate; this.ResumeDate = request.ResumeDate; this.ManagerQueueDate = request.ManagerQueueDate; this.ManagerApprovedDate = request.ManagerApprovedDate; this.EstimatedHours = request.EstimatedHours; this.Value = request.Value; this.EstimatedCost = request.EstimatedCost; this.ActualCost = request.ActualCost; this.Description = request.Description; this.ValueReason = request.ValueReason; this.ManagerNote = request.ManagerNote; this.Summary = request.Summary; this.RequestList = new List<RequestView>(); this.RequestList.Add(request); this.setLastUpdated(); }
public ElementView(RequestView parent) { this.OpenDate = DateTime.Today; this.PercentComplete = 0; this.Hours = 0; this.Note = new List<Note>(); this.Parent = parent; this.LastUpdated = DateTime.Now; }
public ElementView(ELEMENT element, IList<Note> noteList, IUser assignedTo, LookupSorted elementStatus, RequestView parent) : base(element.ELEMENT_ID, elementStatus, element.ASSIGNED_DATE, element.CLOSED_DATE, element.LAST_UPDATED_DATE, element.ELEMENT_SUMMARY) { this.AssignedTo = (User)assignedTo; this.Parent = parent; this.percentComplete = element.PERCENT_COMPLETE; this.hours = element.HOURS; this.Resolution = element.RESOLUTION; this.Note = noteList == null ? new List<Note>() : noteList; }
public static string requestEmailPromoteBody(RequestView request) { string url = MainFactory.getInstance() + "/Console/Dashboard/Request/" + request.ID; string email = "<html>"; email += "A Request to promote to project has been made for: <b>" + request.Summary + "</b>"; email += "<br><br>To View the Request: <a href='" + url + "'>" + url + "</a>"; email += "<br><br>Or view all pending requests in the <a href='http://" + MainFactory.getInstance() + "/Console/Manager" + "'>Manager Dashboard</a>"; email += "</html>"; return email; }
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 }); } }
public static string requestEmailSupportBody(RequestView request) { string url = "http://" + MainFactory.getInstance() + "/Console/Dashboard/Request/" + request.ID; string email = "<html>"; email += "<h3>A new request has been assigned to you.</h3><br /><table>"; email += "<tr><th style='text-align: left'>Requested by: </th><td style='text-align: left'>" + request.RequestedBy.EnglishName + "</td></tr>"; email += "<tr><th style='text-align: left'>Request Area: </th><td style='text-align: left'>" + request.SupportArea.Text + "</td></tr>"; email += "<tr><th style='text-align: left'>Request Summary: </th><td style='text-align: left'>" + request.Summary + "</td></tr></table>"; email += "<br><br>You can view the entire summary at <a href='" + url + "'>" + url + "</a>"; email += "<br><br>Or view all your pending details in the <a href='http://" + MainFactory.getInstance() + "/Console" + "'>Dashboard</a>"; email += "</html>"; return email; }
public static string requestEmailSubmitterStatusChange(RequestView request) { string url = MainFactory.getInstance() + "/Console/Dashboard/Request/" + request.ID; string email = "<html>"; email += "This is to notify you of a status change to your request : <b>" + request.Summary + "</b>"; email += "<br><br>The status of this request has been marked as " + request.Status.Text + "."; email += "<br><br>You may choose to read the details at :"; email += "<br><a href='" + url + "'>" + url + "</a>"; email += "<br><br>Or view all your pending details in the <a href='http://" + MainFactory.getInstance() + "/Console" + "'>Dashboard</a>"; email += "</html>"; return email; }
private void addToNewRequests(RequestView request) { List<RequestView> requests = (List<RequestView>)HttpContext.ApplicationInstance.Application["newRequests"]; if (requests == null) requests = new List<RequestView>(); if (!requests.Any(x => x.ID == request.ID)) requests.Add(request); HttpContext.ApplicationInstance.Application["newRequests"] = requests; }
public RequestView updateRequest(RequestView request) { LookupMgr lookupMgr = new LookupMgr(this.svc); RequestView oldRequest = getRequest(request.ID); string from = (string)MainFactory.getConfiguration().get(CONFIG_EMAIL); if (request.EstimatedDueDate == null) throw new ArgumentException("Estimated Due Date cannot be empty."); string status = this.requestStatusList.Data.Where(x => x.ID == request.Status.ID).FirstOrDefault().Text.ToLower(); request.Status.Text = status; // update elements if (status.Equals("complete") && request.Status.ID != oldRequest.Status.ID) { if (request.Resolution == null || request.Resolution.Length < 1) throw new ArgumentException("You are closing this request. Please provide a resolution."); foreach (ElementView element in oldRequest.ElementList.ToList()) { if (element.ClosedDate == null) { if (!element.AssignedTo.Equals(request.AssignedTo)) throw new InvalidOperationException("There are elements that are not assigned to you. You cannot close this request until these elements are closed manually."); element.PercentComplete = 100; element.Resolution = "AutoStamp: " + request.Resolution; element.Status = this.elementStatusList.Data.Where(x => x.Text.Equals("Complete")).FirstOrDefault(); updateElement(element, true); } } request.setClosed(); EmailSvc.Email(from, request.RequestedBy.EmailAddress, "", "Request " + request.ID + " - " + request.Summary + " has been completed", ConsoleFactory.requestEmailSubmitterStatusChange(request)); } else if ((status.Equals("rejected") || status.Equals("cancelled")) && request.Status.ID != oldRequest.Status.ID) { if (request.Resolution == null || request.Resolution.Length < 1) throw new ArgumentException("You are closing this request. Please provide a resolution."); request.setClosed(); EmailSvc.Email(from, request.RequestedBy.EmailAddress, "", "Request " + request.ID + " - " + request.Summary + " has been " + request.Resolution + ".", ConsoleFactory.requestEmailSubmitterStatusChange(request)); } else if (status.Equals("on hold") && request.Status.ID != oldRequest.Status.ID) request.setHoldDate(); else if (oldRequest.Status.Text.ToLower().Equals("on hold") && request.Status.ID != oldRequest.Status.ID) request.setResumeDate(); else if (status.Equals("moved to project") && request.Status.ID != oldRequest.Status.ID) { UserMgr userMgr = new UserMgr(MainFactory.getUserSvc()); if (request.EstimatedHours == null || request.EstimatedHours <= 0) throw new ArgumentException("Request must have estimated hours before being requested for promotion."); EmailSvc.Email(from, userMgr.getUser(Int32.Parse((string)MainFactory.getConfiguration().get("BIManagerID"))).EmailAddress, "", "Request " + request.ID + " - " + request.Summary + " has been updated", ConsoleFactory.requestEmailPromoteBody(request)); request.ManagerQueueDate = DateTime.Today; } // hours are different. update cost if (request.EstimatedHours != oldRequest.EstimatedHours) request.EstimatedCost = request.EstimatedHours * request.InternalHoursMultiplier; request.ActualCost = oldRequest.ElementList.Sum(x => x.Hours) * request.InternalHoursMultiplier; request.isNew = false; request.setLastUpdated(); RequestView r = convertRequest(this.svc.updateRequest(request)); //change oldRequest's child Element's parent pointer to this foreach (ElementView e in oldRequest.ElementList) e.Parent = r; r.ElementList = oldRequest.ElementList; // change Parent's pointer to this if (r.Parent != null) { r.Parent.RequestList.Remove(r); r.Parent.RequestList.Add(r); } // if a u parent was added in this update. if (r.Parent == null && request.Parent != null && request.Parent.ID != 0) { foreach (RequestView rv in this.requestList.Data) if (rv.Parent != null && rv.Parent.ID == request.Parent.ID) { r.Parent = rv.Parent; r.Parent.RequestList.Add(r); break; } } // change the pointer in the requestList to point to this object foreach (RequestView rv in this.requestList.Data.ToList()) if (rv.ID == request.ID) this.requestList.Data.Remove(rv); this.requestList.Data.Add(r); HttpContext.Current.Application.Lock(); HttpContext.Current.Application["Request"] = this.requestList; HttpContext.Current.Application.UnLock(); return r; }
public ProjectView saveProject(RequestView request, DateTime startDate) { if (request.Parent != null && request.Parent.ID != 0) throw new ArgumentException("Request is already part of a project. It cannot be promoted to project."); LookupMgr lookupMgr = new LookupMgr(this.svc); UserMgr userMgr = new UserMgr(MainFactory.getUserSvc()); request.SubmittedBy = (User)userMgr.getUser(request.SubmittedBy.EmployeeID); request.RequestedBy = (User)userMgr.getUser(request.RequestedBy.EmployeeID); request.AssignedTo = (User)userMgr.getUser(request.AssignedTo.EmployeeID); request.Program = lookupMgr.getPrograms().Where(x => x.ID == request.Program.ID).Cast<Program>().FirstOrDefault(); request.RequestCategory = lookupMgr.getRequestCategories(true).Where(x => x.ID == request.RequestCategory.ID).FirstOrDefault(); request.Status = this.requestStatusList.Data.Where(x => x.Text.ToLower().Equals("moved to project")).FirstOrDefault(); request.CType = lookupMgr.getRequestTypes(EOpenType.Request, true).Where(x => x.ID == request.CType.ID).FirstOrDefault(); request.SupportArea = lookupMgr.getSupportAreas().Where(x => x.ID == request.SupportArea.ID).FirstOrDefault(); request.ValueDriver = lookupMgr.getValueDrivers().Where(x => x.ID == request.ValueDriver.ID).Cast<ValueDriver>().FirstOrDefault(); ProjectView project = new ProjectView(request); project.Status = this.projectStatusList.Data.Where(x => x.Text.Equals("Pending")).FirstOrDefault(); project.StartDate = startDate; project.ManagerApprovedDate = DateTime.Today; project = convertProject(this.svc.saveProject(project)); request.Parent = project; request.isNew = false; request.setLastUpdated(); project.RequestList.Add(getRequest(request.ID)); updateRequest(request); // update pointer and status foreach (RequestView rv in this.requestList.Data.ToList()) { if (rv.ID == request.ID) { request.ElementList = rv.ElementList; this.requestList.Data.Remove(rv); } } this.requestList.Data.Add(request); HttpContext.Current.Application.Lock(); HttpContext.Current.Application["Request"] = this.requestList; HttpContext.Current.Application.UnLock(); return project; }
public string requestEmailUpdateRequesterBody(RequestView request) { string url = MainFactory.getInstance() + "/Console/Dashboard?type=Request&id=" + request.ID; UserMgr userMgr = new UserMgr(MainFactory.getUserSvc()); string email = "<html>"; email += "An item that you requested has been updated.<br />"; email += "To see the updated request, please check the status by going to the following web site:"; email += "<br /><a href='" + url + "'>" + url + "</a>"; email += "<br><br>Or view all your pending details in the <a href='http://" + MainFactory.getInstance() + "/Console" + "'>Dashboard</a>"; email += "</html>"; return email; }
private REQUEST convertRequest(RequestView request) { return new REQUEST { ASSIGNED_TO_ID = request.AssignedTo.EmployeeID, SUBMITTED_BY_ID = request.SubmittedBy.EmployeeID, REQUESTED_BY_ID = request.RequestedBy.EmployeeID, REQUEST_TYPE_ID = (short)request.CType.ID, REQUEST_CATEGORY_ID = (short)request.RequestCategory.ID, SUPPORT_AREA_ID = (short?)request.SupportArea.ID, PARENT_PROJECT_ID = request.Parent == null ? null : (int?)request.Parent.ID, PROGRAM_ID = request.Program == null ? null : (short?)request.Program.ID, VALUE_DRIVER_ID = (short)request.ValueDriver.ID, VALUE_REASON = request.ValueReason, REQUEST_STATUS_ID = (byte)request.Status.ID, SUBMITTED_DATE = request.OpenDate, REQUESTED_DUE_DATE = (DateTime)request.RequestedDueDate, ESTIMATED_DUE_DATE = request.EstimatedDueDate, MANAGER_QUEUE_DATE = request.ManagerQueueDate, MANAGER_APPROVED_DATE = request.ManagerApprovedDate, HOLD_DATE = request.HoldDate, RESUME_DATE = request.ResumeDate, CLOSED_DATE = request.ClosedDate, LAST_UPDATED_DATE = request.LastUpdated, ESTIMATED_HOURS = request.EstimatedHours, VALUE = request.Value, ESTIMATED_COST = request.EstimatedCost, ACTUAL_COST = request.ActualCost, REQUEST_SUMMARY = request.Summary, REQUEST_DESCRIPTION = request.Description }; }
public REQUEST updateRequest(RequestView request) { try { using (ConsoleDataContext db = (ConsoleDataContext)MainFactory.getDb("Console", false)) { REQUEST details = db.REQUESTs.Where(x => x.REQUEST_ID == request.ID).FirstOrDefault(); details.ASSIGNED_TO_ID = request.AssignedTo.EmployeeID; details.REQUEST_STATUS_ID = (byte)request.Status.ID; details.PROGRAM_ID = request.Program == null ? null : (request.Program.ID > 0 ? (short)request.Program.ID : details.PROGRAM_ID); details.REQUEST_TYPE_ID = (short)request.CType.ID; details.SUPPORT_AREA_ID = (short?)request.SupportArea.ID; details.VALUE_DRIVER_ID = (short)request.ValueDriver.ID; details.ESTIMATED_DUE_DATE = request.EstimatedDueDate; details.ESTIMATED_COST = request.EstimatedCost; details.ESTIMATED_HOURS = request.EstimatedHours; details.ACTUAL_COST = request.ActualCost; details.REQUEST_CATEGORY_ID = (short)request.RequestCategory.ID; details.PARENT_PROJECT_ID = (request.Parent == null || request.Parent.ID == 0) ? null : (int?)request.Parent.ID; details.RESOLUTION = request.Resolution; details.IT_FEATURE = request.ITFeatures; details.TOP_OFFNET_ATTRIBUTE_NUMBER = request.TopOffnetAttributeNumber; details.CLOSED_DATE = request.ClosedDate; db.SubmitChanges(); return details; } } catch (Exception se) { throw new Exception("Unable to update request #" + request.ID + " Due to " + se.Message); } }
public REQUEST saveRequest(RequestView request) { try { REQUEST submittal = convertRequest(request); using (ConsoleDataContext db = (ConsoleDataContext)MainFactory.getDb("Console", false)) { db.REQUESTs.InsertOnSubmit(submittal); db.SubmitChanges(); return submittal; } } catch (Exception e) { MainFactory.getLogSvc().logError(this.GetType().Name, MainFactory.getCurrentMethod(), "rs-sr-01", e.Message + "\n" + e.StackTrace); throw new Exception("Something terrible went wrong with your request."); } throw new Exception("Something terrible went wrong with your request. Please notify us if you continue to see these errors."); }
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; }
public static string requestEmailSubmitterBody(RequestView request) { string url = MainFactory.getInstance() + "/Console/Dashboard/Request/" + request.ID; string email = "<html>"; email += "We appreciate your business and are currently working on your case for : <b>" + request.Summary + "</b>"; if (request.SubmittedBy != request.RequestedBy) email += "<br>This case was submitted on your behalf by <b>" + request.SubmittedBy.EnglishName + "</b>"; email += "<br><br>Your case is being worked by a BI Support member."; email += "<br><br>Please feel free to check the status anytime by going to the following web site:"; email += "<br><a href='" + url + "'>" + url + "</a>"; email += "<br><br>Or view all your pending details in the <a href='http://" + MainFactory.getInstance() + "/Console" + "'>Dashboard</a>"; email += "</html>"; return email; }
private RequestView convertRequest(REQUEST request) { UserMgr userMgr = new UserMgr(MainFactory.getUserSvc()); LookupMgr lookupMgr = new LookupMgr(this.svc); Configuration config = MainFactory.getConfiguration(); RequestView r = new RequestView(request, (User)userMgr.getUser(request.SUBMITTED_BY_ID), (User)userMgr.getUser(request.REQUESTED_BY_ID), (User)userMgr.getUser((int)request.ASSIGNED_TO_ID), null, lookupMgr.getRequestCategories(false).Where(x => x.ID == request.REQUEST_CATEGORY_ID).FirstOrDefault(), lookupMgr.getSupportAreas().Where(x => x.ID == request.SUPPORT_AREA_ID).FirstOrDefault(), null, lookupMgr.getPrograms().Where(x => x.ID == request.PROGRAM_ID).Cast<Program>().FirstOrDefault(), lookupMgr.getValueDrivers().Where(x => x.ID == request.VALUE_DRIVER_ID).Cast<ValueDriver>().FirstOrDefault(), this.requestStatusList.Data.Where(x => x.ID == request.REQUEST_STATUS_ID).FirstOrDefault(), lookupMgr.getRequestTypes(EOpenType.Request, false).Where(x => x.ID == request.REQUEST_TYPE_ID).FirstOrDefault(), Decimal.Parse((string)config.get("HoursCostMultiplierInternal")), Decimal.Parse((string)config.get("HoursCostMultiplierExternal"))); return r; }
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); }