示例#1
0
 public void ModifyResponse(PowerTablesData data, PowerTablesResponse response)
 {
     if (_action != null)
     {
         _action(data, response);
     }
 }
示例#2
0
        public ActionResult Handle(PowerTablesData data, IResponseModifiersApplier responseModifiers)
        {
            // queryable reveals here
            var mapped = data.Mapped.Value;
            PowerTablesResponse ptr = new PowerTablesResponse()
            {
                PageIndex      = data.CurrentPage,
                ResultsCount   = data.ResultsCount,
                Data           = data.Configuration.EncodeResults(mapped),
                AdditionalData = new Dictionary <string, object>(),
                Success        = false
            };

            try
            {
                responseModifiers.ApplyResponseModifiers(data, ptr);
            }
            catch (Exception ex)
            {
                ptr.FormatException(ex);
            }

            ptr.Success = true;
            return(new JsonNetResult()
            {
                Data = ptr, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#3
0
        public void ModifyResponse(PowerTablesData data, PowerTablesResponse response)
        {
            TotalResponse tr = new TotalResponse()
            {
                TotalsForColumns = new Dictionary <string, object>()
            };
            var gData = new PowerTablesData <TSourceData, TTableData>(data);

            foreach (var keyValuePair in _calculator.Calculators)
            {
                var result = keyValuePair.Value.DynamicInvoke(gData);
                tr.TotalsForColumns[keyValuePair.Key] = result;
            }
            response.AdditionalData[TotalExtensions.PluginId] = tr;
        }