Beispiel #1
0
        public ActionResult SelectRecordsCount(Param[] _params)
        {
            var qb = _aqbs.Get(instanceId);
            var qt = _qts.Get(instanceId);
            var qtForSelectRecordsCount = _qts.Create(instanceId + "_for_records_count");

            qtForSelectRecordsCount.QueryProvider = qb.SQLQuery;
            qtForSelectRecordsCount.Assign(qt);
            qtForSelectRecordsCount.Skip("");
            qtForSelectRecordsCount.Take("");
            qtForSelectRecordsCount.SelectRecordsCount("recCount");

            try
            {
                var data = Execute(qtForSelectRecordsCount, _params);
                return(Json(data.First().Values.First()));
            }
            catch (Exception e)
            {
                return(Json(new ErrorOutput {
                    Error = e.Message
                }));
            }
            finally
            {
                _qts.Remove(instanceId + "_for_records_count");
            }
        }
Beispiel #2
0
        public ActionResult SelectRecordsCount([FromBody] Param[] _params)
        {
            var qb = _aqbs.Get(instanceId);
            var qt = _qts.Get(instanceId);
            var qtForSelectRecordsCount = _qts.Create(instanceId + "_for_records_count");

            qtForSelectRecordsCount.QueryProvider = qb.SQLQuery;
            qtForSelectRecordsCount.Assign(qt);
            qtForSelectRecordsCount.Skip("");
            qtForSelectRecordsCount.Take("");
            qtForSelectRecordsCount.SelectRecordsCount("recCount");

            var result = GetData(qtForSelectRecordsCount, _params);

            _qts.Remove(instanceId + "_for_records_count");

            return(result);
        }
        /// <summary>
        /// Creates and initializes a new instance of the QueryTransformer object.
        /// </summary>
        /// <param name="query">SQL Query to transform.</param>
        /// <returns>Returns instance of the QueryTransformer object.</returns>
        private QueryTransformer CreateQueryTransformer(SQLQuery query)
        {
            var qt = _qts.Create(instanceId);

            qt.QueryProvider = query;
            qt.AlwaysExpandColumnsInQuery = true;

            return(qt);
        }