Пример #1
0
        public async Task <Action[]> FindActionsByAccountsAsync(ActionQuery query, int[] accounts)
        {
            if (accounts.Length == 0)
            {
                return(new Action[0]);
            }

            using (var connection = new SqlConnection("Data Source=.;Integrated Security=true;Initial Catalog=dbTrackAction"))
            {
                var actions = await connection.QueryAsync <Action>(
                    " SELECT " +
                    (query.Top.HasValue ? $" TOP {query.Top.Value} " : "") +
                    " action_id as ActionId, action_dtm as ActionDateTime" +
                    " FROM [fn_ActionSearchByAccountsColumnStore](@Accounts, @CompanyId, @DateMin, @DateMax)" +
                    " ORDER BY action_dtm DESC",
                    new
                {
                    Accounts = AsTableValuedParameter(accounts),
                    query.CompanyId,
                    DateMin = query.Min,
                    DateMax = query.Max
                });

                return(actions.ToArray());
            }
        }
Пример #2
0
        public async Task <Action[]> FindActionsAsync(ActionQuery query)
        {
            var i = _counter++;

            Console.WriteLine($"[{_sw.Elapsed}] [{i}] FindActionsAsync invoking");

            try
            {
                return(await _searchServices.FindActionsAsync(query));
            }
            finally
            {
                Console.WriteLine($"[{_sw.Elapsed}] [{i}] FindActionsAsync invoked");
            }
        }
Пример #3
0
        public async Task <Action[]> FindActionsAsync(ActionQuery query)
        {
            using (var connection = new SqlConnection("Data Source=.;Integrated Security=true;Initial Catalog=dbTrackAction"))
            {
                var actions = await connection.QueryAsync <Action>(
                    " SELECT " +
                    (query.Top.HasValue ? $" TOP {query.Top.Value} " : "") +
                    " action_id as ActionId, action_dtm as ActionDateTime" +
                    " FROM [fn_ActionSearch](@CompanyId, @DateMin, @DateMax)" +
                    " ORDER BY action_dtm DESC",
                    new
                {
                    query.CompanyId,
                    DateMin = query.Min,
                    DateMax = query.Max
                });

                return(actions.ToArray());
            }
        }