コード例 #1
0
ファイル: CustomerBO.cs プロジェクト: qcoliveros/ClosDotNet
 private void MapAddressList(ICustomerVO sessionCustomer, ICustomerVO formCustomer)
 {
     if (formCustomer.AddressList.Count > 0)
     {
         foreach (IAddressVO formAddress in formCustomer.AddressList)
         {
             if (formAddress.Id == 0)
             {
                 formAddress.Customer = sessionCustomer;
                 sessionCustomer.AddressList.Add(formAddress);
             }
             else
             {
                 foreach (IAddressVO sessionAddress in sessionCustomer.AddressList)
                 {
                     if (formAddress.Id == sessionAddress.Id)
                     {
                         AccessorUtil.copyValue(formAddress, sessionAddress, AddressVO.EXCLUDE_COPY);
                         sessionAddress.LastUpdateBy   = sessionCustomer.LastUpdateBy;
                         sessionAddress.LastUpdateDate = DateTime.Now;
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
        public ActionResult ViewBusiness()
        {
            ClearSessionData();

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

            if (sessionCustomer != null)
            {
                IBusinessVO business = BusinessBO.RetrieveBusinessByCustomerId(sessionCustomer.Id);
                if (business == null)
                {
                    business = new BusinessVO();
                }
                Session["SessionBusiness"] = business;

                BusinessViewModel model = (BusinessViewModel)BusinessMapper.Map(
                    business, typeof(IBusinessVO), typeof(BusinessViewModel));
                if (string.IsNullOrEmpty(model.CurrentPaidUpCapitalCurrency))
                {
                    model.CurrentPaidUpCapitalCurrency = Constants.GetEnumDescription(Currency.SingaporeDollar);
                }

                // Needed to do this so that the client validation will not trigger.
                TempData["BusinessDetailModel"] = model;
            }

            return(RedirectToAction("ViewBusinessDetails"));
        }
コード例 #3
0
        public static bool IsIndividualCustomer(ICustomerVO customer)
        {
            if (customer != null &&
                Constants.GetEnumDescription(CustomerType.Individual).Equals(customer.CustomerType))
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
        public static bool IsCompanyCustomer(ICustomerVO customer)
        {
            if (customer != null &&
                Constants.GetEnumDescription(CustomerType.Corporate).Equals(customer.CustomerType))
            {
                return(true);
            }

            return(false);
        }
コード例 #5
0
ファイル: CustomerBO.cs プロジェクト: qcoliveros/ClosDotNet
 private void MapAddressList(ICustomerVO sessionCustomer)
 {
     if (sessionCustomer.AddressList.Count > 0)
     {
         foreach (IAddressVO address in sessionCustomer.AddressList)
         {
             address.Customer = sessionCustomer;
         }
     }
 }
コード例 #6
0
        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"));
        }
コード例 #7
0
        public ActionResult SearchByCifNumber(SearchViewModel searchModel)
        {
            Logger.Debug("SearchByCifNumber|Search CIF number: " + searchModel.SeachCifNumber.CifNumber);
            IList <ICustomerVO> customerList = new List <ICustomerVO>();

            ICustomerVO customer = CustomerBO.RetrieveCustomerByCifNumber(searchModel.SeachCifNumber.CifNumber);

            if (customer != null)
            {
                customerList.Add(customer);
            }

            Logger.Debug("SearchByCifNumber|Search Result: " + (customerList != null ? customerList.Count : 0));

            TempData["SearchResultList"] = customerList;
            return(RedirectToAction("ViewSearchResult"));
        }
コード例 #8
0
        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"));
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        public ActionResult SaveBusiness(BusinessViewModel model)
        {
            try
            {
                IBusinessVO business = (BusinessVO)
                                       BusinessMapper.Map(model, typeof(BusinessViewModel), typeof(BusinessVO));
                business.LastUpdateBy = User.Identity.Name;

                ICustomerVO sessionCustomer = (ICustomerVO)Session["SessionCustomer"];
                business.Customer = sessionCustomer;

                if (business.Id == 0)
                {
                    business = BusinessBO.CreateBusiness(business);
                }
                else
                {
                    IBusinessVO sessionBusiness = (IBusinessVO)Session["SessionBusiness"];
                    business = BusinessBO.UpdateBusiness(sessionBusiness, business);
                }

                model = (BusinessViewModel)
                        BusinessMapper.Map(business, typeof(IBusinessVO), typeof(BusinessViewModel));

                Session["SessionBusiness"]     = business;
                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["BusinessDetailModel"] = model;
            return(RedirectToAction("ViewBusinessDetails"));
        }
コード例 #11
0
        public ActionResult SearchByIdCombination(SearchViewModel searchModel)
        {
            Logger.Debug("SearchByIdCombination|Search ID combination: " +
                         searchModel.SeachIdCombination.IdType + "|" +
                         searchModel.SeachIdCombination.IdNumber + "|" +
                         searchModel.SeachIdCombination.IdIssuedCountry);
            IList <ICustomerVO> customerList = new List <ICustomerVO>();

            ICustomerVO customer = CustomerBO.RetrieveCustomerByIdCombination(
                searchModel.SeachIdCombination.IdType,
                searchModel.SeachIdCombination.IdNumber,
                searchModel.SeachIdCombination.IdIssuedCountry);

            if (customer != null)
            {
                customerList.Add(customer);
            }

            Logger.Debug("SearchByIdCombination|Search Result: " + (customerList != null ? customerList.Count : 0));

            TempData["SearchResultList"] = customerList;
            return(RedirectToAction("ViewSearchResult"));
        }
コード例 #12
0
        public ActionResult ViewIndividualDetails()
        {
            CustomerViewModel model = (IndividualCustomerViewModel)TempData["CustomerDetailModel"];

            if (model == null)
            {
                ICustomerVO customer = (IIndividualCustomerVO)Session["SessionCustomer"];
                if (customer != null)
                {
                    model = (IndividualCustomerViewModel)
                            CustomerMapper.Map(customer, typeof(IIndividualCustomerVO), typeof(IndividualCustomerViewModel));
                    TempData["CustomerDetailModel"] = model;
                }
            }

            PrepareOptionsList(CustomerType.Individual);
            ViewBag.DisplayMode = DisplayMode.Edit;
            if (User.IsInRole(Constants.GetEnumDescription(UserRole.CA)))
            {
                ViewBag.DisplayMode = DisplayMode.View;
            }

            return(View(model));
        }