Ejemplo n.º 1
0
        static async Task ProcessEvent(DbEvent evt, BaseController ctrl)
        {
            // json, data, from evt
            var eo = new ExpandoObject();

            eo.Set("baseUrl", $"/_simple{evt.Path}");
            eo.Set("cmd", evt.Command);
            eo.Set("Id", evt.ItemId);
            var json = JsonConvert.SerializeObject(eo, JsonHelpers.StandardSerializerSettings);
            await ctrl.Data("invoke",
                            prms => {
                prms.Set("UserId", 0 /*system*/);
                prms.Set("Id", evt.ItemId);
            },
                            json,
                            null
                            );

            var evtBase = new DbEventBase()
            {
                Id = evt.Id
            };

            ctrl.DbContext.Execute <DbEventBase>(evt.Source, "a2sys.[DbEvent.Complete]", evtBase);
        }
Ejemplo n.º 2
0
 async Task Data(String command)
 {
     //  Ajax
     if (IsNotAjax())
     {
         return;
     }
     if (Request.HttpMethod != "POST")
     {
         return;
     }
     Response.ContentType = "application/json";
     try
     {
         using (var tr = new StreamReader(Request.InputStream))
         {
             String json = tr.ReadToEnd();
             await _baseController.Data(command, SetSqlQueryParams, json, Response);
         }
     }
     catch (Exception ex)
     {
         WriteExceptionStatus(ex);
     }
 }
Ejemplo n.º 3
0
 public async Task Data(String command, HttpRequestBase Request, HttpResponseBase Response)
 {
     Response.ContentType = "application/json";
     using (var tr = new StreamReader(Request.InputStream))
     {
         String json = tr.ReadToEnd();
         await _baseController.Data(command, SetParams, json, Response);
     }
 }