private async Task <string> GetGuid(string phone, string email)
        {
            flGUIDs query = null;

            try
            {
                query = await database.Persons.GetGuidByPhoneOrEmail(phone, email);
            }
            catch (Exception ex)
            {
                currentLogger.LogError(ex, "Ошибка поиска GUID при обращении к 1С");
            }

            return(query?.GUID);
        }
        private async Task <string> GetGuid(string phone, string email)
        {
            flGUIDs query = null;

            try
            {
                query = await database.Persons.GetGuidByPhoneOrEmail(phone, email);
            }
            catch (Exception ex)
            {
                currentLogger.LogError(ex, "Ошибка, {@Message}, По адресу - {@Location}");
            }

            return(query?.GUID);
        }
Exemple #3
0
        public static async System.Threading.Tasks.Task <string> FindIn1C(this Contact contact, UnitOfWork database)
        {
            string guid = null;

            if (contact.Phones() != null)
            {
                await FindByPhones(contact.Phones().Select(x => x.Value));
            }

            if (contact.Email() != null)
            {
                await FindByEmails(contact.Email().Select(x => x.Value));
            }

            return(guid);

            async System.Threading.Tasks.Task FindByPhones(IEnumerable <string> phones)
            {
                foreach (var phone in phones)
                {
                    if (String.IsNullOrEmpty(guid))
                    {
                        guid = await GetGuid(phone.PhoneWithoutCode(), "");
                    }
                }
            }

            async System.Threading.Tasks.Task FindByEmails(IEnumerable <string> emails)
            {
                foreach (var email in emails)
                {
                    if (String.IsNullOrEmpty(guid))
                    {
                        guid = await GetGuid("", email.ClearEmail());
                    }
                }
            }

            async Task <string> GetGuid(string phone, string email)
            {
                flGUIDs query = await database.Persons.GetGuidByPhoneOrEmail(phone, email);

                return(query?.GUID);
            }
        }
        private async Task <string> GetGuid(string phone, string email)
        {
            flGUIDs query = null;

            try
            {
                query = await database.Persons.GetGuidByPhoneOrEmail(phone, email);
            }
            catch (Exception ex)
            {
                var info = new MessageLocation(this)
                {
                    Metod = MethodBase.GetCurrentMethod().Name
                };

                logger.Error("Ошибка, {@Message}, По адресу - {@Location}", ex.Message, info);
            }

            return(query?.GUID);
        }
        private async Task <string> GetGuid(string phone, string email)
        {
            flGUIDs query = await database.Persons.GetGuidByPhoneOrEmail(phone, email);

            return(query?.GUID);
        }