예제 #1
0
        protected override void ExecuteInternal(IJobExecutionContext context)
        {
            Log.Verbose("LeadAdapter process trigger");

            var allLeadAdapters = _leadAdaptersRepository‏.GetAllLeadAdapters();

            if (!allLeadAdapters.IsAny())
            {
                return;
            }

            Log.Informational("Total lead adapters count: " + allLeadAdapters.Count());
            foreach (var leadAdapter in allLeadAdapters)
            {
                ILeadAdapterProvider leadAdapterProvider;
                switch (leadAdapter.LeadAdapterTypeID)
                {
                case LeadAdapterTypes.BDX:
                    leadAdapterProvider = new BDXLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                     _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.NHG:
                    leadAdapterProvider = new NHGLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                     _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.HotonHomes:
                    leadAdapterProvider = new HotonHomesLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                            _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.PROPLeads:
                    leadAdapterProvider = new PROPLeadsLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                           _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.Zillow:
                    leadAdapterProvider = new ZillowLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                        _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.NewHomeFeed:
                    leadAdapterProvider = new NewHomeFeedLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                             _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.Condo:
                    leadAdapterProvider = new CondoLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                       _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.PrivateCommunities:
                    leadAdapterProvider = new PrivateCommunitiesLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                                    _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.IDX:
                    leadAdapterProvider = new IDXLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                     _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.BuzzBuzzHomes:
                    leadAdapterProvider = new BuzzBuzzHomesLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                               _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.HomeFinder:
                    leadAdapterProvider = new HomeFinderLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                            _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                case LeadAdapterTypes.Facebook:
                    leadAdapterProvider = new FacebookLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                          _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService, _accountRepository);
                    break;

                case LeadAdapterTypes.BuildersUpdate:
                    leadAdapterProvider = new BuildersUpdateLeadAdapterProvider(leadAdapter.AccountID, leadAdapter.Id, _leadAdaptersRepository‏, _serviceProviderRepository,
                                                                                _importDataRepository, _searchService, _unitOfWork, _customFieldService, _cahceService, _communicationService, _mailGunService, _contactService);
                    break;

                default:
                    throw new InvalidOperationException($"LeadAdapterType {leadAdapter} not supported");
                }

                Log.Informational("Get leadadapter provider process and the lead adapter is: " + leadAdapter.LeadAdapterTypeID.ToString() + " and account id is: " + leadAdapter.AccountID);
                try
                {
                    leadAdapterProvider.Initialize();
                    leadAdapterProvider.Process();
                }
                catch (Exception ex)
                {
                    Log.Error($"Exception while processing lead adapter, Lead Adapter {leadAdapter.LeadAdapterTypeID}, Account {leadAdapter.AccountName}", ex);
                }
            }
        }
예제 #2
0
        protected override void Execute()
        {
            Logger.Current.Verbose("LeadAdapter process trigger");
            var leadAdapterProvider = default(ILeadAdapterProvider);

            var allLeadAdapters = leadAdaptersRepository‏.GetAllLeadAdapters();

            if (allLeadAdapters.IsAny())
            {
                Logger.Current.Informational("Total lead adapters count:   " + allLeadAdapters.Count());
                foreach (var item in allLeadAdapters)
                {
                    leadAdapterProvider = default(ILeadAdapterProvider);
                    switch (item.LeadAdapterTypeID)
                    {
                    case LeadAdapterTypes.BDX:
                        leadAdapterProvider = new BDXLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                         importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.NHG:
                        leadAdapterProvider = new NHGLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                         importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.HotonHomes:
                        leadAdapterProvider = new HotonHomesLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.PROPLeads:
                        leadAdapterProvider = new PROPLeadsLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                               importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.Zillow:
                        leadAdapterProvider = new ZillowLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                            importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.NewHomeFeed:
                        leadAdapterProvider = new NewHomeFeedLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                 importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.Condo:
                        leadAdapterProvider = new CondoLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                           importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.PrivateCommunities:
                        leadAdapterProvider = new PrivateCommunitiesLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                        importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.IDX:
                        leadAdapterProvider = new IDXLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                         importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.BuzzBuzzHomes:
                        leadAdapterProvider = new BuzzBuzzHomesLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                   importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.HomeFinder:
                        leadAdapterProvider = new HomeFinderLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    case LeadAdapterTypes.Facebook:
                        leadAdapterProvider = new FacebookLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                              importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService, accountRepository);
                        break;

                    //case LeadAdapterTypes.Trulia:
                    //    leadAdapterProvider = new TruliaLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                    //    importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                    //    break;
                    case LeadAdapterTypes.BuildersUpdate:
                        leadAdapterProvider = new BuildersUpdateLeadAdapterProvider(item.AccountID, item.Id, leadAdaptersRepository‏, serviceProviderRepository,
                                                                                    importDataRepository, searchService, unitOfWork, customFieldService, cahceService, communicationService, mailGunService, contactService);
                        break;

                    default:
                        break;
                    }


                    if (leadAdapterProvider != default(ILeadAdapterProvider))
                    {
                        leadAdapterProvider.Initialize();
                        Logger.Current.Informational("Get leadadapter provider process and the lead adapter is: " + item.LeadAdapterTypeID.ToString() + " and account id is: " + item.AccountID);
                        try
                        {
                            leadAdapterProvider.Process();
                        }
                        catch (Exception ex)
                        {
                            var message = string.Format("Exception while processing lead adapter, Lead Adapter {0}, Account {1}", item.LeadAdapterTypeID, item.AccountName);
                            Logger.Current.Error(message, ex);
                        }
                    }
                }
            }
        }