Beispiel #1
0
        public ActionResult ViewCustomer(int?customerId, string customerType)
        {
            Logger.Debug("ViewCustomer|Selected Customer ID: " + customerId);

            if (customerId != null)
            {
                if (Constants.GetEnumDescription(CustomerType.Individual).Equals(customerType))
                {
                    Session["SessionCustomer"] =
                        (IIndividualCustomerVO)CustomerBO.RetrieveIndividualCustomer(customerId ?? default(int));
                }
                else
                {
                    Session["SessionCustomer"] =
                        (ICompanyCustomerVO)CustomerBO.RetrieveCompanyCustomer(customerId ?? default(int));
                }
            }

            if (Constants.GetEnumDescription(CustomerType.Individual).Equals(customerType))
            {
                return(RedirectToAction("ViewIndividualDetails"));
            }

            return(RedirectToAction("ViewCompanyDetails"));
        }
        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"));
        }