示例#1
0
        public void HandleEvent(object inputEventCustomProperties, FormInputManager inputManager, InvokeForm.Response result)
        {
            string outputField;

            if (inputEventCustomProperties.GetType() == typeof(JObject))
            {
                var jsonObj = (JObject)inputEventCustomProperties;

                outputField = jsonObj.GetValue(nameof(BindToOutputAttribute.OutputFieldId), StringComparison.OrdinalIgnoreCase).ToString();
            }
            else
            {
                var data = (CustomProperty)inputEventCustomProperties;
                outputField = data.OutputFieldId;
            }

            object value;

            if (result.Data.GetType() == typeof(JObject))
            {
                var jsonObj = (JObject)result.Data;
                value = jsonObj.GetValue(outputField, StringComparison.OrdinalIgnoreCase);
            }
            else
            {
                var propertyInfo = result.Data.GetType().GetProperty(outputField);
                value = propertyInfo?.GetValue(result.Data, null);
            }

            inputManager.Manager.SetValue(value);
        }
示例#2
0
        public void HandleEvent(IDictionary <string, object> inputEventCustomProperties, FormInputManager inputManager, InvokeForm.Response result)
        {
            var outputField = inputEventCustomProperties.GetCustomProperty <string>(nameof(BindToOutputAttribute.OutputFieldId));

            object value;

            if (result.Data.GetType() == typeof(JObject))
            {
                var jsonObj = (JObject)result.Data;
                value = jsonObj.GetValue(outputField, StringComparison.OrdinalIgnoreCase);
            }
            else
            {
                var propertyInfo = result.Data.GetType().GetProperty(outputField);
                value = propertyInfo?.GetValue(result.Data, null);
            }

            inputManager.Manager.SetValue(value);
        }