Example #1
0
 public Host CreateHost(ProspectsEntity prospectsEntity, Address address, Address mailingAddress)
 {
     return(new Host(prospectsEntity.ProspectId)
     {
         Address = address,
         MailingAddress = mailingAddress,
         OrganizationName = prospectsEntity.OrganizationName ?? string.Empty,
         TaxIdNumber = prospectsEntity.TaxIdNumber ?? string.Empty,
         Notes = prospectsEntity.Notes,
         Email = _emailFactory.CreateEmail(prospectsEntity.EmailId),
         OfficePhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(prospectsEntity.PhoneOffice, PhoneNumberType.Office),
         MobilePhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(prospectsEntity.PhoneCell, PhoneNumberType.Mobile),
         OtherPhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(prospectsEntity.PhoneOther, PhoneNumberType.Unknown),
         Status =
             HostStatus.HostStatuses.Find(
                 hostStatus => hostStatus.PersistenceLayerId.ToString() == prospectsEntity.Status),
         Type = prospectsEntity.ProspectTypeId.HasValue ? ((HostProspectType)prospectsEntity.ProspectTypeId.Value) : HostProspectType.Other,
         FaxNumber = _phoneNumberFactory.CreatePhoneNumber(prospectsEntity.Fax, PhoneNumberType.Unknown),
         DataRecorderMetaData = new DataRecorderMetaData
         {
             DateCreated = prospectsEntity.DateCreated,
             DateModified = prospectsEntity.DateModified,
             DataRecorderCreator = prospectsEntity.OrgRoleUserId.HasValue ? new OrganizationRoleUser(prospectsEntity.OrgRoleUserId.Value) : null
         },
         IsHost = prospectsEntity.IsHost.HasValue && prospectsEntity.IsHost.Value
     });
 }
Example #2
0
 private void ExpectFactoryCalls(int repeatCount)
 {
     Expect.Call(_emailFactory.CreateEmail(null)).IgnoreArguments()
     .Return(new Email(string.Empty, string.Empty)).Repeat.Times(2 * repeatCount);
     Expect.Call(_phoneNumberFactory.CreatePhoneNumber(null, 0)).IgnoreArguments()
     .Return(new PhoneNumber(null, null, 0)).Repeat.Times(3 * repeatCount);
     Expect.Call(_userLoginFactory.CreateUserLogin(null)).IgnoreArguments()
     .Return(new UserLogin(0)).Repeat.Times(repeatCount);
 }
Example #3
0
        public PhoneNumber GetGlocomNumber(long accountId, long stateId, long customerId, long?callId = null)
        {
            var accountCheckoutPhoneNumbers = _accountCheckoutPhoneNumberRepository.GetAccountCheckoutPhoneNumberByStateID(accountId, stateId);

            if (accountCheckoutPhoneNumbers.IsNullOrEmpty())
            {
                return(null);
            }

            var phoneNumber = string.Empty;
            var customerAccountGlocomNumbers = _customerAccountGlocomNumberRepository.GetByCustomerId(customerId)
                                               .Where(x => accountCheckoutPhoneNumbers.Select(acpn => acpn.CheckoutPhoneNumber).Contains(x.GlocomNumber));
            CustomerAccountGlocomNumber checkoutPhoneNumberForCall = null;

            if (!customerAccountGlocomNumbers.IsNullOrEmpty())
            {
                if (callId != null && callId > 0)
                {
                    checkoutPhoneNumberForCall = customerAccountGlocomNumbers.OrderByDescending(x => x.CreatedDate).FirstOrDefault(x => x.CallId == callId);
                    if (checkoutPhoneNumberForCall != null)
                    {
                        phoneNumber = checkoutPhoneNumberForCall.GlocomNumber;
                        return(_phoneNumberFactory.CreatePhoneNumber(phoneNumber, PhoneNumberType.Unknown));
                    }
                }
                var checkoutPhoneNumbers = (from acpn in accountCheckoutPhoneNumbers where !customerAccountGlocomNumbers.Select(x => x.GlocomNumber).Contains(acpn.CheckoutPhoneNumber) select acpn);
                if (!checkoutPhoneNumbers.IsNullOrEmpty())
                {
                    var glocomNumber = checkoutPhoneNumbers.First();
                    phoneNumber = glocomNumber.CheckoutPhoneNumber;
                }
                else
                {
                    var glocomNumber = customerAccountGlocomNumbers.First();
                    phoneNumber = glocomNumber.GlocomNumber;
                }
            }
            else
            {
                var glocomNumber = accountCheckoutPhoneNumbers.First();
                phoneNumber = glocomNumber.CheckoutPhoneNumber;
            }

            if (string.IsNullOrEmpty(phoneNumber))
            {
                return(null);
            }
            else
            {
                return(_phoneNumberFactory.CreatePhoneNumber(phoneNumber, PhoneNumberType.Unknown));
            }
        }
Example #4
0
 protected override void MapDomainFields(OrganizationEntity entity, Organization domainObjectToMapTo)
 {
     domainObjectToMapTo.BillingAddressId  = entity.BillingAddressId != null ? entity.BillingAddressId.Value : 0;
     domainObjectToMapTo.BusinessAddressId = entity.BusinessAddressId != null ? entity.BusinessAddressId.Value : 0;
     domainObjectToMapTo.Description       = entity.Description;
     domainObjectToMapTo.Email             = entity.Email;
     domainObjectToMapTo.FaxNumber         = _phoneNumberFactory.CreatePhoneNumber(entity.FaxNumber, PhoneNumberType.Unknown);
     domainObjectToMapTo.Id               = entity.OrganizationId;
     domainObjectToMapTo.Name             = entity.Name;
     domainObjectToMapTo.OrganizationType = (OrganizationType)entity.OrganizationTypeId;
     domainObjectToMapTo.PhoneNumber      = _phoneNumberFactory.CreatePhoneNumber(entity.PhoneNumber, PhoneNumberType.Unknown);
     domainObjectToMapTo.LogoImageId      = entity.LogoImageId != null ? entity.LogoImageId.Value : 0;
     domainObjectToMapTo.TeamImageId      = entity.TeamImageId != null ? entity.TeamImageId.Value : 0;
 }
Example #5
0
 public Contact CreateContact(ContactsEntity contactsEntity)
 {
     return(new Contact(contactsEntity.ContactId)
     {
         Name = new Name(contactsEntity.FirstName, contactsEntity.MiddleName, contactsEntity.LastName),
         Email = _emailFactory.CreateEmail(contactsEntity.Email),
         HomePhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(contactsEntity.PhoneHome, PhoneNumberType.Home),
         MobilePhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(contactsEntity.PhoneCell, PhoneNumberType.Mobile),
         OfficePhoneNumber =
             _phoneNumberFactory.CreatePhoneNumber(contactsEntity.PhoneOffice, PhoneNumberType.Office),
         OfficePhoneExtn = contactsEntity.PhoneOfficeExtension
     });
 }
        protected override void MapDomainFields(ProspectCustomerEntity entity, ProspectCustomer domainObjectToMapTo)
        {
            domainObjectToMapTo.Id      = entity.ProspectCustomerId;
            domainObjectToMapTo.Address = new Address
            {
                City  = entity.City,
                State = entity.State,
                StreetAddressLine1 = entity.Address1,
                StreetAddressLine2 = entity.Address2,
                ZipCode            = new ZipCode {
                    Zip = entity.ZipCode
                }
            };
            domainObjectToMapTo.BirthDate       = entity.Dob;
            domainObjectToMapTo.Email           = _emailFactory.CreateEmail(entity.Email);
            domainObjectToMapTo.FirstName       = entity.FirstName;
            domainObjectToMapTo.LastName        = entity.LastName;
            domainObjectToMapTo.MarketingSource = entity.MarketingSource;
            domainObjectToMapTo.PhoneNumber     = _phoneNumberFactory.CreatePhoneNumber(entity.IncomingPhoneLine,
                                                                                        PhoneNumberType.Unknown);
            domainObjectToMapTo.CallBackPhoneNumber = _phoneNumberFactory.CreatePhoneNumber(entity.CallbackNo,
                                                                                            PhoneNumberType.Unknown);
            domainObjectToMapTo.SourceCodeId = entity.SourceCodeId;
            domainObjectToMapTo.Gender       = !string.IsNullOrEmpty(entity.Gender)
                                             ? (Gender)Enum.Parse(typeof(Gender), entity.Gender, true)
                                             : Gender.Unspecified;
            domainObjectToMapTo.Source = (ProspectCustomerSource)entity.Source;
            domainObjectToMapTo.Tag    = !string.IsNullOrEmpty(entity.Tag)
                                          ? (ProspectCustomerTag)
                                         Enum.Parse(typeof(ProspectCustomerTag), entity.Tag, true)
                                          : ProspectCustomerTag.Unspecified;

            domainObjectToMapTo.IsConverted           = entity.IsConverted;
            domainObjectToMapTo.CustomerId            = entity.CustomerId;
            domainObjectToMapTo.ConvertedOnDate       = entity.DateConverted;
            domainObjectToMapTo.CreatedOn             = entity.DateCreated;
            domainObjectToMapTo.IsContacted           = entity.IsContacted;
            domainObjectToMapTo.ContactedDate         = entity.ContactedDate;
            domainObjectToMapTo.ContactedBy           = entity.ContactedBy;
            domainObjectToMapTo.Status                = entity.Status;
            domainObjectToMapTo.CallBackRequestedOn   = entity.CallBackRequestedOn;
            domainObjectToMapTo.CallBackRequestedDate = entity.CallBackRequestedDate;
            domainObjectToMapTo.CallBackRequestedDate = entity.CallBackRequestedDate;
            domainObjectToMapTo.IsQueuedForCallBack   = entity.IsQueuedForCallBack;
            domainObjectToMapTo.TagUpdateDate         = entity.TagUpdateDate;
        }
 public override NotificationPhone Map(NotificationPhoneEntity objectToMap)
 {
     return(new NotificationPhone(objectToMap.NotificationPhoneId)
     {
         PhoneCell = _phoneNumberFactory.CreatePhoneNumber(objectToMap.PhoneCell, PhoneNumberType.Mobile),
         Message = objectToMap.Message,
         ServicedBy = objectToMap.ServicedBy
     });
 }
Example #8
0
        public UserType CreateUser(UserEntity userEntity, Address address, bool useUserLoginInfo = true)
        {
            if (userEntity == null)
            {
                throw new ArgumentNullException("userEntity");
            }

            // this workaround is necessary because although C# generics allow a default constructor constraint on a type, they do not allow
            // constraints for parameterized constructors.
            var user = (UserType)Activator.CreateInstance(typeof(UserType), userEntity.UserId);

            user.Address     = address;
            user.DateOfBirth = userEntity.Dob;


            user.Email          = !string.IsNullOrEmpty(userEntity.Email1) ? new Email(userEntity.Email1) : new Email(string.Empty, string.Empty);
            user.AlternateEmail = !string.IsNullOrEmpty(userEntity.Email2) ? new Email(userEntity.Email2) : new Email(string.Empty, string.Empty);

            user.HomePhoneNumber   = _phoneNumberFactory.CreatePhoneNumber(userEntity.PhoneHome, PhoneNumberType.Home);
            user.MobilePhoneNumber = _phoneNumberFactory.CreatePhoneNumber(userEntity.PhoneCell, PhoneNumberType.Mobile);
            user.Name = new Name(userEntity.FirstName, userEntity.MiddleName, userEntity.LastName);
            user.OfficePhoneNumber    = _phoneNumberFactory.CreatePhoneNumber(userEntity.PhoneOffice, PhoneNumberType.Office);
            user.PhoneOfficeExtension = userEntity.PhoneOfficeExtension;
            if (useUserLoginInfo)
            {
                user.UserLogin = _userLoginFactory.CreateUserLogin(userEntity.UserLogin);
            }
            if (userEntity.DefaultRoleId != null)
            {
                user.DefaultRole = (Roles)userEntity.DefaultRoleId.Value;
            }

            user.DataRecorderMetaData = new DataRecorderMetaData
            {
                DateCreated  = userEntity.DateCreated,
                DateModified = userEntity.DateModified
            };
            user.Ssn = !string.IsNullOrEmpty(userEntity.Ssn) ? _cryptographyService.Decrypt(userEntity.Ssn) : string.Empty;

            return(user);
        }
Example #9
0
 public override NotificationSubscriber Map(NotificationSubscribersEntity objectToMap)
 {
     return(new NotificationSubscriber(objectToMap.NotificationSubscriberId)
     {
         DateCreated = objectToMap.DateCreated.GetValueOrDefault(SqlDateTime.MinValue.Value),
         DateModified = objectToMap.DateModified,
         Email = new Email(objectToMap.Email),
         Name = objectToMap.Name,
         Phone = _phoneNumberFactory.CreatePhoneNumber(objectToMap.Phone, PhoneNumberType.Unknown),
         UserId = objectToMap.UserId,
         NotificationTypeId = objectToMap.NotificationTypeId,
     });
 }
Example #10
0
        public List <ProspectCustomerViewData> CreateViewDataForCallCenterRep(List <ProspectCustomerEntity> listProspectCustomer,
                                                                              List <OrderedPair <SeminarsEntity, long> > listSeminarSourceCodePair,
                                                                              List <OrderedPair <long, string> > listSourceCodeIdpair)
        {
            var listProspectCustomerViewData = new List <ProspectCustomerViewData>();

            string   wellnessSeminar = "";
            string   sourceCode      = "";
            DateTime seminarDate     = DateTime.Now;

            listProspectCustomer.ForEach(prospectCustomer => {
                sourceCode = "";

                if (prospectCustomer.SourceCodeId != null)
                {
                    var selectedSourceCodeIdPair = listSourceCodeIdpair.Find(sourceCodeIdpair => sourceCodeIdpair.FirstValue == prospectCustomer.SourceCodeId.Value);
                    if (selectedSourceCodeIdPair != null)
                    {
                        sourceCode = selectedSourceCodeIdPair.SecondValue;
                    }

                    var selectedSeminarSourceCodePair = listSeminarSourceCodePair.Find(seminarSourceCode => seminarSourceCode.SecondValue == prospectCustomer.SourceCodeId.Value);
                    if (selectedSeminarSourceCodePair != null)
                    {
                        wellnessSeminar = selectedSeminarSourceCodePair.FirstValue.Name;
                        seminarDate     = selectedSeminarSourceCodePair.FirstValue.SeminarDate;
                    }
                }

                var prospectCustomerViewData = new ProspectCustomerViewData()
                {
                    ProspectCustomerId = prospectCustomer.ProspectCustomerId,
                    FirstName          = prospectCustomer.FirstName,
                    LastName           = prospectCustomer.LastName,
                    AddressLine1       = prospectCustomer.Address1,
                    AddressLine2       = prospectCustomer.Address2,
                    City            = prospectCustomer.City,
                    State           = prospectCustomer.State,
                    Zip             = prospectCustomer.ZipCode,
                    WellnessSeminar = wellnessSeminar,
                    SourceCode      = sourceCode,
                    SeminarDate     = seminarDate,
                    PhoneHome       = _phoneNumberFactory.CreatePhoneNumber(prospectCustomer.CallbackNo, PhoneNumberType.Home)
                };
                listProspectCustomerViewData.Add(prospectCustomerViewData);
            });

            return(listProspectCustomerViewData);
        }
Example #11
0
        private bool CheckForPhoneNumberUpdate(PhoneNumber phoneNumber, PhoneNumber phoneForPersistnece)
        {
            if (phoneNumber == null && phoneForPersistnece == null)
            {
                return(false);
            }
            if (phoneNumber != null && phoneForPersistnece == null)
            {
                return(true);
            }
            if (phoneNumber == null && phoneForPersistnece != null)
            {
                return(true);
            }

            var phoneNumberFormated = _phoneNumberFactory.CreatePhoneNumber(phoneForPersistnece.ToString(), phoneForPersistnece.PhoneNumberType);

            return(phoneNumber.ToString() != phoneNumberFormated.ToString());
        }
Example #12
0
 protected override void MapDomainFields(HospitalPartnerEntity entity,
                                         HospitalPartner domainObjectToMapTo)
 {
     domainObjectToMapTo.Id = entity.HospitalPartnerId;
     domainObjectToMapTo.AssociatedPhoneNumber = _phoneNumberFactory.CreatePhoneNumber(entity.AssociatedPhoneNumber, PhoneNumberType.Unknown);
     domainObjectToMapTo.IsGlobal        = entity.IsGlobal;
     domainObjectToMapTo.MailTransitDays = entity.MailTransitDays;
     domainObjectToMapTo.AdvocateId      = entity.AdvocateId;
     domainObjectToMapTo.TerritoryIds    = !entity.HospitalPartnerTerritory.IsNullOrEmpty()
                                           ? entity.HospitalPartnerTerritory.Select(hpt => hpt.TerritoryId)
                                           : null;
     domainObjectToMapTo.NormalResultValidityPeriod   = entity.NormalResultValidityPeriod;
     domainObjectToMapTo.AbnormalResultValidityPeriod = entity.AbnormalResultValidityPeriod;
     domainObjectToMapTo.CriticalResultValidityPeriod = entity.CriticalResultValidityPeriod;
     domainObjectToMapTo.HealthAssessmentTemplateId   = entity.HafTemplateId;
     domainObjectToMapTo.CannedMessage               = entity.CannedMessage;
     domainObjectToMapTo.CaptureSsn                  = entity.CaptureSsn;
     domainObjectToMapTo.RecommendPackage            = entity.RecommendPackage;
     domainObjectToMapTo.AskPreQualificationQuestion = entity.AskPreQualificationQuestion;
     domainObjectToMapTo.AttachDoctorLetter          = entity.AttachDoctorLetter;
     domainObjectToMapTo.RestrictEvaluation          = entity.RestrictEvaluation;
     domainObjectToMapTo.ShowOnlineShipping          = entity.ShowOnlineShipping;
 }
Example #13
0
        private NotificationPhone MapNotificationPhone(NotificationEntity objectToMap)
        {
            var notificationPhone = new NotificationPhone(objectToMap.NotificationId);

            _notificationPopulator.Populate(objectToMap, notificationPhone);

            var entity = objectToMap.NotificationPhone;

            notificationPhone.Message   = entity.Message;
            notificationPhone.PhoneCell = string.IsNullOrEmpty(entity.PhoneCell) ? null : _phoneNumberFactory.CreatePhoneNumber(entity.PhoneCell, PhoneNumberType.Mobile);
            // TODO: this does not truly belong here...
            notificationPhone.ServicedBy = entity.ServicedBy;

            return(notificationPhone);
        }
        public void CreatePhoneNumberSetsPhoneNumberTypeToGivenType()
        {
            const PhoneNumberType expectedPhoneNumberType = PhoneNumberType.Mobile;

            PhoneNumber phoneNumber = _factory.CreatePhoneNumber("000-000-00000", expectedPhoneNumberType);

            Assert.AreEqual(expectedPhoneNumberType, phoneNumber.PhoneNumberType);
        }
        public void SmsReceivedNotification(TwillioMessageResponse message)
        {
            if (message != null)
            {
                var phoneMobile = _phoneNumberFactory.CreatePhoneNumber(message.From, PhoneNumberType.Mobile);
                if (phoneMobile == null)
                {
                    return;
                }

                var mobilePhonNumber = phoneMobile.AreaCode + phoneMobile.Number;
                var customers        = _customerRepository.GetCustomersByPhoneNumber(mobilePhonNumber, PhoneNumberType.Mobile);
                var smsReceivedTime  = DateTime.Now;

                var smsReceived = new SmsReceived
                {
                    DateCreated = smsReceivedTime,
                    Message     = message.Body,
                    PhoneNumber = mobilePhonNumber
                };

                smsReceived = _smsReceivedRepository.SaveSmsReceived(smsReceived);

                if (customers.IsNullOrEmpty())
                {
                    _logger.Info("No customer found with matching Phone Number");
                    return;
                }

                if (!string.IsNullOrEmpty(message.Body) && SmsOptOutKeyWords.OptOutKey.Contains(message.Body.ToLower()))
                {
                    var unsubscriptModel = new CustomerUnsubscribedSmsNotification
                    {
                        DateCreated   = smsReceivedTime,
                        SmsReceivedId = smsReceived.Id,
                        StatusId      = (long)SmsNotificationSubscriptionStatus.Unsubscribe
                    };

                    foreach (var customer in customers)
                    {
                        unsubscriptModel.CustomerId = customer.CustomerId;

                        _customerUnsubscribedSmsNotificationRepository.SaveUnsubscribedSmsStatus(unsubscriptModel);

                        customer.IsSubscribed = false;
                        _customerService.SaveCustomerOnly(customer, customer.CustomerId);
                    }
                }
                else if (!string.IsNullOrEmpty(message.Body) && SmsOptInKeyWords.OptInKey.Contains(message.Body.ToLower()))
                {
                    var unsubscriptModel = new CustomerUnsubscribedSmsNotification
                    {
                        DateCreated   = smsReceivedTime,
                        SmsReceivedId = smsReceived.Id,
                        StatusId      = (long)SmsNotificationSubscriptionStatus.Subscribe
                    };

                    foreach (var customer in customers)
                    {
                        unsubscriptModel.CustomerId = customer.CustomerId;
                        _customerUnsubscribedSmsNotificationRepository.SaveUnsubscribedSmsStatus(unsubscriptModel);

                        customer.IsSubscribed = true;
                        _customerService.SaveCustomerOnly(customer, customer.CustomerId);
                    }
                }
                else
                {
                    if (!customers.IsNullOrEmpty())
                    {
                        Customer customer = null;
                        if (customers.Count() > 1)
                        {
                            var lastNotificationSentTo =
                                _notificationRepository.GetLatestNotificationByPhone(mobilePhonNumber);
                            customer = customers.FirstOrDefault(s => s.Id == lastNotificationSentTo.UserId) ?? customers.First();
                        }
                        else
                        {
                            customer = customers.First();
                        }

                        if (customer != null)
                        {
                            var screeningReminderSmsNotification = _phoneNotificationModelsFactory.GetDummyWrongSmsResponseNotificationViewModel();

                            var notification = _notifier.NotifyViaSms(NotificationTypeAlias.WrongSmsReponse, EmailTemplateAlias.WrongSmsReponse, screeningReminderSmsNotification, customer.Id, customer.CustomerId, "Wrong Sms Response");
                        }
                    }
                }
            }
        }
Example #16
0
        public Customer CreateCustomer(Customer customer, Address billingAddress, CustomerProfileEntity customersEntity)
        {
            NullArgumentChecker.CheckIfNull(customer, "customer");
            NullArgumentChecker.CheckIfNull(customersEntity, "customersEntity");

            customer.AddedByRoleId = customersEntity.AddedByRoleId;
            customer.CustomerId    = customersEntity.CustomerId;
            customer.Gender        = !string.IsNullOrEmpty(customersEntity.Gender) ? (Gender)Enum.Parse(typeof(Gender), customersEntity.Gender, true) : Gender.Unspecified;
            var height = !string.IsNullOrEmpty(customersEntity.Height) ? Convert.ToDouble(customersEntity.Height) : 0;

            if (height != 0)
            {
                var inches = height % 12;
                var feet   = (height - inches) / 12;
                customer.Height = new Height(feet, inches);
            }
            customer.MarketingSource = customersEntity.TrackingMarketingId;
            customer.Race            = !string.IsNullOrEmpty(customersEntity.Race)
                                ? (Race)Enum.Parse(typeof(Race), customersEntity.Race, true)
                                : Race.None;
            customer.Weight         = new Weight(customersEntity.Weight ?? 0);
            customer.BillingAddress = billingAddress;
            customer.DateCreated    = customersEntity.DateCreated;
            customer.DateModified   = customersEntity.DateModified;

            customer.DisplayCode = customersEntity.DisplayId.HasValue
                                       ? customersEntity.DisplayId.Value.ToString()
                                       : string.Empty;
            customer.Employer                     = customersEntity.Employer;
            customer.EmergencyContactName         = customersEntity.EmergencyContactName;
            customer.EmergencyContactRelationship = customersEntity.EmergencyContactRelationship;
            customer.EmergencyContactPhoneNumber  = _phoneNumberFactory.CreatePhoneNumber(customersEntity.EmergencyContactPhoneNumber, PhoneNumberType.Office);

            customer.DoNotContactTypeId        = customersEntity.DoNotContactTypeId;
            customer.DoNotContactReasonId      = customersEntity.DoNotContactReasonId;
            customer.DoNotContactReasonNotesId = customersEntity.DoNotContactReasonNotesId;
            customer.RequestForNewsLetter      = customersEntity.RequestNewsLetter;
            //customer.LastScreeningDate = customersEntity.UserDefined1;
            customer.EmployeeId        = customersEntity.EmployeeId;
            customer.InsuranceId       = customersEntity.InsuranceId;
            customer.PreferredLanguage = customersEntity.PreferredLanguage;
            customer.BestTimeToCall    = customersEntity.BestTimeToCall;
            customer.Waist             = customersEntity.Waist.HasValue && customersEntity.Waist.Value > 0 ? customersEntity.Waist.Value : (decimal?)null;
            customer.Tag                       = customersEntity.Tag ?? string.Empty;
            customer.Hicn                      = customersEntity.Hicn;
            customer.EnableTexting             = customersEntity.EnableTexting;
            customer.MedicareAdvantageNumber   = customersEntity.MedicareAdvantageNumber;
            customer.MedicareAdvantagePlanName = customersEntity.MedicareAdvantagePlanName;
            //customer.IsEligible = customersEntity.IsEligble;              //Column Moved from this table
            customer.LabId                  = customersEntity.LabId;
            customer.LanguageId             = customersEntity.LanguageId;
            customer.Copay                  = customersEntity.Copay;
            customer.Lpi                    = customersEntity.Lpi;
            customer.Market                 = customersEntity.Market;
            customer.Mrn                    = customersEntity.Mrn;
            customer.GroupName              = customersEntity.GroupName;
            customer.IsIncorrectPhoneNumber = customersEntity.IsIncorrectPhoneNumber;
            customer.IsLanguageBarrier      = customersEntity.IsLanguageBarrier;
            customer.EnableVoiceMail        = customersEntity.EnableVoiceMail;
            customer.AdditionalField1       = customersEntity.AdditionalField1;
            customer.AdditionalField2       = customersEntity.AdditionalField2;
            customer.AdditionalField3       = customersEntity.AdditionalField3;
            customer.AdditionalField4       = customersEntity.AdditionalField4;
            customer.ActivityId             = customersEntity.ActivityId;

            customer.DoNotContactUpdateDate = customersEntity.DoNotContactUpdateDate;
            //customer.IsDuplicate = customersEntity.IsDuplicate;
            customer.DoNotContactUpdateSource = customersEntity.DoNotContactUpdateSource;

            customer.IsSubscribed = customersEntity.IsSubscribed;

            customer.LanguageBarrierMarkedDate      = customersEntity.LanguageBarrierMarkedDate;
            customer.IncorrectPhoneNumberMarkedDate = customersEntity.IncorrectPhoneNumberMarkedDate;
            customer.PreferredContactType           = customersEntity.PreferredContactType;
            customer.AcesId = customersEntity.AcesId;

            customer.Mbi = customersEntity.Mbi;

            customer.PhoneCellConsentId           = customersEntity.PhoneCellConsentId;
            customer.PhoneHomeConsentId           = customersEntity.PhoneHomeConsentId;
            customer.PhoneOfficeConsentId         = customersEntity.PhoneOfficeConsentId;
            customer.PhoneHomeConsentUpdateDate   = customersEntity.PhoneHomeConsentUpdateDate;
            customer.PhoneCellConsentUpdateDate   = customersEntity.PhoneCellConsentUpdateDate;
            customer.PhoneOfficeConsentUpdateDate = customersEntity.PhoneOfficeConsentUpdateDate;
            customer.BillingMemberId       = customersEntity.BillingMemberId;
            customer.BillingMemberPlan     = customersEntity.BillingMemberPlan;
            customer.BillingMemberPlanYear = customersEntity.BillingMemberPlanYear;
            customer.EnableEmail           = customersEntity.EnableEmail;
            customer.EnableEmailUpdateDate = customersEntity.EnableEmailUpdateDate;
            customer.MemberUploadSourceId  = customersEntity.MemberUploadSourceId;
            customer.ActivityTypeIsManual  = customersEntity.ActivityTypeIsManual;
            customer.ProductTypeId         = customersEntity.ProductTypeId;
            customer.AcesClientId          = customersEntity.AcesClientId;

            return(customer);
        }
Example #17
0
        public IEnumerable <GmsCallQueueCustomerViewModel> Create(IEnumerable <CallQueueCustomer> callQueueCustomers, IEnumerable <Customer> customers, IEnumerable <EventListGmsModel> events, IEnumerable <Host> eventHosts,
                                                                  CorporateAccount healthPlan, Organization account, IEnumerable <OrderedPair <long, PhoneNumber> > customerIdCheckoutNumberPairList, bool setAdditionalField = false)
        {
            var collection = new List <GmsCallQueueCustomerViewModel>();

            foreach (var cqc in callQueueCustomers)
            {
                if (!cqc.CustomerId.HasValue)
                {
                    continue;
                }

                var customer       = customers.Single(x => x.CustomerId == cqc.CustomerId.Value);
                var checkoutNumber = customerIdCheckoutNumberPairList != null?customerIdCheckoutNumberPairList.FirstOrDefault(x => x.FirstValue == cqc.CustomerId.Value) : null;

                var model = new GmsCallQueueCustomerViewModel
                {
                    CustomerId = cqc.CustomerId.Value,
                    FirstName  = cqc.FirstName,
                    MiddleName = !string.IsNullOrEmpty(cqc.MiddleName) ? cqc.MiddleName : "",
                    LastName   = cqc.LastName,
                    Email      = customer.Email.ToString(),
                    PhoneHome  = cqc.PhoneHome != null?cqc.PhoneHome.ToString() : string.Empty,
                                     PhoneOffice = cqc.PhoneOffice != null?cqc.PhoneOffice.ToString() : string.Empty,
                                                       PhoneCell = cqc.PhoneCell != null?cqc.PhoneCell.ToString() : string.Empty,
                                                                       Address1   = customer.Address.StreetAddressLine1,
                                                                       Address2   = string.IsNullOrEmpty(customer.Address.StreetAddressLine2) ? "" : customer.Address.StreetAddressLine2,
                                                                       City       = customer.Address.City,
                                                                       State      = customer.Address.State,
                                                                       Zip        = customer.Address.ZipCode.Zip,
                                                                       MemberId   = customer.InsuranceId,
                                                                       HealthPlan = account.Name,
                                                                       CallerId   = checkoutNumber != null?checkoutNumber.SecondValue.ToString() : "",
                                                                                        AdditionalField = setAdditionalField ? customer.AdditionalField3 : ""
                };

                if (string.IsNullOrEmpty(model.CallerId))
                {
                    model.CallerId = _phoneNumberFactory.CreatePhoneNumber(healthPlan.CheckoutPhoneNumber.ToString(), PhoneNumberType.Unknown).ToString();
                }

                var hostIdsWithAvailableSlots = events.Where(x => x.AvailableSlots > 0).Select(x => x.HostId);

                eventHosts = eventHosts.Where(x => hostIdsWithAvailableSlots.Contains(x.Id));

                //var zipDistanceOrderedPairs = GetEventZips(eventHosts, customer.Address.ZipCode);

                //var nearestEventZips = zipDistanceOrderedPairs.OrderBy(x => x.SecondValue).Select(x => x.FirstValue).Distinct().Take(NearestEventZipCount);

                //model.NearestEventZips = string.Join(", ", nearestEventZips);

                var eventDistanceOrderedPairs = GetEventDistance(events, eventHosts, customer.Address.ZipCode);
                var nearestEvents             = eventDistanceOrderedPairs.Where(x => x.SecondValue <= EventZipRadius).OrderBy(x => x.SecondValue).Select(x => x.FirstValue).Distinct().Take(NearestEventZipCount);

                model.NearestEvents = string.Join("|", nearestEvents);

                collection.Add(model);
            }

            return(collection);
        }
Example #18
0
        public void PollForPhoneNumberUpdate()
        {
            _logger.Info("Starting Customer Phone Number Update Service : DateTime :" + DateTime.Now);
            var uploadedFilesInfo = _customerPhoneNumberUpdateUploadRepository.GetUploadedFilesInfo();

            var phoneNumberUpdateFilesLocation = _mediaRepository.GetCustomerPhoneNumberUploadLocation();

            if (uploadedFilesInfo.IsNullOrEmpty())
            {
                _logger.Info("No new Files Uploaded");
                return;
            }

            foreach (var uploadFileInfo in uploadedFilesInfo)    //parsing all Uploaded Status Files
            {
                var failedRecords = new StringBuilder();
                failedRecords.Append(LogHeader + Environment.NewLine);
                var successCount = 0L;

                try
                {
                    var fileInfo = GetFile(uploadFileInfo.FileId);
                    if (!System.IO.File.Exists(phoneNumberUpdateFilesLocation.PhysicalPath + fileInfo.Path))
                    {
                        uploadFileInfo.StatusId = (long)PhoneNumberUploadStatus.FileNotFound;
                        _customerPhoneNumberUpdateUploadRepository.Save(uploadFileInfo);

                        _logger.Info("File not found : " + phoneNumberUpdateFilesLocation.PhysicalPath + fileInfo.Path);
                        continue;
                    }
                    _logger.Info("Importing File : " + fileInfo.Path);

                    uploadFileInfo.StatusId       = (long)PhoneNumberUploadStatus.Parsing;
                    uploadFileInfo.ParseStartTime = DateTime.Now;
                    _customerPhoneNumberUpdateUploadRepository.Save(uploadFileInfo);

                    DataTable table = _csvReader.CsvToDataTable(phoneNumberUpdateFilesLocation.PhysicalPath + fileInfo.Path, true);

                    if (table.Rows.Count <= 0)
                    {
                        _logger.Info("No rows found in File : " + fileInfo.Path + " having FileId :" + uploadFileInfo.FileId);
                        uploadFileInfo.ParseEndTime = DateTime.Now;

                        uploadFileInfo.StatusId = (long)PhoneNumberUploadStatus.ParseFailed;
                        _customerPhoneNumberUpdateUploadRepository.Save(uploadFileInfo);
                        continue;
                    }

                    foreach (DataRow row in table.Rows)         //Parsing Records in File
                    {
                        var errorRow             = "";
                        var phoneNumberUploadLog = new CustomerPhoneNumberUpdateUploadLog();
                        try
                        {
                            var  customerId           = 0L;
                            var  phoneNumber          = "";
                            var  phoneNumberType      = "";
                            var  phoneNumberDomain    = new PhoneNumber();
                            var  customer             = new Customer();
                            bool isCustomerIdProvided = false;

                            var model = GetPhoneNumberUpdateLogModel(row);
                            errorRow = model.CustomerId + "," +
                                       model.FirstName + "," +
                                       model.LastName + "," +
                                       model.DOB + "," +
                                       model.MemberId + "," +
                                       model.PhoneNumber + "," +
                                       model.PhoneType;

                            GetFileRowForLog(phoneNumberUploadLog, model, uploadFileInfo.Id);

                            #region CustomerId
                            try                 //CustomerId
                            {
                                if (!string.IsNullOrEmpty(model.CustomerId))
                                {
                                    Int64.TryParse(model.CustomerId, out customerId);
                                    if (customerId == 0)
                                    {
                                        const string errorMessage = "Invalid Customer Id";
                                        SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                        failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                        continue;
                                    }
                                    isCustomerIdProvided = true;
                                }
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "Error importing CustomerId";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                _logger.Error(errorMessage);
                                _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                                failedRecords.Append(errorRow + "," + "CustomerId Invalid" + Environment.NewLine);
                                continue;
                            }
                            #endregion

                            if (!isCustomerIdProvided)
                            {
                                if (string.IsNullOrEmpty(model.FirstName) || string.IsNullOrEmpty(model.LastName) ||
                                    string.IsNullOrEmpty(model.DOB) || string.IsNullOrEmpty(model.MemberId))
                                {
                                    const string errorMessage = "Incomplete customer data.";
                                    SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                    failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                    continue;
                                }
                            }

                            #region PhoneNumber
                            try                 //PhoneNumber
                            {
                                phoneNumber = ToNumber(model.PhoneNumber);
                                if (string.IsNullOrEmpty(phoneNumber))
                                {
                                    const string errorMessage = "Invalid phone number";
                                    SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                    failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                    continue;
                                }
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "Error importing PhoneNumber";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                failedRecords.Append(errorRow + "," + "Invalid Phone Number" + Environment.NewLine);

                                _logger.Error(errorMessage);
                                _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                                continue;
                            }

                            #endregion

                            #region PhoneNumberType
                            try                 //Phone Type (requirement was for only Home and Cell phone numbers)
                            {
                                phoneNumberType = model.PhoneType;
                                if (string.IsNullOrEmpty(phoneNumberType))
                                {
                                    const string errorMessage = "Phone type should be Home or Cell";
                                    SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                    failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                    continue;
                                }

                                if (phoneNumberType.ToLower() != _phoneTypeHome.ToLower() && phoneNumberType.ToLower() != _phoneTypeCell.ToLower())
                                {
                                    const string errorMessage = "Phone type should be Home or Cell";
                                    SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                    failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                    continue;
                                }
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "Error importing PhoneType";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                failedRecords.Append(errorRow + "," + "Phone type should be Home or Cell" + Environment.NewLine);

                                _logger.Error(errorMessage);
                                _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                                continue;
                            }

                            #endregion

                            #region CreatePhoneNumber
                            // Creating Phone Number
                            try
                            {
                                var phoneNumberTypeEnumValue = (phoneNumberType.ToLower() == _phoneTypeHome.ToLower()) ? PhoneNumberType.Home : PhoneNumberType.Mobile;
                                phoneNumberDomain = _phoneNumberFactory.CreatePhoneNumber(phoneNumber, phoneNumberTypeEnumValue);

                                if (phoneNumberDomain.PhoneNumberType == PhoneNumberType.Unknown)
                                {
                                    const string errorMessage = "Phone number not valid";
                                    SaveUploadLogToDb(phoneNumberUploadLog, errorMessage);

                                    failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                    continue;
                                }
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "Error while Creating PhoneNumberDomain";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                failedRecords.Append(errorRow + "," + "Phone number not valid" + Environment.NewLine);

                                _logger.Error(errorMessage);
                                _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                                continue;
                            }

                            #endregion

                            #region Get Customer
                            try
                            {
                                var dob = new DateTime();
                                if (isCustomerIdProvided)
                                {
                                    customer = _customerRepository.GetCustomer(customerId);
                                }
                                else
                                {
                                    try
                                    {
                                        dob = Convert.ToDateTime(model.DOB);
                                    }
                                    catch (Exception ex)
                                    {
                                        const string errorMessage = "Invalid date format";
                                        SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                        failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                        continue;
                                    }

                                    try
                                    {
                                        customer = _customerRepository.GetCustomerForPhoneNumberUpdate(model.FirstName, model.LastName, dob, model.MemberId);
                                    }
                                    catch (Exception ex)
                                    {
                                        const string errorMessage = "No record present for this data.";
                                        SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                        failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                        continue;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "No record present for this CustomerId";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                failedRecords.Append(errorRow + "," + errorMessage + Environment.NewLine);
                                continue;
                            }
                            #endregion

                            #region Saving Data
                            try
                            {
                                var shouldSaveNotes = customer.IsIncorrectPhoneNumber;
                                if (phoneNumberType.ToLower() == _phoneTypeHome.ToLower())
                                {
                                    customer.HomePhoneNumber = phoneNumberDomain;
                                }
                                else
                                {
                                    customer.MobilePhoneNumber = phoneNumberDomain;
                                }
                                customer.IsIncorrectPhoneNumber         = false;
                                customer.IncorrectPhoneNumberMarkedDate = null;

                                //saves CustomerProfile and Creates History and Updates CallQueueCustomer
                                _customerService.SaveCustomer(customer, uploadFileInfo.UploadedByOrgRoleUserId);

                                if (shouldSaveNotes)
                                {
                                    _customerNotesService.SavePhoneNumberUpdatedMessage(customer.CustomerId, uploadFileInfo.UploadedByOrgRoleUserId);
                                }

                                SaveUploadLogToDb(phoneNumberUploadLog, "");        //Log Success
                                successCount++;
                            }
                            catch (Exception ex)
                            {
                                const string errorMessage = "Error while saving Details";
                                SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                                failedRecords.Append(errorRow + "," + "Save Failed" + Environment.NewLine);

                                _logger.Error(errorMessage);
                                _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                                continue;
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            const string errorMessage = "Some Error Occurred";
                            SaveUploadLogToDb(phoneNumberUploadLog, errorMessage + " Exception Message: " + ex.Message);

                            failedRecords.Append(errorRow + "," + "Save Failed" + Environment.NewLine);

                            _logger.Error(errorMessage);
                            _logger.Error("Message: " + ex.Message + "\nStack Trace; " + ex.StackTrace);
                            continue;
                        }
                    }

                    if (successCount < table.Rows.Count)
                    {
                        var logFileName = "FailRecords_" + fileInfo.Path;
                        var logFile     = SaveLogFile(phoneNumberUpdateFilesLocation.PhysicalPath + logFileName, failedRecords);
                        uploadFileInfo.LogFileId = logFile.Id;
                    }

                    uploadFileInfo.SuccessUploadCount = successCount;
                    uploadFileInfo.FailedUploadCount  = table.Rows.Count - successCount;
                    uploadFileInfo.ParseEndTime       = DateTime.Now;
                    uploadFileInfo.StatusId           = successCount > 0 ? (long)PhoneNumberUploadStatus.Parsed : (long)PhoneNumberUploadStatus.ParseFailed;
                    _customerPhoneNumberUpdateUploadRepository.Save(uploadFileInfo);
                }
                catch (Exception ex)
                {
                    uploadFileInfo.StatusId = (long)PhoneNumberUploadStatus.ParseFailed;
                    _customerPhoneNumberUpdateUploadRepository.Save(uploadFileInfo);
                    _logger.Error("Parse Failed while parsing File , FileId:" + uploadFileInfo.FileId);
                    _logger.Error("Ex Message" + ex.Message);
                    _logger.Error("Ex Stack Trace " + ex.StackTrace);
                }
            }
        }
        protected override void MapDomainFields(AccountEntity entity, CorporateAccount domainObjectToMapTo)
        {
            domainObjectToMapTo.Id                     = entity.AccountId;
            domainObjectToMapTo.ContractNotes          = entity.ContractNotes;
            domainObjectToMapTo.ShowSponsoredByUrl     = entity.ShowSponsoredByUrl;
            domainObjectToMapTo.Content                = entity.Content;
            domainObjectToMapTo.ConvertedHostId        = entity.ConvertedHostId;
            domainObjectToMapTo.AccountCode            = entity.CorpCode;
            domainObjectToMapTo.AllowCobranding        = entity.AllowCobranding;
            domainObjectToMapTo.CorporateWhiteLabeling = entity.CorporateWhiteLabeling;
            domainObjectToMapTo.FluffLetterFileId      = entity.FluffLetterFileId != null ? entity.FluffLetterFileId.Value : 0;
            domainObjectToMapTo.CaptureInsuranceId     = entity.CaptureInsuranceId;
            domainObjectToMapTo.InsuranceIdRequired    = entity.InsuranceIdRequired;
            domainObjectToMapTo.SendAppointmentMail    = entity.SendAppointmentMail;

            domainObjectToMapTo.Tag                                   = entity.Tag;
            domainObjectToMapTo.MemberIdLabel                         = entity.MemberIdLabel;
            domainObjectToMapTo.AllowOnlineRegistration               = entity.AllowOnlineRegistration;
            domainObjectToMapTo.AllowPreQualifiedTestOnly             = entity.AllowPreQualifiedTestOnly;
            domainObjectToMapTo.AllowCustomerPortalLogin              = entity.AllowCustomerPortalLogin;
            domainObjectToMapTo.AppointmentConfirmationMailTemplateId = entity.AppointmentConfirmationMailTemplateId;
            domainObjectToMapTo.AppointmentReminderMailTemplateId     = entity.AppointmentReminderMailTemplateId;

            domainObjectToMapTo.SendResultReadyMail = entity.SendResultReadyMail;
            domainObjectToMapTo.GeneratePcpLetterWithDiagnosisCode = entity.GeneratePcpLetterWithDiagnosisCode;
            domainObjectToMapTo.ShowBasicBiometricPage             = entity.ShowBasicBiometricPage;
            domainObjectToMapTo.SendSurveyMail            = entity.SendSurveyMail;
            domainObjectToMapTo.ResultReadyMailTemplateId = entity.ResultReadyMailTemplateId;
            domainObjectToMapTo.SurveyMailTemplateId      = entity.SurveyMailTemplateId;

            domainObjectToMapTo.AllowVerifiedMembersOnly = entity.AllowVerifiedMembersOnly;
            domainObjectToMapTo.FirstName     = entity.FirstName;
            domainObjectToMapTo.MemberId      = entity.MemberId;
            domainObjectToMapTo.ZipCode       = entity.Zipcode;
            domainObjectToMapTo.LastName      = entity.LastName;
            domainObjectToMapTo.DateOfBirth   = entity.DateOfBirth;
            domainObjectToMapTo.CustomerEmail = entity.Email;
            domainObjectToMapTo.SendResultReadyMailWithFax = entity.SendResultReadyMailWithFax;

            domainObjectToMapTo.CapturePcpConsent = entity.CapturePcpconsent;
            domainObjectToMapTo.CaptureAbnStatus  = entity.CaptureAbnstatus;
            domainObjectToMapTo.AllowPrePayment   = entity.AllowPrePayment;
            domainObjectToMapTo.HicNumberRequired = entity.HicnumberRequired;

            domainObjectToMapTo.IsCustomerResultsTestDependent = entity.IsCustomerResultsTestDependent;
            domainObjectToMapTo.GenerateCustomerResult         = entity.GenerateCustomerResult;
            domainObjectToMapTo.GeneratePcpResult   = entity.GeneratePcpResult;
            domainObjectToMapTo.CheckoutPhoneNumber = _phoneNumberFactory.CreatePhoneNumber(entity.CheckoutPhoneNumber, PhoneNumberType.Unknown);

            domainObjectToMapTo.RecommendPackage            = entity.RecommendPackage;
            domainObjectToMapTo.AskPreQualificationQuestion = entity.AskPreQualificationQuestion;

            domainObjectToMapTo.SendWelcomeEmail = entity.SendWelcomeEmail;
            domainObjectToMapTo.CaptureHaf       = entity.CaptureHaf;
            domainObjectToMapTo.CaptureHafOnline = entity.CaptureHafonline;

            domainObjectToMapTo.EnableImageUpsell = entity.EnableImageUpsell;
            domainObjectToMapTo.AllowTechnicianUpdatePreQualifiedTests = entity.AllowTechUpdateQualifiedTests;
            domainObjectToMapTo.AttachQualityAssuranceForm             = entity.AttachQualityAssuranceForm;
            domainObjectToMapTo.RemoveLongDescription = entity.RemoveLongDescription;
            domainObjectToMapTo.GenerateBatchLabel    = entity.GenerateBatchLabel;

            domainObjectToMapTo.AttachCongitiveClockForm    = entity.AttachCongitiveClockForm;
            domainObjectToMapTo.AttachChronicEvaluationForm = entity.AttachChronicEvaluationForm;
            domainObjectToMapTo.AttachParicipantConsentForm = entity.AttachParicipantConsentForm;
            domainObjectToMapTo.UpsellTest                  = entity.UpsellTest;
            domainObjectToMapTo.AskClinicalQuestions        = entity.AskClinicalQuestions;
            domainObjectToMapTo.ClinicalQuestionTemplateId  = entity.ClinicalQuestionTemplateId;
            domainObjectToMapTo.DefaultSelectionBasePackage = entity.DefaultSelectionBasePackage;

            domainObjectToMapTo.SlotBooking          = entity.SlotBooking;
            domainObjectToMapTo.AddImagesForAbnormal = entity.AddImagesForAbnormal;
            domainObjectToMapTo.BookPcpAppointment   = entity.BookPcpAppointment;
            domainObjectToMapTo.NumberOfDays         = entity.NumberOfDays;
            domainObjectToMapTo.ScreeningInfo        = entity.ScreeningInfo;
            domainObjectToMapTo.PatientWorkSheet     = entity.PatientWorkSheet;
            domainObjectToMapTo.UseHeaderImage       = entity.UseHeaderImage;
            domainObjectToMapTo.ShowHafFooter        = entity.ShowHafFooter;
            domainObjectToMapTo.CaptureSurvey        = entity.CaptureSurvey;
            domainObjectToMapTo.SurveyPdfFileId      = entity.SurveyPdfFileId.HasValue ? entity.SurveyPdfFileId.Value : 0;
            domainObjectToMapTo.GeneratePcpLetter    = entity.GeneratePcpLetter;
            domainObjectToMapTo.PcpLetterPdfFileId   = entity.PcpLetterPdfFileId.HasValue ? entity.PcpLetterPdfFileId.Value : 0;
            domainObjectToMapTo.AttachScannedDoc     = entity.AttachScannedDoc;
            domainObjectToMapTo.ResultFormatTypeId   = entity.ResultFormatTypeId;
            domainObjectToMapTo.AttachUnreadableTest = entity.AttachUnreadableTest;

            domainObjectToMapTo.AttachGiftCard = entity.AttachGiftCard;
            domainObjectToMapTo.GiftCardAmount = entity.GiftCardAmount;

            domainObjectToMapTo.AttachEawvPreventionPlan         = entity.AttachEawvPreventionPlan;
            domainObjectToMapTo.GenerateEawvPreventionPlanReport = entity.GenerateEawvPreventionPlanReport;
            domainObjectToMapTo.GenerateFluPneuConsentForm       = entity.GenerateFluPneuConsentForm;

            domainObjectToMapTo.GenerateBmiReport = entity.GenerateBmiReport;

            domainObjectToMapTo.EnablePgpEncryption = entity.EnablePgpEncryption;
            domainObjectToMapTo.PublicKeyFileId     = entity.PublicKeyFileId.HasValue ? entity.PublicKeyFileId.Value : 0;

            domainObjectToMapTo.LockEvent = entity.LockEvent;
            domainObjectToMapTo.GenerateHealthPlanReport = entity.GenerateHealthPlanReport;
            domainObjectToMapTo.IsHealthPlan             = entity.IsHealthPlan;
            domainObjectToMapTo.AttachAttestationForm    = entity.AttachAttestationForm;
            domainObjectToMapTo.EventLockDaysCount       = entity.EventLockDaysCount;

            domainObjectToMapTo.AttachOrderRequisitionForm = entity.AttachOrderRequisitionForm;
            domainObjectToMapTo.ParticipantLetterId        = entity.ParticipantLetterId.HasValue ? entity.ParticipantLetterId.Value : 0;
            domainObjectToMapTo.FolderName = entity.FolderName;
            if (entity.Organization != null)
            {
                domainObjectToMapTo.Name = entity.Organization.Name;
            }
            domainObjectToMapTo.PrintCheckList  = entity.PrintCheckList;
            domainObjectToMapTo.CheckListFileId = entity.CheckListFileId.HasValue ? entity.CheckListFileId.Value : 0;
            domainObjectToMapTo.SendEventResultReadyNotification = entity.SendEventResultReadyNotification;
            domainObjectToMapTo.ShowBarrier = entity.ShowBarrier;
            domainObjectToMapTo.PrintPcpAppointmentForBulkHaf = entity.PrintPcpAppointmentForBulkHaf;
            domainObjectToMapTo.PrintPcpAppointmentForResult  = entity.PrintPcpAppointmentForResult;
            domainObjectToMapTo.PrintAceForm = entity.PrintAceForm;
            domainObjectToMapTo.PrintMipForm = entity.PrintMipForm;
            domainObjectToMapTo.AllowRegistrationWithImproperTags = entity.AllowRegistrationWithImproperTags;
            domainObjectToMapTo.PrintMicroalbuminForm             = entity.PrintMicroalbuminForm;
            domainObjectToMapTo.PrintIFOBTForm                       = entity.PrintIfobtform;
            domainObjectToMapTo.EnableSms                            = entity.EnableSms;
            domainObjectToMapTo.MaximumSms                           = entity.MaximumSms;
            domainObjectToMapTo.ConfirmationSmsTemplateId            = entity.ConfirmationSmsTemplateId;
            domainObjectToMapTo.ReminderSmsTemplateId                = entity.ReminderSmsTemplateId;
            domainObjectToMapTo.PrintLoincLabData                    = entity.PrintLoincLabData;
            domainObjectToMapTo.CheckListTemplateId                  = entity.CheckListTemplateId;
            domainObjectToMapTo.MaxAttempt                           = entity.MaxAttempt;
            domainObjectToMapTo.IsMaxAttemptPerHealthPlan            = entity.IsMaxAttemptPerHealthPlan;
            domainObjectToMapTo.MarkPennedBack                       = entity.MarkPennedBack;
            domainObjectToMapTo.PennedBackText                       = entity.PennedBackText;
            domainObjectToMapTo.ShowCallCenterScript                 = entity.ShowCallCenterScript;
            domainObjectToMapTo.CallCenterScriptFileId               = entity.CallCenterScriptFileId.HasValue ? entity.CallCenterScriptFileId.Value : 0;
            domainObjectToMapTo.ConfirmationScriptFileId             = entity.ConfirmationScriptFileId.HasValue ? entity.ConfirmationScriptFileId.Value : 0;
            domainObjectToMapTo.EventConfirmationBeforeDays          = entity.EventConfirmationBeforeDays;
            domainObjectToMapTo.ConfirmationBeforeAppointmentMinutes = entity.ConfirmationBeforeAppointmentMinutes;
            domainObjectToMapTo.RestrictHealthPlanData               = entity.RestrictHealthPlanData;
            domainObjectToMapTo.ClientId = entity.ClientId;
            domainObjectToMapTo.SendPatientDataToAces    = entity.SendPatientDataToAces;
            domainObjectToMapTo.SendConsentData          = entity.SendConsentData;
            domainObjectToMapTo.ShowGiftCertificateOnEod = entity.ShowGiftCertificateOnEod;
            domainObjectToMapTo.WarmTransfer             = entity.WarmTransfer;
            domainObjectToMapTo.InboundCallScriptFileId  = entity.InboundCallScriptFileId.HasValue ? entity.InboundCallScriptFileId.Value : 0;
            domainObjectToMapTo.AcesClientShortName      = entity.AcesClientShortName;

            domainObjectToMapTo.IncludeMemberLetter = entity.IncludeMemberLetter;
            domainObjectToMapTo.MemberLetterFileId  = entity.MemberLetterFileId.HasValue ? entity.MemberLetterFileId.Value : 0;

            domainObjectToMapTo.PcpCoverLetterTemplateId    = entity.PcpCoverLetterTemplateId;
            domainObjectToMapTo.MemberCoverLetterTemplateId = entity.MemberCoverLetterTemplateId;

            domainObjectToMapTo.AcesToHipIntake          = entity.AcesToHipIntake;
            domainObjectToMapTo.AcesToHipIntakeShortName = entity.AcesToHipIntakeShortName;

            domainObjectToMapTo.FluConsentTemplateId    = entity.FluConsentTemplateId;
            domainObjectToMapTo.ExitInterviewTemplateId = entity.ExitInterviewTemplateId;

            domainObjectToMapTo.SurveyTemplateId = entity.SurveyTemplateId;
            domainObjectToMapTo.ShowChaperonForm = entity.ShowChaperonForm;
        }