public bool IsCommunityExists(string CommunityNumber, LeadAdapterTypes leadAdapterType, int accountId) { var db = ObjectContextFactory.Create(); bool isExists = db.LeadAdapters.Where(la => la.CommunityNumber.Contains(CommunityNumber) && la.IsDelete == false && la.LeadAdapterTypeID == (byte)leadAdapterType && la.AccountID == accountId).Count() > 0; return(isExists); }
/// <summary> /// Gets the lead adapter. /// </summary> /// <param name="accountID">The account identifier.</param> /// <param name="leadAdapterType">Type of the lead adapter.</param> /// <returns></returns> public LeadAdapterAndAccountMap GetLeadAdapter(int accountID, LeadAdapterTypes leadAdapterType) { var db = ObjectContextFactory.Create(); var leadAdaptersdb = db.LeadAdapters.Where(la => la.AccountID == accountID && la.LeadAdapterTypeID == (byte)leadAdapterType).FirstOrDefault(); if (leadAdaptersdb != null) { LeadAdapterAndAccountMap leadAdapterDatabaseConvertedToDomain = ConvertToDomain(leadAdaptersdb); return(leadAdapterDatabaseConvertedToDomain); } return(null); }
public TruliaLeadAdapterProvider(int accountId, int leadAdapterAndAccountMapID, ILeadAdaptersRepository leadAdaptersRepository, IServiceProviderRepository serviceProviderRepository, IImportDataRepository importDataRepository, ISearchService <Contact> searchService, IUnitOfWork unitOfWork, ICustomFieldService customFieldService, ICachingService cacheService, ICommunicationService communicationService, IMailGunService mailGunService, IContactService contactService) : base(accountId, leadAdapterAndAccountMapID, LeadAdapterTypes.Trulia, leadAdaptersRepository, importDataRepository, searchService, unitOfWork, customFieldService, cacheService, serviceProviderRepository, mailGunService, contactService) { this.mailGunService = mailGunService; this.searchService = searchService; this.contactService = contactService; this.importDataRepository = importDataRepository; this.leadAdapterType = LeadAdapterTypes.Trulia; }
/// <summary> /// Gets the lead adapter custom fields. /// </summary> /// <param name="LeadAdapterType">Type of the lead adapter.</param> /// <param name="AccountID">The account identifier.</param> /// <returns></returns> public IEnumerable <CustomField> GetLeadAdapterCustomFields(LeadAdapterTypes LeadAdapterType, int AccountID) { var db = ObjectContextFactory.Create(); var fields = db.LeadAdapterCustomFields.Where(i => i.LeadAdapterType == (byte)LeadAdapterType) .Select(x => new CustomField { AccountID = AccountID, DisplayName = x.Title, FieldInputTypeId = (SmartTouch.CRM.Entities.FieldType)x.FieldInputTypeID, IsCustomField = true, Title = x.Title, StatusId = FieldStatus.Active, IsDropdownField = false }); return(fields); }
public BaseLeadAdapterProvider(int accountId, int leadAdapterAndAccountMapID, LeadAdapterTypes leadAdapterType , ILeadAdaptersRepository leadAdaptersRepository, IImportDataRepository importDataRepository, ISearchService <Contact> searchService, IUnitOfWork unitOfWork, ICustomFieldService customFieldService, ICachingService cacheService, IServiceProviderRepository serviceProviderRepository, IMailGunService mailGunService, IContactService contactService) { this.AccountID = accountId; this.repository = leadAdaptersRepository; this.serviceProviderRepository = serviceProviderRepository; this.importDataRepository = importDataRepository; this.customFieldService = customFieldService; this.unitOfWork = unitOfWork; this.mailGunService = mailGunService; this.contactService = contactService; this.leadAdapterType = leadAdapterType; this.cacheService = cacheService; LeadAdapterAccountMapID = leadAdapterAndAccountMapID; leadAdapterAndAccountMap = repository.GetLeadAdapterByID(LeadAdapterAccountMapID); _fieldMappings = GetFieldMappings(); }
/// <summary> /// Determines whether [is duplicate lead adapter] [the specified lead adapter type]. /// </summary> /// <param name="leadAdapterType">Type of the lead adapter.</param> /// <param name="accountID">The account identifier.</param> /// <param name="leadAdapterAndAccountMapId">The lead adapter and account map identifier.</param> /// <returns></returns> public bool IsDuplicateLeadAdapter(LeadAdapterTypes leadAdapterType, int accountID, int leadAdapterAndAccountMapId) { var db = ObjectContextFactory.Create(); LeadAdapterAndAccountMapDb leadAdapterDb; if (leadAdapterAndAccountMapId == 0) { leadAdapterDb = db.LeadAdapters.Where(la => la.AccountID == accountID && la.LeadAdapterTypeID == (int)leadAdapterType && la.IsDelete == false) .FirstOrDefault(); } else { leadAdapterDb = db.LeadAdapters.Where(la => la.AccountID == accountID && la.LeadAdapterTypeID == (int)leadAdapterType && la.LeadAdapterAndAccountMapId != leadAdapterAndAccountMapId && la.IsDelete == false) .FirstOrDefault(); } return((leadAdapterDb == null) ? false : true); }
public IEnumerable <LeadAdapterAndAccountMap> GetEmptyCommunities(string BuilderNumber, LeadAdapterTypes leadAdapterType, IEnumerable <Guid> guids) { var db = ObjectContextFactory.Create(); var matchedAccounts = db.LeadAdapters.Where(la => (la.BuilderNumber.ToLower().Contains(BuilderNumber)) && la.IsDelete == false && la.LeadAdapterTypeID == (byte)leadAdapterType).ToList(); if (matchedAccounts != null) { matchedAccounts = matchedAccounts.Where(w => guids.Contains(w.RequestGuid)).ToList(); foreach (LeadAdapterAndAccountMapDb item in matchedAccounts) { yield return(ConvertToDomain(item)); } } }
/// <summary> /// Determines whether [is lead adapter already configured] [the specified account identifier]. /// </summary> /// <param name="AccountID">The account identifier.</param> /// <param name="leadAdapterType">Type of the lead adapter.</param> /// <returns></returns> public bool isLeadAdapterAlreadyConfigured(int AccountID, LeadAdapterTypes leadAdapterType) { using (var db = ObjectContextFactory.Create()) { return(db.LeadAdapters.Where(i => i.AccountID == AccountID && i.LeadAdapterTypeID == (byte)leadAdapterType && i.IsDelete == false).Count() > 0); } }