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); }
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); } }
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); } }