Beispiel #1
0
        public ActionResult Index()
        {
            // Get an instance of the QueryBuilder object
            var qb = _aqbs.Get(instanceId);
            var qt = _qts.Get(instanceId);

            if (qb == null)
            {
                qb = CreateQueryBuilder();
            }

            if (qt == null)
            {
                qt = CreateQueryTransformer(qb.SQLQuery);
            }

            ViewBag.QueryTransformer = qt;

            return(View(qb));
        }
Beispiel #2
0
        public ActionResult GetData([FromBody] GridModel m)
        {
            var qt = _qts.Get(instanceId);

            qt.Skip((m.Pagenum * m.Pagesize).ToString());
            qt.Take(m.Pagesize == 0 ? "" : m.Pagesize.ToString());

            if (!string.IsNullOrEmpty(m.Sortdatafield))
            {
                qt.Sortings.Clear();

                if (!string.IsNullOrEmpty(m.Sortorder))
                {
                    var c = qt.Columns.FindColumnByResultName(m.Sortdatafield);

                    if (c != null)
                    {
                        qt.OrderBy(c, m.Sortorder.ToLowerInvariant() == "asc");
                    }
                }
            }

            return(GetData(qt, m.Params));
        }
        public ActionResult GetSql([FromBody] GetSqlModel model)
        {
            var qt = _qts.Get(model.InstanceId);

            qt.Skip((model.Pagenum * model.Pagesize).ToString());
            qt.Take(model.Pagesize == 0 ? "" : model.Pagesize.ToString());

            if (!string.IsNullOrEmpty(model.Sortdatafield))
            {
                qt.Sortings.Clear();

                if (!string.IsNullOrEmpty(model.Sortorder))
                {
                    var c = qt.Columns.FindColumnByResultName(model.Sortdatafield);

                    if (c != null)
                    {
                        qt.OrderBy(c, model.Sortorder.ToLowerInvariant() == "asc");
                    }
                }
            }

            return(Content(qt.SQL));
        }