public OneSpanSign.API.ConditionalField ToAPIConditionalField() { if (sdkField == null) { return(apiField); } OneSpanSign.API.ConditionalField result = new OneSpanSign.API.ConditionalField(); result.Name = sdkField.Name; result.Extract = sdkField.Extract; result.Page = sdkField.Page; result.Id = sdkField.Id; if (!sdkField.Extract) { result.Left = sdkField.X; result.Top = sdkField.Y; result.Width = sdkField.Width; result.Height = sdkField.Height; } if (sdkField.TextAnchor != null) { result.ExtractAnchor = new TextAnchorConverter(sdkField.TextAnchor).ToAPIExtractAnchor(); } result.Value = sdkField.Value; if (sdkField.Style == FieldStyle.BOUND_QRCODE) { result.Type = new FieldTypeConverter(FieldType.IMAGE).ToAPIFieldType(); } else { result.Type = new FieldTypeConverter(FieldType.INPUT).ToAPIFieldType(); } result.Subtype = new FieldStyleAndSubTypeConverter(sdkField.Style).ToAPIFieldSubtype(); result.Binding = sdkField.Binding; if (sdkField.Validator != null) { result.Validation = new FieldValidatorConverter(sdkField.Validator).ToAPIFieldValidation(); } if (sdkField.Conditions != null) { foreach (var condition in sdkField.Conditions) { result.AddCondition(new FieldConditionConverter(condition).ToAPIFieldCondition()); } } return(result); }
private OneSpanSign.API.ConditionalField CreateTypicalAPIConditionalField() { OneSpanSign.API.ConditionalField apiField = new OneSpanSign.API.ConditionalField(); apiField.Extract = false; apiField.Height = 100.0; apiField.Left = 10.0; apiField.Id = "3"; apiField.Name = "Field Name"; apiField.Page = 1; apiField.Subtype = FieldStyle.UNBOUND_TEXT_FIELD.getApiValue(); apiField.Top = 101.0; apiField.Type = "INPUT"; apiField.Value = "field value"; apiField.Width = 102.0; OneSpanSign.API.FieldCondition condition = new OneSpanSign.API.FieldCondition(); condition.Id = "ConditionId"; condition.Condition = "document['DocumentId'].field['fieldId2'].value == 'X'"; condition.Action = "document['DocumentId'].field['fieldId1'].disabled = true"; apiField.AddCondition(condition); return(apiField); }