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; } } } } } }
public ICompanyCustomerVO UpdateCompanyCustomer( ICompanyCustomerVO sessionCustomer, ICompanyCustomerVO formCustomer) { Logger.Debug("UpdateCompanyCustomer|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.SaveCompanyCustomer(sessionCustomer)); }
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 IBusinessVO UpdateBusiness(IBusinessVO sessionBusiness, IBusinessVO formBusiness) { AccessorUtil.copyValue(formBusiness, sessionBusiness, BusinessVO.EXCLUDE_COPY); return(BusinessDAO.SaveBusiness(sessionBusiness)); }