private void UpdateProspectCustomer(long sourceCodeId) { IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); if (Session["ProspectCustomerId"] == null) { return; } var prospectCustomerId = (long)Session["ProspectCustomerId"]; if (prospectCustomerId <= 0) { return; } var prospectCustomer = uniqueItemRepository.GetById(prospectCustomerId); if (prospectCustomer == null) { return; } var sourceCodeRepository = IoC.Resolve <ISourceCodeRepository>(); bool isAWorkshopSourceCode; try { isAWorkshopSourceCode = sourceCodeRepository.IsSourceCodeAWorkshopSourceCode(txtCouponCode.Text.Trim()); } catch (Exception) { isAWorkshopSourceCode = false; } if (isAWorkshopSourceCode) { prospectCustomer.SourceCodeId = sourceCodeId; prospectCustomer.Source = ProspectCustomerSource.SalesRep; prospectCustomer.Tag = ProspectCustomerTag.WellnessSeminar; prospectCustomer.TagUpdateDate = DateTime.Now; } prospectCustomer.IsConverted = false; prospectCustomer = uniqueItemRepository.Save(prospectCustomer); if (prospectCustomer.Id > 0) { Session["ProspectCustomerId"] = prospectCustomer.Id; } }
private void SaveProspectCustomer() { if (CurrentProspectCustomer != null && !string.IsNullOrEmpty(CurrentProspectCustomer.FirstName) && !string.IsNullOrEmpty(CurrentProspectCustomer.LastName) && CurrentProspectCustomer.CallBackPhoneNumber != null && !string.IsNullOrEmpty(CurrentProspectCustomer.CallBackPhoneNumber.ToString()) && CurrentProspectCustomer.CallBackPhoneNumber.ToString() != "(___)-___-____") { IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); var prospectCustomer = uniqueItemRepository.Save(CurrentProspectCustomer); CurrentProspectCustomer = prospectCustomer; if (CallId != null && CallId > 0 && prospectCustomer.Id > 0) { var callWizardService = new CallCenterCallWizardService(); callWizardService.BindCurrentCallToProspectCustomer(CallId.Value, prospectCustomer.Id, IoC.Resolve <ISessionContext>().UserSession.UserId); } } }
private void SaveProspectCustomerNew(ProspectCustomer prospectCustomer) { if (prospectCustomer != null && !string.IsNullOrEmpty(prospectCustomer.FirstName) && !string.IsNullOrEmpty(prospectCustomer.LastName) && prospectCustomer.CallBackPhoneNumber != null && !string.IsNullOrWhiteSpace(prospectCustomer.CallBackPhoneNumber.ToString()) && prospectCustomer.CallBackPhoneNumber.ToString() != "(___)-___-____") { var isNewProspectCustomer = prospectCustomer.Id <= 0; IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); prospectCustomer = uniqueItemRepository.Save(prospectCustomer); CurrentProspectCustomerId = prospectCustomer.Id; if (isNewProspectCustomer && ExistingCallId > 0 && CurrentProspectCustomerId > 0) { var callWizardService = new CallCenterCallWizardService(); callWizardService.BindCurrentCallToProspectCustomer(ExistingCallId, CurrentProspectCustomerId, IoC.Resolve <ISessionContext>().UserSession.UserId); } } }
private void SaveProspectCustomer() { if (CurrentProspectCustomer == null || CurrentProspectCustomer.Id < 1) { return; } IProspectCustomerRepository prospectCustomerRepository = new ProspectCustomerRepository(); bool isAWorkshopProspect = prospectCustomerRepository.IsProspectAWorkshopProspect(CurrentProspectCustomer.Id); if (isAWorkshopProspect) { CurrentProspectCustomer.Source = ProspectCustomerSource.SalesRep; CurrentProspectCustomer.Tag = ProspectCustomerTag.WellnessSeminar; CurrentProspectCustomer.TagUpdateDate = DateTime.Now; IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); uniqueItemRepository.Save(CurrentProspectCustomer); return; } if (!string.IsNullOrEmpty(txtCouponCode.Text)) { ISourceCodeRepository sourceCodeRepository = new SourceCodeRepository(); bool isAWorkshopSourceCode; try { isAWorkshopSourceCode = sourceCodeRepository.IsSourceCodeAWorkshopSourceCode(txtCouponCode.Text.Trim()); } catch (Exception) { isAWorkshopSourceCode = false; } if (isAWorkshopSourceCode) { CurrentProspectCustomer.SourceCodeId = SourceCodeId; CurrentProspectCustomer.Source = ProspectCustomerSource.SalesRep; CurrentProspectCustomer.Tag = ProspectCustomerTag.WellnessSeminar; CurrentProspectCustomer.TagUpdateDate = DateTime.Now; IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); uniqueItemRepository.Save(CurrentProspectCustomer); } } }
private void UpdateProspectCustomer() { var prospectCustomerRepository = IoC.Resolve <IProspectCustomerRepository>(); var prospectCustomer = prospectCustomerRepository.GetProspectCustomerByCustomerId(CustomerId); if (prospectCustomer != null && RegistrationFlow != null) { RegistrationFlow.ProspectCustomerId = prospectCustomer.Id; return; } prospectCustomer = new ProspectCustomer(); ICustomerRepository customerRepository = new CustomerRepository(); var customer = customerRepository.GetCustomer(CustomerId); prospectCustomer.FirstName = customer.Name.FirstName; prospectCustomer.LastName = customer.Name.LastName; if (customer.HomePhoneNumber != null && !string.IsNullOrEmpty(customer.HomePhoneNumber.ToString())) { prospectCustomer.CallBackPhoneNumber = customer.HomePhoneNumber; } else if (customer.MobilePhoneNumber != null && !string.IsNullOrEmpty(customer.MobilePhoneNumber.ToString())) { prospectCustomer.CallBackPhoneNumber = customer.MobilePhoneNumber; } else if (customer.OfficePhoneNumber != null && !string.IsNullOrEmpty(customer.OfficePhoneNumber.ToString())) { prospectCustomer.CallBackPhoneNumber = customer.OfficePhoneNumber; } prospectCustomer.Address = new Address { City = customer.Address.City, Country = customer.Address.Country, State = customer.Address.State, StreetAddressLine1 = customer.Address.StreetAddressLine1, StreetAddressLine2 = customer.Address.StreetAddressLine2, ZipCode = new ZipCode { Zip = customer.Address.ZipCode.Zip } }; if (customer.DateOfBirth.HasValue) { prospectCustomer.BirthDate = customer.DateOfBirth.Value.Date; } if (!string.IsNullOrEmpty(customer.Email.ToString())) { prospectCustomer.Email = customer.Email; } prospectCustomer.CustomerId = CustomerId; prospectCustomer.Source = ProspectCustomerSource.CallCenter; prospectCustomer.Tag = ProspectCustomerTag.CallCenterSignup; prospectCustomer.TagUpdateDate = DateTime.Now; var eventRepository = IoC.Resolve <IEventRepository>(); prospectCustomer.IsConverted = eventRepository.CheckCustomerRegisteredForFutureEvent(CustomerId); if (!prospectCustomer.IsConverted.Value) { prospectCustomer.ConvertedOnDate = null; prospectCustomer.Status = (long)ProspectCustomerConversionStatus.NotConverted; prospectCustomer.CreatedOn = DateTime.Now; } IUniqueItemRepository <ProspectCustomer> uniqueItemRepository = new ProspectCustomerRepository(); prospectCustomer = uniqueItemRepository.Save(prospectCustomer); if (RegistrationFlow != null) { RegistrationFlow.ProspectCustomerId = prospectCustomer.Id; } }