Beispiel #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);
        }
Beispiel #2
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));
        }