private IList <SelectListItem> GetActionList(Guid?processId)
        {
            IList <IActionTypeVO> actionList = CallReportManager.RetrieveActionList(processId);

            Logger.Debug("Search|Action DDL: " + (actionList != null ? actionList : null));

            return((IList <SelectListItem>)
                   CallReportMapper.Map(actionList, typeof(IList <IActionTypeVO>), typeof(IList <SelectListItem>)));
        }
        private IList <SelectListItem> GetUserList(IList <string> excludedUserLoginIdList)
        {
            IList <IUserVO> userList = CallReportManager.RetrieveUserList(excludedUserLoginIdList);

            Logger.Debug("Search|User DDL: " + (userList != null ? userList : null));

            return((IList <SelectListItem>)
                   CallReportMapper.Map(userList, typeof(IList <IUserVO>), typeof(IList <SelectListItem>)));
        }
        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 ViewCallReportList()
        {
            ClearSessionData();

            IEnumerable <ListCallReportViewModel> resultModel = new List <ListCallReportViewModel>();

            ICustomerVO sessionCustomer = (ICustomerVO)Session["SessionCustomer"];

            if (sessionCustomer != null)
            {
                IList <ICallReportVO> callReportList = CallReportManager.RetrieveCallReportsByCustomerId(sessionCustomer.Id);

                resultModel = (IEnumerable <ListCallReportViewModel>)
                              CallReportMapper.Map(callReportList,
                                                   typeof(IList <ICallReportVO>),
                                                   typeof(IEnumerable <ListCallReportViewModel>));
            }

            return(View(resultModel));
        }