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); }
internal static string GenerateGrid(string gridName, out int statusCode, NameValueCollection nameValueCollection = null) { if (nameValueCollection == null) { nameValueCollection = new NameValueCollection(); } statusCode = 200; IMVCGridDefinition grid = MVCGridDefinitionTable.GetDefinitionInterface(gridName); QueryOptions options = QueryStringParser.ParseOptions(grid, nameValueCollection); GridContext gridContext = MVCGrid.NetCore.Utility.GridContextUtility.Create(/*context, */ gridName, grid, options); GridEngine engine = new GridEngine(); if (!engine.CheckAuthorization(gridContext)) { //Forbidden statusCode = 403; return(string.Empty); } IMVCGridRenderingEngine renderingEngine = GridEngine.GetRenderingEngine(gridContext); // TODO: Reimplement this for csv exports and other rendering responses. //renderingEngine.PrepareResponse(context.Response); StringBuilder sb = new StringBuilder(); TextWriter htmlWriter = new StringWriter(sb); engine.Run(renderingEngine, gridContext, htmlWriter); string html = sb.ToString(); return(html); }
/// <summary> /// Handles the table. /// </summary> /// <param name="context">The context.</param> /// TODO Edit XML Comment Template for HandleTable private static void HandleTable(HttpContext context) { var gridName = context.Request["Name"]; var grid = MvcGridDefinitionTable.GetDefinitionInterface(gridName); var options = QueryStringParser.ParseOptions(grid, context.Request); var gridContext = GridContextUtility.Create(context, gridName, grid, options); var engine = new GridEngine(); if (!engine.CheckAuthorization(gridContext)) { context.Response.StatusCode = 403; context.Response.End(); return; } var renderingEngine = GridEngine.GetRenderingEngine(gridContext); renderingEngine.PrepareResponse(context.Response); engine.Run(renderingEngine, gridContext, context.Response.Output); }