public ICallReportVO ProcessCallReport(ICallReportVO callReport, string action) { IUserVO loginUser = UserDAO.RetrieveUserByLoginId(callReport.LastUpdateBy); if (callReport.Id == 0) { callReport.Owner = loginUser; } CallReportDAO.SaveCallReport(callReport); ITaskVO task = TaskDAO.RetrieveTaskByRefIdAndFlowType(callReport.Id, WORKFLOW_TYPE); if (task == null) { task = new TaskVO() { ReferenceId = callReport.Id, WorkflowType = WORKFLOW_TYPE }; task.LastUpdateBy = callReport.LastUpdateBy; task.Initiator = loginUser; } task.PreviousOwner = loginUser; task.TaskAction = action; task = WorkflowManager.ExecuteWorkflow(task, callReport.Reviewer); TaskDAO.SaveTask(task); callReport.Status = task.TaskStatus; callReport.WorkflowProcessId = task.WorkflowProcessId; callReport.TaskStatus = task.TaskStatus; callReport.CurrentRecipient = UserDAO.RetrieveUserById(task.CurrentOwner.Id); return(callReport); }
private ICallReportVO UpdateCallReport(ICallReportVO callReport) { callReport.LastUpdateDate = DateTime.Now; CurrentSession.SaveOrUpdate(callReport); return(callReport); }
private ICallReportVO CreateCallReport(ICallReportVO callReport) { // LastUpdateBy will be set in the controller using the login user; hence, just copy. callReport.CreateBy = callReport.LastUpdateBy; callReport.CreationDate = DateTime.Now; callReport.LastUpdateDate = DateTime.Now; callReport.ReferenceNo = "CR" + RetrieveNextSequence(); CurrentSession.Save(callReport); return(callReport); }
public virtual ICallReportVO SaveCallReport(ICallReportVO callReport) { if (callReport.Id == 0) { return(CreateCallReport(callReport)); } else { return(UpdateCallReport(callReport)); } }
public ActionResult ProcessCallReport(CallReportViewModel model, ActionType actionType) { Logger.Debug("SaveCallReport|Action type: " + actionType); if (actionType == ActionType.Process) { try { ICallReportVO callReport = (CallReportVO) CallReportMapper.Map(model, typeof(CallReportViewModel), typeof(CallReportVO)); ICallReportVO sessionCallReport = (ICallReportVO)Session["SessionCallReport"]; if (callReport.Id == 0 || sessionCallReport == null) { sessionCallReport = new CallReportVO(); } AccessorUtil.copyValue(callReport, sessionCallReport, CallReportVO.EXCLUDE_COPY); sessionCallReport.LastUpdateBy = User.Identity.Name; ICustomerVO sessionCustomer = (ICustomerVO)Session["SessionCustomer"]; sessionCallReport.Customer = sessionCustomer; sessionCallReport = CallReportManager.ProcessCallReport(sessionCallReport, model.Action); model = (CallReportViewModel) CallReportMapper.Map(sessionCallReport, typeof(ICallReportVO), typeof(CallReportViewModel)); Session["SessionCallReport"] = sessionCallReport; TempData["MessageType"] = MessageType.Success; TempData["MessageDescription"] = CommonResources.MessageSaveSuccess; } catch (Exception exception) { Logger.Debug("Exception encountered: " + exception.StackTrace); TempData["MessageType"] = MessageType.Error; TempData["MessageDescription"] = CommonResources.MessageSaveError + exception.Message; } TempData["CallReportDetailModel"] = model; return(RedirectToAction("ViewCallReportDetails")); } return(RedirectToAction("ViewCallReportList")); }
public ActionResult ViewCallReport(int callReportId) { Logger.Debug("ViewCallReport|Selected Call Report ID: " + callReportId); CallReportViewModel model = null; if (callReportId != 0) { ICallReportVO callReport = CallReportManager.RetrieveCallReport(callReportId); if (callReport != null) { model = (CallReportViewModel) CallReportMapper.Map(callReport, typeof(ICallReportVO), typeof(CallReportViewModel)); Session["SessionCallReport"] = callReport; if (Session["SessionCustomer"] == null) { if (Constants.GetEnumDescription(CustomerType.Individual).Equals(callReport.Customer.CustomerType)) { Session["SessionCustomer"] = (IIndividualCustomerVO)CustomerBO.RetrieveIndividualCustomer(callReport.Customer.Id); } else { Session["SessionCustomer"] = (ICompanyCustomerVO)CustomerBO.RetrieveCompanyCustomer(callReport.Customer.Id); } } } } if (model == null) { ICustomerVO sessionCustomer = (ICustomerVO)Session["SessionCustomer"]; model = new CallReportViewModel(); model.CustomerName = sessionCustomer.CustomerName; } // Needed to do this so that the client validation will not trigger. TempData["CallReportDetailModel"] = model; return(RedirectToAction("ViewCallReportDetails")); }
public ActionResult ViewCallReportDetails() { ICallReportVO sessionCallReport = (ICallReportVO)Session["SessionCallReport"]; CallReportViewModel model = (CallReportViewModel)TempData["CallReportDetailModel"]; ViewBag.CallPurposeList = GetDropdownList(CodeSetCode.CALL_PURPOSE, CallReportMapper); ViewBag.ReviewerList = GetUserList(new string[] { User.Identity.Name }); ViewBag.ActionList = GetActionList(sessionCallReport != null ? sessionCallReport.WorkflowProcessId : null); ViewBag.DisplayMode = DisplayMode.Edit; if (sessionCallReport != null && !string.IsNullOrEmpty(sessionCallReport.TaskStatus) && ("COMPLETED".Equals(sessionCallReport.TaskStatus) || (sessionCallReport.CurrentRecipient != null && !User.Identity.Name.Equals(sessionCallReport.CurrentRecipient.LoginId)))) { ViewBag.DisplayMode = DisplayMode.View; } return(View(model)); }