Пример #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 = GridOptionParser.ParseOptions(grid, gridName, 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);
        }
Пример #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));
        }
Пример #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));
        }
Пример #4
0
        public ActionResult Grid()
        {
            var context = System.Web.HttpContext.Current;

            string gridName = context.Request["Name"];

            var grid = MVCGridDefinitionTable.GetDefinitionInterface(gridName);

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

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

            GridEngine engine = new GridEngine();

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

            var renderingModel = engine.GenerateModel(gridContext);

            return(PartialView(grid.ViewPath, renderingModel));
        }
Пример #5
0
        public static IHtmlString MVCGrid(this HtmlHelper helper, string name, object pageParameters)
        {
            var currentMapping = MVCGridDefinitionTable.GetDefinitionInterface(name);

            return(MVCGrid(helper, name, currentMapping, pageParameters));
        }