Esempio n. 1
0
        public static async Task <int> FromDBByLikeEMailAsync(this AccountDataContainer item, string email, TimeSpan timeZoneOffset, int offset, int limit = 10)
        {
            item.Clear();

            AccountBasicDataContainer basicDataContainer = new AccountBasicDataContainer();

            if (await basicDataContainer.FromDBByLikeEMailAsync(email, offset, limit) == 0)
            {
                return(0);
            }

            List <Task <bool> > tasks = new List <Task <bool> >();

            foreach (var it in basicDataContainer.Items)
            {
                var accountData = new AccountData();
                accountData.BasicData = it;
                item.Add(accountData);
                tasks.Add(accountData.FromDBByAccountDBKeyAsync(it.AccountDBKey, false, timeZoneOffset));
            }

            await Task.WhenAll(tasks.ToArray());

            return(item.Count);
        }
Esempio n. 2
0
        public static async Task <int> FromDBByCreateTimeAsync(this AccountDataContainer item
                                                               , DateTime beginCreateTime, DateTime endCreateTime, bool sortByCreateTimeDesc, TimeSpan timeZoneOffset, int offset = 0, int limit = 10)
        {
            item.Clear();

            AccountBasicDataContainer basicDataContainer = new AccountBasicDataContainer();

            if (await basicDataContainer.FromDBByCreateTimeAsync(beginCreateTime, endCreateTime, sortByCreateTimeDesc, offset, limit) == 0)
            {
                return(0);
            }

            List <Task <bool> > tasks = new List <Task <bool> >();

            foreach (var it in basicDataContainer.Items)
            {
                var accountData = new AccountData();
                accountData.BasicData = it;
                item.Add(accountData);
                tasks.Add(accountData.FromDBByAccountDBKeyAsync(it.AccountDBKey, false, timeZoneOffset));
            }

            await Task.WhenAll(tasks.ToArray());

            return(item.Count);
        }