Exemple #1
0
        private void UpdateAccountIdentificationInfo(Guid enrchEmailDataId, TextEntities textEntities,
                                                     bool isNewEnrichedData)
        {
            HashSet <OrganizationEntity> organizations = textEntities.Organizations;

            foreach (OrganizationEntity organizationEntity in organizations)
            {
                bool isAccountIdentified = false;
                if (!isNewEnrichedData)
                {
                    string organizationHash = organizationEntity.GetHash();
                    isAccountIdentified = CheckActualAccountIdentification(organizationHash, enrchEmailDataId);
                }
                if (isAccountIdentified)
                {
                    continue;
                }
                IEnumerable <Guid>        accountIds;
                AccountIdentificationType identificationType = _enrichEntitySearchHelper
                                                               .IdentifyAccount(organizationEntity, textEntities, out accountIds);
                if (!accountIds.IsNullOrEmpty())
                {
                    Guid entityId = GetTextEntityId(enrchEmailDataId, isNewEnrichedData, organizationEntity);
                    if (entityId.IsEmpty())
                    {
                        continue;
                    }
                    _enrichEntitySearchHelper.AddFoundAccounts(entityId, accountIds, identificationType);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Updates the account identification information.
        /// </summary>
        /// <param name="enrichTextItems">The enrich text items.</param>
        /// <returns></returns>
        public List <EnrichAccountItem> UpdateAccountIdentificationInfo(List <EnrichTextDataItem> enrichTextItems)
        {
            TextEntities textEntities = ConvertToTextEntities(enrichTextItems);
            HashSet <OrganizationEntity> organizations = textEntities.Organizations;
            var result = new List <EnrichAccountItem>();

            foreach (OrganizationEntity organizationEntity in organizations)
            {
                IEnumerable <Guid>        accountIds;
                AccountIdentificationType identificationType = IdentifyAccount(organizationEntity, textEntities,
                                                                               out accountIds);
                var guids = accountIds != null?accountIds.ToList() : null;

                if (!guids.IsNullOrEmpty())
                {
                    Guid entityId = organizationEntity.Id;
                    AddFoundAccounts(entityId, guids, identificationType);
                    foreach (Guid id in guids)
                    {
                        result.Add(new EnrichAccountItem {
                            Id = id,
                            EnrchTextEntityId = entityId
                        });
                    }
                }
            }
            return(result);
        }
Exemple #3
0
 /// <summary>
 /// Adds the found accounts.
 /// </summary>
 /// <param name="accountEntityId">The account entity id.</param>
 /// <param name="accountIds">The account ids.</param>
 /// <param name="identificationType">Type of the identification.</param>
 public void AddFoundAccounts(Guid accountEntityId, IEnumerable <Guid> accountIds,
                              AccountIdentificationType identificationType)
 {
     AddIdentification(accountEntityId, accountIds, identificationType, "EnrchFoundAccount", "AccountId");
 }