コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        public string GetContactLink(ApiUriService apiService, string actimoApikey, int messageId, int sourceId)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.ContactLinkApiUri, messageId, sourceId), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            return(ObjectConversionService.ToObject <ContactLinkModel>(response.Content)?.link);
        }
コード例 #4
0
        public List <ContactModel> GetContacts(ApiUriService apiService, string actimoApikey)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          apiService.ContactApiUri, actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            return(ObjectConversionService.ToObject <ContactRoot>(response.Content)?.data
                   ?? new List <ContactModel>());
        }
コード例 #5
0
        public List <EnagementModel> GetEngagementData(ApiUriService apiService, string actimoApikey, int targetId, int sourceId, string authCode)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.EnagementApiUri, targetId, sourceId, authCode), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            var data = ObjectConversionService.ToObject <RootObject>(response.Content);

            return(GetEngagementList(data));
        }
コード例 #6
0
        public string GetContactAuthContact(ApiUriService apiService, string actimoApikey, string keyCode)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.ContactAuthApiUri, keyCode), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            var data = ObjectConversionService.ToObject <JObject>(response.Content);

            return(data["contactAuthCode"].Value <string>());
        }
コード例 #7
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);
            }
        }