Esempio n. 1
0
        public async Task <uint> GetContactsCountAsync(IContactSource contactSrc, ServiceContext ctx, string sourceName, string partyGuid = null)
        {
            uint cptContact = 0;

            await Task <uint> .Run(() =>
            {
                Stopwatch sw = new Stopwatch();
                try
                {
                    var ContactsQuery = contactSrc.GetContactsQuery(ctx, partyGuid);

                    sw.Start();
                    Console.WriteLine($"Executing data collection query :\n=> Contacts from type 'Courrier' related to {sourceName} ...\n");
                    foreach (var contact in ContactsQuery)
                    {
                        cptContact++;
                    }
                    ;
                    sw.Stop();
                }
                catch (Exception Ex)
                {
                    var Innermessage = Ex.InnerException != null ? Ex.InnerException.Message : "";
                    var stackTrace   = Ex.StackTrace != null ? Ex.StackTrace : "";
                    Console.WriteLine($"[GetContactsCountAsync : {contactSrc.GetType()} {cptContact}] : => \n{Ex.Message}\n=> \n{Innermessage}\n=> {stackTrace}");
                }
            });

            return(cptContact);
        }
Esempio n. 2
0
        private void AddAddressToDictionary(IContactSource contactSrc, string accountId, string inputAddress, DateTime modifiedOn)
        {
            var trimmedAddress = inputAddress.ToString().Replace(" ", "").ToLower();
            var contactEntry   = ProcessAddressToHashmap(accountId, trimmedAddress, modifiedOn);

            if (BatchAddressAnalyzer.IsDebugMode)
            {
                BatchAddressAnalyzer.DebugMessage(String.Format($"[{contactSrc.GetType()}]\nprocessing address ({contactEntry.GetFisrtKnownAddress()}):\n[{inputAddress}]"));
            }
        }