Beispiel #1
0
        private IIndividualCustomerVO UpdateIndividualCustomer(IIndividualCustomerVO customer)
        {
            Logger.Debug("UpdateIndividualCustomer|Update an existing customer.");

            customer.LastUpdateDate = DateTime.Now;
            CurrentSession.SaveOrUpdate(customer);

            return(customer);
        }
Beispiel #2
0
 public virtual IIndividualCustomerVO SaveIndividualCustomer(IIndividualCustomerVO customer)
 {
     if (customer.Id == 0)
     {
         return(CreateIndividualCustomer(customer));
     }
     else
     {
         return(UpdateIndividualCustomer(customer));
     }
 }
Beispiel #3
0
        public IIndividualCustomerVO CreateIndividualCustomer(IIndividualCustomerVO customer)
        {
            Logger.Debug("CreateIndividualCustomer|Create a new customer.");

            MapAddressList(customer);

            // Should be message call to host system.
            customer.CifNumber = "90000" + customer.IdNumber;

            return(CustomerDAO.SaveIndividualCustomer(customer));
        }
Beispiel #4
0
        public ActionResult SaveIndividualCustomer(IndividualCustomerViewModel model, ActionType actionType)
        {
            Logger.Debug("SaveIndividualCustomer|Action type: " + actionType);

            if (actionType == ActionType.Save)
            {
                try
                {
                    if (CustomerBO.CheckIfIdCombinationExists(
                            Int32.Parse(model.IdType), model.IdNumber, model.IdIssuedCountry, model.Id))
                    {
                        TempData["MessageType"]        = MessageType.Error;
                        TempData["MessageDescription"] = CommonResources.MessageIdAlreadyExists;

                        TempData["CustomerDetailModel"] = model;
                        return(RedirectToAction("ViewCustomerDetails"));
                    }

                    IIndividualCustomerVO customer = (IndividualCustomerVO)
                                                     CustomerMapper.Map(model, typeof(IndividualCustomerViewModel), typeof(IndividualCustomerVO));
                    customer.LastUpdateBy = User.Identity.Name;

                    if (customer.Id == 0)
                    {
                        customer = CustomerBO.CreateIndividualCustomer(customer);
                    }
                    else
                    {
                        IIndividualCustomerVO sessionCustomer = (IIndividualCustomerVO)Session["SessionCustomer"];
                        customer = CustomerBO.UpdateIndividualCustomer(sessionCustomer, customer);
                    }

                    model = (IndividualCustomerViewModel)
                            CustomerMapper.Map(customer, typeof(IIndividualCustomerVO), typeof(IndividualCustomerViewModel));

                    Session["SessionCustomer"]     = customer;
                    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["CustomerDetailModel"] = model;
                return(RedirectToAction("ViewIndividualDetails"));
            }

            return(RedirectToAction("Welcome", "Home"));
        }
Beispiel #5
0
        private IIndividualCustomerVO CreateIndividualCustomer(IIndividualCustomerVO customer)
        {
            Logger.Debug("CreateIndividualCustomer|Create a new customer.");

            // LastUpdateBy will be set in the controller using the login user; hence, just copy.
            customer.CreateBy       = customer.LastUpdateBy;
            customer.CreationDate   = DateTime.Now;
            customer.LastUpdateDate = DateTime.Now;
            customer.BackendInd     = "Y";
            customer.BorrowerStatus = "ACTIVE";
            CurrentSession.Save(customer);

            return(customer);
        }
Beispiel #6
0
        public IIndividualCustomerVO UpdateIndividualCustomer(
            IIndividualCustomerVO sessionCustomer, IIndividualCustomerVO formCustomer)
        {
            Logger.Debug("UpdateIndividualCustomer|Update an existing customer.");

            AccessorUtil.copyValue(formCustomer, sessionCustomer, CustomerVO.EXCLUDE_COPY);
            MapAddressList(sessionCustomer, formCustomer);

            if (string.IsNullOrEmpty(sessionCustomer.CifNumber))
            {
                // Should be message call to host system.
                sessionCustomer.CifNumber = "90000" + sessionCustomer.IdNumber;
            }

            return(CustomerDAO.SaveIndividualCustomer(sessionCustomer));
        }