public void FeedData(IInputDataProvider inputDataProvider)
        {
            try
            {
                var getContacts = contactRepository.
                                  GetContacts(inputDataProvider.Client.ClientId)
                                  .GetAwaiter().GetResult()?.ToList();

                if (getContacts != null)
                {
                    foreach (var contact in getContacts)
                    {
                        var relationshipList = GetRelationshipList(inputDataProvider.ApiUriService,
                                                                   inputDataProvider.Client.ActimoApikey, contact.Id);

                        var relationshipDataTable = ObjectConversionService.ToDataTable(relationshipList);

                        if (relationshipDataTable?.Rows.Count > 0)
                        {
                            PushRelationship(inputDataProvider.Client.ClientId, contact.Id, relationshipDataTable);
                        }
                    }
                }

                else
                {
                    throw new Exception("No Contacts Data Found!!");
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message, ex);
            }
        }
        public void FeedData(IInputDataProvider inputDataProvider)
        {
            try
            {
                var contactLink = GetContactLink(inputDataProvider.ApiUriService,
                                                 inputDataProvider.Client.ActimoApikey,
                                                 inputDataProvider.Client.ActimoDummyMessageId, inputDataProvider.Client.ActimoManagerContactId);

                var keyCode = new Uri(contactLink).AbsolutePath;

                var authCode = GetContactAuthContact(inputDataProvider.ApiUriService, inputDataProvider.Client.ActimoApikey, keyCode);

                var engagementData = GetEngagementData(inputDataProvider.ApiUriService, inputDataProvider.Client.ActimoApikey, inputDataProvider.Client.ActimoManagerContactId, inputDataProvider.Client.ActimoManagerContactId, authCode);

                var engagementTable = ObjectConversionService.ToDataTable(engagementData);

                if (engagementTable?.Rows.Any() == false)
                {
                    throw new Exception("No engagement data found");
                }

                PushEngagementData(inputDataProvider.Client.ClientId, engagementTable);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
                throw new Exception("Error occured in Enagement Data Engine!", ex);
            }
        }
Esempio n. 3
0
        public void FeedData(IInputDataProvider inputDataProvider)
        {
            try
            {
                var apiService = inputDataProvider.ApiUriService;

                var contacts = GetContacts(apiService, inputDataProvider.Client.ActimoApikey);

                var dtContacts = ObjectConversionService.ToDataTable(contacts);

                if (dtContacts?.Rows.Count > 0)
                {
                    PushContacts(inputDataProvider.Client.ClientId, dtContacts);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
                throw new Exception("Error occured in Contact Engine!", ex);
            }
        }