private void ExecuteError(int errcode, string errmessage) { try { System.Diagnostics.Debug.WriteLine("GeoLocation.ExecuteError"); System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = _funcError as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; Jint.Native.Function.ScriptFunctionInstance JintScript = _func.Target as Jint.Native.Function.ScriptFunctionInstance; Jint.Engine _JintEngine = JintScript.Engine; JsValue A = new JsValue(1); JsValue[] B = new Jint.Native.JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(_JintEngine); String FormatString = "{{\"code\":{0}, \"message\":\"{1}\"}}"; String Error = String.Format(FormatString, errcode, errmessage); B[0] = _jsp.Parse(Error); _func.Invoke(A, B); } catch (Exception exp) { System.Diagnostics.Debug.WriteLine("Exception" + exp.Message); } }
public object GetJson(string url, IDictionary <string, object> headers) { string result = get(url, headers); Jint.Native.Json.JsonParser praser = new Jint.Native.Json.JsonParser(new Jint.Engine()); return(praser.Parse(result)); }
private void ExecuteSuccess(Geoposition _pos) { try { System.Diagnostics.Debug.WriteLine("GeoLocation.ExecuteSuccess"); System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = _funcSuccess as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; Jint.Native.Function.ScriptFunctionInstance JintScript = _func.Target as Jint.Native.Function.ScriptFunctionInstance; Jint.Engine _JintEngine = JintScript.Engine; JsValue A = new JsValue(1); JsValue[] B = new JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(_JintEngine); String FormatString = "{{\"coords\":{{\"latitude\":{0}, \"longitude\":{1}}}}}"; String Coordinates = String.Format(FormatString, _pos.Coordinate.Latitude, _pos.Coordinate.Longitude); B[0] = _jsp.Parse(Coordinates); _func.Invoke(A, B); } catch (Jint.Runtime.JavaScriptException exc) { System.Diagnostics.Debug.WriteLine("JavaScriptException" + exc.Message + " " + exc.LineNumber); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception" + e.Message); ExecuteError(e.HResult, e.Message); } }
public void Ready() { try { if (!_Pebble.EventListeners.ContainsKey("ready")) { return; } var jsfunction = _Pebble.EventListeners["ready"]; System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = jsfunction as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; Jint.Native.JsValue A = new JsValue(1); Jint.Native.JsValue[] B = new Jint.Native.JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(_JintEngine); B[0] = _jsp.Parse("{}"); Jint.Native.JsValue C = _func.Invoke(A, B); } catch (Jint.Runtime.JavaScriptException exp) { String Exception = String.Format("{0}" + Environment.NewLine + "Line: {1}" + Environment.NewLine + "Source: {2}", exp.Message, exp.LineNumber, _JavascriptLines[exp.LineNumber - 1]); throw new System.Exception(Exception); } catch (Exception exp) { throw exp; } }
/// <summary> /// Simplifies an IMSI object /// </summary> public ExpandoObject ToViewModel(IdentifiedData data) { try { // Serialize to a view model serializer using (MemoryStream ms = new MemoryStream()) { using (TextWriter tw = new StreamWriter(ms, Encoding.UTF8, 2048, true)) this.m_modelSerializer.Serialize(tw, data); ms.Seek(0, SeekOrigin.Begin); // Parse Jint.Native.Json.JsonParser parser = new Jint.Native.Json.JsonParser(JavascriptBusinessRulesEngine.Current.Engine); JsonSerializer jsz = new JsonSerializer() { DateFormatHandling = DateFormatHandling.IsoDateFormat, TypeNameHandling = TypeNameHandling.None }; using (JsonReader reader = new JsonTextReader(new StreamReader(ms))) { var retVal = jsz.Deserialize <Newtonsoft.Json.Linq.JObject>(reader); return(this.ConvertToJint(retVal)); ///return retVal; } } } catch (Exception e) { this.m_tracer.TraceError("Error converting to view model: {0}", e); throw; } }
public object GetJson(string url, string username, string password) { string result = get(url, username, password); Jint.Native.Json.JsonParser praser = new Jint.Native.Json.JsonParser(new Jint.Engine()); return(praser.Parse(result)); }
public object GetJson(string url, string token) { string result = get(url, token); Jint.Native.Json.JsonParser praser = new Jint.Native.Json.JsonParser(new Jint.Engine()); return(praser.Parse(result)); }
private static bool JwtLogin(FrontContext frontContext, Authentication authentication) { var jwt = new kJwt(frontContext.RenderContext); var json = jwt.Decode(); var jsonParser = new Jint.Native.Json.JsonParser(new Jint.Engine()); var result = jsonParser.Parse(json); var code = result.AsObject().Get("code").AsNumber(); if (code == 1) { switch (authentication.FailedAction) { case FailedAction.None: frontContext.RenderContext.Response.AppendString(result.AsObject().Get("value").ToString()); break; case FailedAction.ResultCode: frontContext.RenderContext.Response.StatusCode = authentication.HttpCode; break; case FailedAction.Redirect: frontContext.RenderContext.Response.Redirect(302, authentication.Url); break; default: break; } return(false); } else { frontContext.RenderContext.Items.Add("jwt_payload", result.AsObject().Get("value")); return(true); } }
public object GetJson(string url) { string result = _get(url).Result; Jint.Native.Json.JsonParser praser = new Jint.Native.Json.JsonParser(new Jint.Engine()); return(praser.Parse(result)); // return Kooboo.Lib.Helper.JsonHelper.Deserialize(result); }
public void WebViewClosed(String Data) { try { if (!_Pebble.EventListeners.ContainsKey("webviewclosed")) { return; } var jsfunction = _Pebble.EventListeners["webviewclosed"]; String Argument = Data; String[] Result = Data.Split("#".ToCharArray()); if (Result.Count() > 1) { Argument = Result[1]; System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = jsfunction as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; Jint.Native.JsValue A = new JsValue(1); Jint.Native.JsValue[] B = new Jint.Native.JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(_JintEngine); String JSON = String.Format("{{\"response\":\"{0}\"}}", Uri.EscapeUriString(Uri.UnescapeDataString(Argument))); Jint.Native.JsValue _eValue = _jsp.Parse(JSON); B[0] = _eValue; Jint.Native.JsValue C = _func.Invoke(A, B); } } catch (Jint.Runtime.JavaScriptException exp) { String Exception = String.Format("{0}" + Environment.NewLine + "Line: {1}" + Environment.NewLine + "Source: {2}", exp.Message, exp.LineNumber, _JavascriptLines[exp.LineNumber - 1]); throw new System.Exception(Exception); } catch (Exception exp) { throw exp; } }
public async void sendAppMessage(ExpandoObject data, object functionAck, object functionNack) { await sendAppMessage(data); System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = functionAck as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; Jint.Native.JsValue A = new JsValue(1); Jint.Native.JsValue[] B = new Jint.Native.JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(JintEngine); String JSON = "null"; Jint.Native.JsValue _eValue = _jsp.Parse(JSON); B[0] = _eValue; Jint.Native.JsValue C = _func.Invoke(A, B); }
public async void send(object data) { WebResponse _response; try { System.Diagnostics.Debug.WriteLine(String.Format("XMLHttpRequest.send data={0}", data == null ? "null" : data.ToString())); _httpWebRequest.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586"; //_httpWebRequest.Accept = "text/html, application/json"; //Accept-Encoding: gzip, deflate //Accept-Language: nl-NL, nl; q=0.5 //Cache-Control: no-cache //Connection: Keep-Alive //Host: nominatim.openstreetmap.org //User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586 _response = await _httpWebRequest.GetResponseAsync(); Stream _stream = _response.GetResponseStream(); StreamReader _tr = new StreamReader(_stream); String Response = _tr.ReadToEnd(); System.Diagnostics.Debug.WriteLine(String.Format("XMLHttpRequest.send response={0}", Response)); _readyState = 4; _status = 200; _responseText = Response; if (onload != null) { var jsfunction = onload; System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = jsfunction as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; String JSON = String.Format("{{\"responseText\":\"{0}\" }}", JSONEncode(Response)); Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(new Jint.Engine()); Jint.Native.JsValue _eValue = _jsp.Parse(JSON); Jint.Native.JsValue A = _eValue; Jint.Native.JsValue[] B = new JsValue[1]; B[0] = new Jint.Native.JsValue(Response); Jint.Native.JsValue C = _func.Invoke(A, B); } } catch (Jint.Runtime.JavaScriptException exc) { System.Diagnostics.Debug.WriteLine("JavaScriptException " + exc.Message + exc.LineNumber); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Exception " + e.Message); } finally { //_response.Close; } }
public async Task AppMessage(Dictionary <int, object> Content) { try { if (!_Pebble.EventListeners.ContainsKey("appmessage")) { return; } var jsfunction = _Pebble.EventListeners["appmessage"]; System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> _func = jsfunction as System.Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue>; String JSON = ""; foreach (var item in Content) { var keys = from entry in _ParentItem.AppKeys where entry.Value == item.Key select entry.Key; if (keys.Count() == 1) { if (JSON.Length > 0) { JSON += ", "; } JSON += String.Format("\"{0}\": ", keys.FirstOrDefault()); if (item.Value.GetType() == typeof(string)) { JSON += String.Format("\"{0}\"", item.Value); } if (item.Value.GetType() == typeof(int)) { JSON += String.Format("{0}", item.Value); } if (item.Value.GetType() == typeof(bool)) { JSON += String.Format("{0}", (bool)item.Value ? 1 : 0); } } } Jint.Native.JsValue A = new JsValue(1); Jint.Native.JsValue[] B = new Jint.Native.JsValue[1]; Jint.Native.Json.JsonParser _jsp = new Jint.Native.Json.JsonParser(_JintEngine); B[0] = _jsp.Parse(String.Format("{{\"payload\": {{ {0} }} }}", JSON)); Jint.Native.JsValue C = _func.Invoke(A, B); } catch (Jint.Runtime.JavaScriptException exp) { String Exception = String.Format("{0}" + Environment.NewLine + "Line: {1}" + Environment.NewLine + "Source: {2}", exp.Message, exp.LineNumber, _JavascriptLines[exp.LineNumber - 1]); throw new System.Exception(Exception); } catch (Exception exp) { throw exp; } }
public virtual void Execute(object controller, Dictionary <string, Parameter> parameters, View view, Dictionary <string, object> values, DataRow prevRow, string pk, string connectionString, int currentUsetId, string currentUserRole, IDbCommand command, IDbCommand sysCommand, string actionName, Durados.TriggerDataAction dataAction) { if (pk != null && (prevRow == null || dataAction == TriggerDataAction.AfterCreate || dataAction == TriggerDataAction.AfterEdit || dataAction == TriggerDataAction.AfterCreateBeforeCommit || dataAction == TriggerDataAction.AfterEditBeforeCommit) && controller is Durados.Data.IData) { try { if (((Durados.Data.IData)controller).DataHandler != null) { prevRow = ((Durados.Data.IData)controller).DataHandler.GetDataRow(view, pk, command); } } catch { } } var guid = Guid.NewGuid(); //if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Request.QueryString[GuidKey] != null) //{ // guid = new Guid(System.Web.HttpContext.Current.Request.QueryString[GuidKey]); //} SetCacheInCurrentRequest("js" + guid, new Dictionary <string, object>() { { "controller", controller }, { "connectionString", connectionString }, { "currentUsetId", currentUsetId }, { "currentUserRole", currentUserRole }, { "command", command }, { "sysCommand", sysCommand }, { "actionName", actionName }, { "dataAction", dataAction } }); SetCacheInCurrentRequest(ConnectionStringKey, view.Database.SysDbConnectionString); SetCacheInCurrentRequest(GuidKey, guid); if (!parameters.ContainsKey("code")) { throw new DuradosException("code was not supplied"); } string code = parameters["code"].Value.Replace(Engine.AsToken(values), ((Durados.Workflow.INotifier)controller).GetTableViewer(), view); string currentUsername = view.Database.GetCurrentUsername(); try { code = code.Replace(Durados.Database.UserPlaceHolder, currentUsetId.ToString(), false).Replace(Durados.Database.SysUserPlaceHolder.AsToken(), currentUsetId.ToString(), false) .Replace(Durados.Database.UsernamePlaceHolder, currentUsername, false).Replace(Durados.Database.SysUsernamePlaceHolder.AsToken(), currentUsername) .Replace(Durados.Database.RolePlaceHolder, currentUserRole, false).Replace(Durados.Database.SysRolePlaceHolder.AsToken(), currentUserRole) .ReplaceConfig(view); } catch { } Dictionary <string, object> clientParameters = new Dictionary <string, object>(); Dictionary <string, object> newRow = new Dictionary <string, object>(); Dictionary <string, object> oldRow = new Dictionary <string, object>(); Dictionary <string, object> userProfile = new Dictionary <string, object>(); bool debug = false; if (IsDebug()) { debug = true; } if (values != null) { foreach (string key in values.Keys) { if (key == "$$debug$$" || key == "$$debug$$".AsToken()) { debug = true; } else { string keyWithoutToken = key.TrimStart("{{".ToCharArray()).TrimEnd("}}".ToCharArray()); if (key.StartsWith("{{")) { if (!clientParameters.ContainsKey(keyWithoutToken)) { clientParameters.Add(keyWithoutToken, values[key]); } } if (view.GetFieldsByJsonName(keyWithoutToken) == null || view.GetFieldsByJsonName(keyWithoutToken).Length == 0) { if (view.Fields.ContainsKey(keyWithoutToken)) { string jsonName = view.Fields[keyWithoutToken].JsonName; if (!newRow.ContainsKey(jsonName)) { newRow.Add(jsonName, values[key]); } } else { if (!clientParameters.ContainsKey(keyWithoutToken)) { clientParameters.Add(keyWithoutToken, values[key]); } } } else { if (!newRow.ContainsKey(keyWithoutToken)) { newRow.Add(keyWithoutToken, values[key]); } } } } } SetCacheInCurrentRequest(Debug, debug); if (prevRow != null) { foreach (Field field in view.Fields.Values) { if (!oldRow.ContainsKey(field.JsonName)) { if (field.FieldType == FieldType.Column && field.IsDate) { oldRow.Add(field.JsonName, prevRow[((ColumnField)field).DataColumn.ColumnName]); } else { oldRow.Add(field.JsonName, field.GetValue(prevRow)); } } } //var shallowRow = view.RowToShallowDictionary(prevRow, pk); //foreach (Field field in view.Fields.Values) //{ // if (oldRow.ContainsKey(field.JsonName) && shallowRow.ContainsKey(field.JsonName)) // { // if (field.FieldType == FieldType.Column && (field.IsBoolean || field.IsPoint || field.IsNumeric)) // { // oldRow[field.JsonName] = shallowRow[field.JsonName]; // } // } //} } userProfile.Add("username", view.Database.GetCurrentUsername()); userProfile.Add("role", currentUserRole); userProfile.Add("app", view.Database.GetCurrentAppName()); userProfile.Add("userId", view.Database.GetCurrentUserId()); userProfile.Add("token", GetUserProfileAuthToken(view)); userProfile.Add("anonymousToken", view.Database.GetAnonymousToken().ToString()); userProfile.Add("info", GetUserProfileInfo(view)); if (!clientParameters.ContainsKey(FILEDATA)) { int parametersLimit = (int)view.Database.GetLimit(Limits.ActionParametersKbSize); HandleParametersSizeLimit(parametersLimit, clientParameters); userProfile.Add("request", GetRequest()); } var CONSTS = new Dictionary <string, object>() { { "apiUrl", System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Host + ":" + System.Web.HttpContext.Current.Request.Url.Port + System.Web.HttpContext.Current.Request.ApplicationPath }, { "actionGuid", System.Web.HttpContext.Current.Request.QueryString[GuidKey] ?? (System.Web.HttpContext.Current.Items[GuidKey] ?? guid.ToString()) } }; //Newtonsoft.Json.JsonConvert.SerializeObject var theJavaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); theJavaScriptSerializer.MaxJsonLength = int.MaxValue; var parser = new Jint.Native.Json.JsonParser(call2); //var userInput = parser.Parse(theJavaScriptSerializer.Serialize(newRow)); //Object clientParametersToSend = null; //if (!clientParameters.ContainsKey("filedata")) //{ // clientParametersToSend = parser.Parse(theJavaScriptSerializer.Serialize(clientParameters)); //} //else //{ // System.Web.HttpContext.Current.Items["file_stream"] = clientParameters["filedata"]; // clientParameters["filedata"] = "file_stream"; // clientParametersToSend = clientParameters; //} //var dbRow = parser.Parse(theJavaScriptSerializer.Serialize(oldRow)); //var userProfile2 = parser.Parse(theJavaScriptSerializer.Serialize(userProfile)); //var CONSTS2 = parser.Parse(theJavaScriptSerializer.Serialize(CONSTS)); //var Config = view.Database.GetConfigDictionary(); //var Config2 = parser.Parse(theJavaScriptSerializer.Serialize(Config)); var userInput = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(newRow)); Object clientParametersToSend = null; bool upload = false; if (!clientParameters.ContainsKey(FILEDATA)) { clientParametersToSend = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(clientParameters)); } else { upload = true; System.Web.HttpContext.Current.Items["file_stream"] = clientParameters[FILEDATA]; clientParameters[FILEDATA] = "file_stream"; clientParametersToSend = clientParameters; } if (clientParameters.ContainsKey(FILEDATA) || clientParameters.ContainsKey(FILENAME)) { System.Web.HttpContext.Current.Items[StorageAccountsKey] = view.Database.CloudStorages; } var dbRow = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(oldRow)); var userProfile2 = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(userProfile)); var CONSTS2 = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(CONSTS)); var Config = view.Database.GetConfigDictionary(); var Config2 = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(Config)); var Environment = view.Database.GetEnvironmentDictionary(); var Environment2 = parser.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(Environment)); Limits limit = Limits.ActionTimeMSec; if (upload) { limit = Limits.UploadTimeMSec; } object actionTimeMSecObject = view.Database.GetLimit(limit); int actionTimeMSec = -1; if (!Int32.TryParse(actionTimeMSecObject.ToString(), out actionTimeMSec)) { throw new DuradosException("actionTimeMSecLimit in web.config is not numeric or too long"); } TimeSpan?timeoutInterval = new TimeSpan(0, 0, 0, 0, actionTimeMSec); if (actionTimeMSec == 0) { timeoutInterval = null; } string actionId = Guid.NewGuid().ToString(); string startMessage = theJavaScriptSerializer.Serialize(new { objectName = view.JsonName, actionName = actionName, id = actionId, @event = "started", time = GetSequence(view), data = new { userInput = newRow, dbRow = oldRow, parameters = clientParameters, userProfile = userProfile } }); Backand.Logger.Log(startMessage, 502); var call = new Jint.Engine(cfg => cfg.AllowClr(typeof(Backand.XMLHttpRequest).Assembly), timeoutInterval, GetLineStart(), new ActionPath() { @object = view.JsonName, action = actionName }); try { call.SetValue("userInput", userInput) .SetValue("btoa", new btoaHandler(Backand.Convert.btoa)) .SetValue("dbRow", dbRow) .SetValue("parameters", clientParametersToSend) .SetValue("userProfile", userProfile2) .SetValue("CONSTS", CONSTS2) .SetValue("Config", Config2) .SetValue("Environment", Environment2) .Execute(GetXhrWrapper() + code + "; function call(){return backandCallback(userInput, dbRow, parameters, userProfile);}"); } catch (TimeoutException exception) { Handle503(theJavaScriptSerializer, view.JsonName, actionName, actionId, exception.Message, view); string errorMessage = "Timeout: The operation took longer than " + actionTimeMSec + " milliseconds limit. at (" + view.JsonName + "/" + actionName + ")"; if (!IsSubAction()) { Backand.Logger.Log(exception.Message, 501); if (IsDebug()) { throw new MainActionInDebugJavaScriptException(errorMessage, exception); } else { throw new MainActionJavaScriptException(errorMessage, exception); } } else { throw new SubActionJavaScriptException(errorMessage, exception); } } catch (Exception exception) { Handle503(theJavaScriptSerializer, view.JsonName, actionName, actionId, exception.Message, view); string errorMessage = "Syntax error: " + HandleLineCodes(exception.Message, view.JsonName, actionName, view, IsDebug()); if (!IsSubAction()) { Backand.Logger.Log(exception.Message, 501); if (IsDebug()) { throw new MainActionInDebugJavaScriptException(errorMessage, exception); } else { throw new MainActionJavaScriptException(errorMessage, exception); } } else { throw new SubActionJavaScriptException(errorMessage, exception); } } object r = null; try { var r2 = call.GetValue("call").Invoke(); if (!r2.IsNull()) { r = r2.ToObject(); } string endMessage = null; try { endMessage = theJavaScriptSerializer.Serialize(new { objectName = view.JsonName, actionName = actionName, id = actionId, @event = "ended", time = GetSequence(view), data = r }); } catch (Exception exception) { if (exception.Message.StartsWith("A circular reference was detected while serializing an object")) { object oNull = null; endMessage = theJavaScriptSerializer.Serialize(new { objectName = view.JsonName, actionName = actionName, id = actionId, @event = "ended", time = GetSequence(view), data = oNull }); } else { endMessage = "Failed to serialize response"; if (!IsSubAction()) { Backand.Logger.Log(endMessage, 501); //if (IsDebug()) //{ // values[ReturnedValueKey] = message; // return; //} //else if (IsDebug()) { throw new MainActionInDebugJavaScriptException(endMessage, exception); } else { throw new MainActionJavaScriptException(endMessage, exception); } } else { throw new SubActionJavaScriptException(endMessage, exception); } } } Backand.Logger.Log(endMessage, 503); } catch (TimeoutException exception) { string message = "Timeout: The operation took longer than " + actionTimeMSec + " milliseconds limit. at (" + view.JsonName + "/" + actionName + ")"; Handle503(theJavaScriptSerializer, view.JsonName, actionName, actionId, message, view); if (!IsSubAction()) { Backand.Logger.Log(message, 501); if (IsDebug()) { throw new MainActionInDebugJavaScriptException(message, exception); } else { throw new MainActionJavaScriptException(message, exception); } } else { throw new SubActionJavaScriptException(message, exception); } } catch (Exception exception) { string message = (exception.InnerException == null) ? exception.Message : exception.InnerException.Message; string trace = message; if (exception is Jint.Runtime.JavaScriptException) { trace = ((Jint.Runtime.JavaScriptException)exception).GetTrace(); } trace = HandleLineCodes(trace, view.JsonName, actionName, view, IsDebug()); Handle503(theJavaScriptSerializer, view.JsonName, actionName, actionId, trace, view); if (!IsSubAction()) { IMainActionJavaScriptException mainActionJavaScriptException; Backand.Logger.Log(trace, 501); if (IsDebug()) { mainActionJavaScriptException = new MainActionInDebugJavaScriptException(message, exception); } else { mainActionJavaScriptException = new MainActionJavaScriptException(message, exception); } mainActionJavaScriptException.JintTrace = trace; throw (Exception)mainActionJavaScriptException; } else { throw new SubActionJavaScriptException(message, exception); } } var v = call.GetValue("userInput").ToObject(); if (v != null && v is System.Dynamic.ExpandoObject) { IDictionary <string, object> newValues = v as IDictionary <string, object>; foreach (string key in newValues.Keys) { if (values.ContainsKey(key)) { object val = newValues[key]; Field[] fields = view.GetFieldsByJsonName(key); val = DateConversion(view, val, fields); values[key] = val; } else { Field[] fields = view.GetFieldsByJsonName(key); if (fields.Length > 0) { string fieldName = fields[0].Name; object val = newValues[key]; val = DateConversion(view, val, fields); if (values.ContainsKey(fieldName)) { values[fieldName] = val; } else { values.Add(fieldName, val); } } else { values.Add(key, newValues[key]); } } } } if (r != null && values != null && dataAction == TriggerDataAction.OnDemand) { if (!values.ContainsKey(ReturnedValueKey)) { values.Add(ReturnedValueKey, r); } else { values[ReturnedValueKey] = r; } } }