public CallReportPage(string dateFrom, string dateTo, UserTypes userType) { InitializeComponent(); var viewModel = new CallReportViewModel(dateFrom, dateTo, userType); this.BindingContext = viewModel; }
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)); }