Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
0
        public static async Task <int> FromDBCountAsync(this AccountBasicDataContainer item)
        {
            var query = new DBQuery_Account_Select_Count();
            await DBThread.Instance.ReqQueryAsync(query);

            return(query.OUT.Count);
        }
Пример #4
0
        public static async Task <int> FromDBByEMailsAsync(this AccountBasicDataContainer item, string[] emails)
        {
            item.Clear();
            if (emails.Length == 0)
            {
                return(0);
            }

            List <DBQuery_Account_Select_By_EMail> queries = new List <DBQuery_Account_Select_By_EMail>();

            foreach (var it_email in emails)
            {
                var query = new DBQuery_Account_Select_By_EMail();
                query.IN.EMail = it_email;
                queries.Add(query);
            }

            await DBThread.Instance.ReqQueryAsync(queries.ToArray());

            foreach (var it in queries)
            {
                if (it.OUT.FirstItem == null)
                {
                    continue;
                }

                item.Add(it.OUT.FirstItem);
            }

            return(item.Count);
        }
Пример #5
0
        public static async Task <int> FromDBByLikeEMailCountAsync(this AccountBasicDataContainer item, string email)
        {
            var query = new DBQuery_Account_Select_By_LikeEMail_Count();

            query.IN.EMail = email;
            await DBThread.Instance.ReqQueryAsync(query);

            return(query.OUT.Count);
        }
Пример #6
0
        public static async Task <int> FromDBByLikeEMailAsync(this AccountBasicDataContainer item, string email, int offset = 0, int limit = 10)
        {
            item.Clear();
            var query = new DBQuery_Account_Select_By_LikeEMail();

            query.IN.EMail  = email;
            query.IN.Offset = offset;
            query.IN.Limit  = limit;
            var result = await DBThread.Instance.ReqQueryAsync(query);

            query.OUT.Items.CopyTo(ref item);
            return(item.Count);
        }
Пример #7
0
        public static async Task <int> FromDBByCreateTimeAsync(this AccountBasicDataContainer item
                                                               , DateTime beginCreateTime, DateTime endCreateTime, bool sortByCreateTimeDesc, int offset = 0, int limit = 10)
        {
            item.Clear();
            var query = new DBQuery_Account_Select_By_CreateTime();

            query.IN.BeginCreateTime      = beginCreateTime;
            query.IN.EndCreateTime        = endCreateTime;
            query.IN.SortByCreateTimeDesc = sortByCreateTimeDesc;
            query.IN.Offset = offset;
            query.IN.Limit  = limit;
            var result = await DBThread.Instance.ReqQueryAsync(query);

            query.OUT.Items.CopyTo(ref item);
            return(item.Count);
        }