Exemplo n.º 1
0
        private void HandleTable(HttpContext context)
        {
            string gridName = context.Request["Name"];

            //StringBuilder sbDebug = new StringBuilder();
            //foreach (string key in context.Request.QueryString.AllKeys)
            //{
            //    sbDebug.Append(key);
            //    sbDebug.Append(" = ");
            //    sbDebug.Append(context.Request.QueryString[key]);
            //    sbDebug.Append("<br />");
            //}

            var grid = MVCGridDefinitionTable.GetDefinitionInterface(gridName);

            var options = QueryStringParser.ParseOptions(grid, context.Request);

            var gridContext = GridContextUtility.Create(context, gridName, grid, options);

            GridEngine engine = new GridEngine();

            if (!engine.CheckAuthorization(gridContext))
            {
                //Forbidden
                context.Response.StatusCode = 403;
                context.Response.End();
                return;
            }

            IMVCGridRenderingEngine renderingEngine = GridEngine.GetRenderingEngine(gridContext);

            renderingEngine.PrepareResponse(context.Response);
            engine.Run(renderingEngine, gridContext, context.Response.Output);
        }
Exemplo n.º 2
0
        public IActionResult Grid()
        {
            string             gridName    = HttpContext.Request.Query["Name"];
            IMVCGridDefinition grid        = MVCGridDefinitionTable.GetDefinitionInterface(gridName);
            QueryOptions       options     = QueryStringParser.ParseOptions(grid, HttpHelper.HttpContext.Request.ToNameValueCollection());
            GridContext        gridContext = GridContextUtility.Create(/*context, */ gridName, grid, options);

            GridEngine engine = new GridEngine();

            if (!engine.CheckAuthorization(gridContext))
            {
                return(new StatusCodeResult(403));
            }

            var renderingModel = engine.GenerateModel(gridContext);

            return(PartialView(grid.ViewPath, renderingModel));
        }
Exemplo n.º 3
0
        public ActionResult Grid()
        {
            HttpContext        context     = System.Web.HttpContext.Current;
            string             gridName    = context.Request.QueryString["Name"];
            IMVCGridDefinition grid        = MVCGridDefinitionTable.GetDefinitionInterface(gridName);
            QueryOptions       options     = QueryStringParser.ParseOptions(grid, context.Request.QueryString);
            GridContext        gridContext = GridContextUtility.Create(/*context, */ gridName, grid, options);

            GridEngine engine = new GridEngine();

            if (!engine.CheckAuthorization(gridContext, context.User.Identity.IsAuthenticated))
            {
                return(new HttpStatusCodeResult(403, "Access denied"));
            }

            var renderingModel = engine.GenerateModel(gridContext);

            return(PartialView(grid.ViewPath, renderingModel));
        }