/// <summary> /// Returns <see cref="IOptionObject2015"/> as an HTML string without HTML headers. /// </summary> /// <param name="optionObject"></param> /// <returns></returns> public static string TransformToHtmlString(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "formObject"); } return(TransformToHtmlString(optionObject, false)); }
/// <summary> /// Sets all <see cref="IFieldObject"/> in the <see cref="IOptionObject2015"/> to disabled. /// </summary> /// <param name="optionObject"></param> /// <returns></returns> public static IOptionObject2015 DisableAllFieldObjects(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } return(DisableAllFieldObjects(optionObject, new List <string>())); }
/// <summary> /// Returns <see cref="IOptionObject2015"/> as an HTML string without HTML headers. /// </summary> /// <param name="optionObject"></param> /// <returns></returns> public static string TransformToHtmlString(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(TransformToHtmlString(optionObject, false)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject2015"/> as locked by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static IOptionObject2015 SetLockedField(IOptionObject2015 optionObject, string fieldNumber) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } return(SetFieldObject(optionObject, FieldAction.Lock, fieldNumber)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject2015"/> as enabled. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldObjects"></param> /// <returns></returns> public static IOptionObject2015 SetEnabledFields(IOptionObject2015 optionObject, List <FieldObject> fieldObjects) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } return(SetFieldObjects(optionObject, FieldAction.Enable, fieldObjects)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject2015"/> as unlocked by FieldNumbers. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumbers"></param> /// <returns></returns> public static IOptionObject2015 SetUnlockedFields(IOptionObject2015 optionObject, List <string> fieldNumbers) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject2"); } return(SetFieldObjects(optionObject, FieldAction.Unlock, fieldNumbers)); }
/// <summary> /// Returns the desired command based on the provided <see cref="OptionObject2015"/> and parameter. /// </summary> /// <param name="optionObject"></param> /// <param name="parameter"></param> /// <returns></returns> public static IRunScriptCommand GetCommand(IOptionObject2015 optionObject, IParameter parameter) { if (optionObject == null) { logger.Error("The provided {object} is null", nameof(OptionObject2015)); return(new DefaultScriptCommand(new OptionObjectDecorator(new OptionObject2015()), parameter)); } // Setup Decorator IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject); // Get Dependencies, such as repositories and services // Select Command logger.Debug("Script '" + parameter.ScriptName + "' requested."); switch (parameter.ScriptName) { case "GetErrorCode0": logger.Debug(nameof(GetErrorCode0Command) + " selected."); return(new GetErrorCode0Command(optionObjectDecorator)); case "GetErrorCode1": logger.Debug(nameof(GetErrorCode1Command) + " selected."); return(new GetErrorCode1Command(optionObjectDecorator)); case "GetErrorCode2": logger.Debug(nameof(GetErrorCode2Command) + " selected."); return(new GetErrorCode2Command(optionObjectDecorator)); case "GetErrorCode3": logger.Debug(nameof(GetErrorCode3Command) + " selected."); return(new GetErrorCode3Command(optionObjectDecorator)); case "GetErrorCode4": logger.Debug(nameof(GetErrorCode4Command) + " selected."); return(new GetErrorCode4Command(optionObjectDecorator)); case "GetErrorCode5": logger.Debug(nameof(GetErrorCode5Command) + " selected."); return(new GetErrorCode5Command(optionObjectDecorator)); case "GetErrorCode6": logger.Debug(nameof(GetErrorCode6Command) + " selected."); return(new GetErrorCode6Command(optionObjectDecorator)); case "GetFieldValue": logger.Debug(nameof(GetFieldValueCommand) + " selected."); return(new GetFieldValueCommand(optionObjectDecorator, parameter)); case "SetFieldValue": logger.Debug(nameof(SetFieldValueCommand) + " selected."); return(new SetFieldValueCommand(optionObjectDecorator, parameter)); default: logger.Debug(nameof(DefaultScriptCommand) + " selected."); return(new DefaultScriptCommand(optionObjectDecorator, parameter)); } }
public static IOptionObject2015 Clone(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException("The parameter cannot be null.", "optionObject"); } return(TransformToOptionObject2015(optionObject.ToJson())); }
/// <summary> /// Sets <see cref="FieldObject"/> in an <see cref="IOptionObject2015"/> according to specified FieldAction. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldAction"></param> /// <param name="fieldObjects"></param> /// <returns></returns> public static IOptionObject2015 SetFieldObjects(IOptionObject2015 optionObject, string fieldAction, List <FieldObject> fieldObjects) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } List <string> fieldNumbers = GetFieldNumbersToSet(fieldObjects); return(SetFieldObjects(optionObject, fieldAction, fieldNumbers)); }
/// <summary> /// Used to create the <see cref="IOptionObject2015"/> for return to myAvatar using provide Error Code and Error Message. /// </summary> /// <param name="optionObject"></param> /// <param name="errorCode"></param> /// <param name="errorMessage"></param> /// <returns></returns> public static IOptionObject2015 GetReturnOptionObject(IOptionObject2015 optionObject, double errorCode, string errorMessage) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } IOptionObject2015 returnOptionObject = RemoveUneditedRows(optionObject); returnOptionObject = SetErrorCodeAndMessage(returnOptionObject, errorCode, errorMessage); return(returnOptionObject); }
/// <summary> /// Sets <see cref="FieldObject"/> in an <see cref="IOptionObject2015"/> according to specified FieldAction. /// </summary> /// <param name="optionObject2015"></param> /// <param name="fieldAction"></param> /// <param name="fieldNumbers"></param> /// <returns></returns> public static IOptionObject2015 SetFieldObjects(IOptionObject2015 optionObject2015, string fieldAction, List <string> fieldNumbers) { if (optionObject2015 == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject2015"); } if (optionObject2015.Forms == null || optionObject2015.Forms.Count == 0) { throw new NullReferenceException("There are no FormObjects in this OptionObject."); } if (fieldAction == null || fieldAction == "") { throw new ArgumentNullException("No FieldAction has been identified."); } if (fieldNumbers == null || fieldNumbers.Count == 0) { throw new ArgumentNullException("No FieldObjects have been identified to disable."); } List <string> fieldsToSet = new List <string>(); foreach (string fieldNumber in fieldNumbers) { if (IsFieldPresent(optionObject2015, fieldNumber)) { fieldsToSet.Add(fieldNumber); } } if (fieldsToSet.Count == 0) { throw new ArgumentException("None of the identified FieldsObjects were found in this OptionObject."); } int formErrors = 0; for (int i = 0; i < optionObject2015.Forms.Count; i++) { try { optionObject2015.Forms[i] = (FormObject)SetFieldObjects(optionObject2015.Forms[i], fieldAction, fieldsToSet); } catch (Exception) { // The FieldObjects to set may not be present on each FormObject formErrors++; } } if (formErrors == optionObject2015.Forms.Count) { throw new ArgumentException("None of the identified FieldsObjects were able to be set in " + optionObject2015.Forms.Count.ToString() + " FormObjects"); } return(optionObject2015); }
/// <summary> /// Used to create the <see cref="IOptionObject2015"/> for return to myAvatar using provide Error Code and Error Message. /// </summary> /// <param name="optionObject"></param> /// <param name="errorCode"></param> /// <param name="errorMessage"></param> /// <returns></returns> public static IOptionObject2015 GetReturnOptionObject(IOptionObject2015 optionObject, double errorCode, string errorMessage) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } IOptionObject2015 returnOptionObject = ((OptionObjectBase)optionObject).Clone(); RemoveUneditedRows(returnOptionObject); SetErrorCodeAndMessage(returnOptionObject, errorCode, errorMessage); return(returnOptionObject); }
/// <summary> /// Flags a <see cref="IRowObject"/> for deletion in specified <see cref="IOptionObject2015"/>. /// </summary> /// <param name="optionObject"></param> /// <param name="rowObject"></param> /// <returns></returns> public static IOptionObject2015 DeleteRowObject(IOptionObject2015 optionObject, IRowObject rowObject) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } if (rowObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "rowObject"); } return(DeleteRowObject(optionObject, rowObject.RowId)); }
/// <summary> /// Creates a <see cref="IFormObject"/> with specified FormId and adds to an <see cref="IOptionObject2015"/> using provided FormId and indicating whether it is a multiple iteration table. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <param name="multipleIteration"></param> /// <returns></returns> public static IOptionObject2015 AddFormObject(IOptionObject2015 optionObject, string formId, bool multipleIteration) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } FormObject formObject = new FormObject { FormId = formId, MultipleIteration = multipleIteration }; return(AddFormObject(optionObject, formObject)); }
/// <summary> /// Returns <see cref="IOptionObject2015"/> as an HTML string with or without HTML headers. /// </summary> /// <param name="optionObject"></param> /// <param name="includeHtmlHeaders"></param> /// <returns></returns> public static string TransformToHtmlString(IOptionObject2015 optionObject, bool includeHtmlHeaders) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } StringBuilder sb = new StringBuilder(); sb.Append(GetHeader(optionObject.GetType().ToString(), includeHtmlHeaders)); sb.Append(GetHtmlForObject(optionObject, HtmlOutputType.Table)); sb.Append(AddFormTables(optionObject, 2)); sb.Append(GetFooter(includeHtmlHeaders)); return(sb.ToString()); }
/// <summary> /// Returns the FieldValue of a specified <see cref="IFieldObject"/> in an <see cref="IOptionObject2015"/> by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static string GetFieldValue(IOptionObject2015 optionObject, string fieldNumber) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } foreach (var form in optionObject.Forms) { if (form.IsFieldPresent(fieldNumber)) { return(GetFieldValue(form, fieldNumber)); } } throw new ArgumentException("FieldObject (" + fieldNumber + ") could not be found."); }
/// <summary> /// Returns whether a <see cref="FormObject"/> exists in an <see cref="OptionObject2015"/> by <see cref="FormObject.FormId"/>. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <returns></returns> public static bool IsFormPresent(IOptionObject2015 optionObject, string formId) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (formId == null || formId == "") { throw new ArgumentNullException("Parameter cannot be null or blank.", "formId"); } if (optionObject.Forms == null || optionObject.Forms.Count == 0) { return(false); } return(optionObject.Forms.Exists(f => f.FormId == formId)); }
/// <summary> /// Returns whether the <see cref="IFieldObject"/> in the <see cref="IOptionObject2015"/> is present by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static bool IsFieldPresent(IOptionObject2015 optionObject, string fieldNumber) { if (optionObject == null) throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); if (optionObject.Forms == null) throw new NullReferenceException("The OptionObject does not contain any Forms."); if (fieldNumber == null || fieldNumber == "") throw new ArgumentNullException("Parameter cannot be null or blank.", "fieldNumber"); foreach (var form in optionObject.Forms) { if (IsFieldPresent(form, fieldNumber)) { return true; } } return false; }
/// <summary> /// Returns a list of FieldValues of a specified <see cref="IFieldObject"/> in the <see cref="IOptionObject2015"/> by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static List <string> GetFieldValues(IOptionObject2015 optionObject, string fieldNumber) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (optionObject.Forms == null || optionObject.Forms.Count == 0) { throw new NullReferenceException("There are no FormObjects in this OptionObject"); } foreach (var form in optionObject.Forms) { if (IsFieldPresent(form, fieldNumber)) { return(GetFieldValues(form, fieldNumber)); } } return(new List <string>()); }
/// <summary> /// Returns <see cref="IOptionObject2015"/> as an HTML string with or without HTML headers. /// </summary> /// <param name="optionObject"></param> /// <param name="includeHtmlHeaders"></param> /// <returns></returns> public static string TransformToHtmlString(IOptionObject2015 optionObject, bool includeHtmlHeaders) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } string html = ""; html += includeHtmlHeaders ? GetHtmlHeader() : ""; html += GetPageHeader(optionObject.GetType().ToString()); html += "<h2>Forms</h2>"; foreach (FormObject formObject in optionObject.Forms) { html += "<h3>Form<h3>"; html += GetHtmlForObject(formObject, HtmlOutputType.Table); html += "<h4>CurrentRow</h4>"; html += GetHtmlForObject(formObject.CurrentRow, HtmlOutputType.Table); html += "<h5>Fields</h5>"; html += "<table>"; html += GetHtmlForObject(formObject.CurrentRow.Fields.FirstOrDefault(), HtmlOutputType.TableHeaders); foreach (FieldObject fieldObject in formObject.CurrentRow.Fields) { html += GetHtmlForObject(fieldObject, HtmlOutputType.TableRow); } html += "</table>"; html += "<h4>OtherRows</h4>"; foreach (RowObject rowObject in formObject.OtherRows) { html += "<h5>Row</h5>"; html += GetHtmlForObject(rowObject, HtmlOutputType.Table); html += "<h6>Fields</h6>"; html += "<table>"; html += GetHtmlForObject(formObject.CurrentRow.Fields.First(), HtmlOutputType.TableHeaders); foreach (FieldObject fieldObject in formObject.CurrentRow.Fields) { html += GetHtmlForObject(fieldObject, HtmlOutputType.TableRow); } html += "</table>"; } } html += includeHtmlHeaders ? GetHtmlFooter() : ""; return(html); }
/// <summary> /// Adds a <see cref="IFormObject"/> to an <see cref="IOptionObject2015"/>. /// </summary> /// <param name="optionObject"></param> /// <param name="formObject"></param> /// <returns></returns> public static IOptionObject2015 AddFormObject(IOptionObject2015 optionObject, IFormObject formObject) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (formObject == null) { throw new ArgumentNullException("Parameter cannot be null", "formObject"); } if (optionObject.Forms.Count == 0 && formObject.MultipleIteration) { throw new ArgumentException("The first FormObject cannot be a Multiple Iteration form."); } if (optionObject.Forms.Contains((FormObject)formObject) || optionObject.Forms.Exists(f => f.FormId == formObject.FormId)) { throw new ArgumentException("A FormObject with this FormId already exists."); } optionObject.Forms.Add((FormObject)formObject); return(optionObject); }
/// <summary> /// Returns whether the <see cref="IRowObject"/> in an <see cref="IOptionObject2015"/> is marked for deletion by RowId. /// </summary> /// <param name="optionObject"></param> /// <param name="rowId"></param> /// <returns></returns> public static bool IsRowMarkedForDeletion(IOptionObject2015 optionObject, string rowId) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (rowId == null || rowId == "") { throw new ArgumentNullException("Parameter cannot be null or blank.", "rowId"); } if (optionObject.Forms == null || optionObject.Forms.Count == 0) { throw new NullReferenceException("The OptionObject does not contain any FormObjects."); } foreach (FormObject formObject in optionObject.Forms) { if (IsRowMarkedForDeletion(formObject, rowId)) { return(true); } } return(false); }
/// <summary> /// Returns whether the <see cref="IFieldObject"/> in the <see cref="IOptionObject2015"/> is required by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static bool IsFieldRequired(IOptionObject2015 optionObject, string fieldNumber) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } if (optionObject.Forms == null) { throw new NullReferenceException("The OptionObject does not contain any Forms."); } if (fieldNumber == null || fieldNumber == "") { throw new ArgumentNullException("Parameter cannot be null or blank.", "fieldNumber"); } foreach (var form in optionObject.Forms) { if (IsFieldPresent(form, fieldNumber)) { return(IsFieldRequired(form, fieldNumber)); } } throw new ArgumentException("The OptionObject does not contain the FieldObject " + fieldNumber + "."); }
/// <summary> /// Returns the ParentRowId of a <see cref="IFormObject"/> in the <see cref="IOptionObject2015"/> by FormId. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <returns></returns> public static string GetParentRowId(IOptionObject2015 optionObject, string formId) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (formId == null || formId == "") { throw new ArgumentNullException("Parameter cannot be null or blank.", "formId"); } if (optionObject.Forms == null) { throw new NullReferenceException("The OptionObject does not contain any Forms."); } foreach (var formObject in optionObject.Forms) { if (formObject.FormId == formId) { return(GetParentRowId(formObject)); } } throw new ArgumentException("The FormObject with FormId " + formId + " does not exist in this OptionObject."); }
/// <summary> /// Sets all <see cref="IFieldObject"/> in the <see cref="IOptionObject2015"/> to disabled, except for the FieldNumbers specified in List. /// </summary> /// <param name="optionObject"></param> /// <param name="excludedFields"></param> /// <returns></returns> public static IOptionObject2015 DisableAllFieldObjects(IOptionObject2015 optionObject, List <string> excludedFields) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (optionObject.Forms.Count == 0) { throw new NullReferenceException("There are no Forms."); } for (int i = 0; i < optionObject.Forms.Count; i++) { if (optionObject.Forms[i].CurrentRow != null) { for (int j = 0; j < optionObject.Forms[i].CurrentRow.Fields.Count; j++) { if (!excludedFields.Contains(optionObject.Forms[i].CurrentRow.Fields[j].FieldNumber)) { optionObject.Forms[i].CurrentRow.Fields[j].SetAsDisabled(); } } optionObject.Forms[i].CurrentRow.RowAction = RowAction.Edit; } for (int k = 0; k < optionObject.Forms[i].OtherRows.Count; k++) { for (int l = 0; l < optionObject.Forms[i].OtherRows[k].Fields.Count; l++) { if (!excludedFields.Contains(optionObject.Forms[i].OtherRows[k].Fields[l].FieldNumber)) { optionObject.Forms[i].OtherRows[k].Fields[l].SetAsDisabled(); } } optionObject.Forms[i].OtherRows[k].RowAction = RowAction.Edit; } } return(optionObject); }
/// <summary> /// Flags a <see cref="RowObject"/> for deletion in specified <see cref="IOptionObject2015"/> by RowId. /// </summary> /// <param name="optionObject"></param> /// <param name="rowId"></param> /// <returns></returns> public static IOptionObject2015 DeleteRowObject(IOptionObject2015 optionObject, string rowId) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null.", "optionObject"); } if (rowId == null || rowId == "") { throw new ArgumentNullException("Parameter cannot be null or blank.", "rowId"); } if (optionObject.Forms == null || optionObject.Forms.Count == 0) { throw new NullReferenceException("There are no FormObjects in this OptionObject."); } for (int i = 0; i < optionObject.Forms.Count; i++) { if (IsRowPresent(optionObject.Forms[i], rowId)) { optionObject.Forms[i] = (FormObject)DeleteRowObject(optionObject.Forms[i], rowId); return(optionObject); } } throw new ArgumentException("No RowObjects were found in this OptionObject matching that RowId."); }
private static IOptionObject2015 SetErrorCodeAndMessage(IOptionObject2015 optionObject, double errorCode = 0, string errorMessage = "") { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } if (!IsValidErrorCode(errorCode)) { throw new ArgumentException("Error Code is not valid."); } if (errorCode == ErrorCode.OpenUrl && !IsValidUrl(errorMessage)) { throw new ArgumentException("Error Message is not a valid URL string."); } if (errorCode == ErrorCode.OpenForm && !IsValidOpenFormString(errorMessage)) { throw new ArgumentException("Error Message is not a valid OpenForm string."); } OptionObject2015 returnOptionObject = (OptionObject2015)optionObject; returnOptionObject.ErrorCode = errorCode; returnOptionObject.ErrorMesg = errorMessage; return(returnOptionObject); }
private static IOptionObject2015 RemoveUneditedRows(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException("Parameter cannot be null", "optionObject"); } List <FormObject> formsToRemove = new List <FormObject>(); foreach (var formObject in optionObject.Forms) { // CurrentRow if (formObject.CurrentRow != null && (formObject.CurrentRow.RowAction == null || formObject.CurrentRow.RowAction == "" || !IsValidRowAction(formObject.CurrentRow.RowAction))) { formObject.CurrentRow = null; } else if (formObject.CurrentRow != null && formObject.CurrentRow.RowAction == RowAction.Edit) { List <FieldObject> fieldsToRemove = new List <FieldObject>(); foreach (FieldObject fieldObject in formObject.CurrentRow.Fields) { if (!fieldObject.IsModified()) { fieldsToRemove.Add(fieldObject); } } foreach (var fieldObject in fieldsToRemove) { formObject.CurrentRow.Fields.Remove(fieldObject); } } // OtherRows List <RowObject> rowsToRemove = new List <RowObject>(); foreach (var rowObject in formObject.OtherRows) { if (rowObject.RowAction == null || rowObject.RowAction == "" || !IsValidRowAction(rowObject.RowAction)) { rowsToRemove.Add(rowObject); } else if (rowObject.RowAction == RowAction.Edit) { List <FieldObject> fieldsToRemove = new List <FieldObject>(); foreach (FieldObject fieldObject in rowObject.Fields) { if (!fieldObject.IsModified()) { fieldsToRemove.Add(fieldObject); } } foreach (var fieldObject in fieldsToRemove) { rowObject.Fields.Remove(fieldObject); } } } foreach (var rowObject in rowsToRemove) { formObject.OtherRows.Remove(rowObject); } if (formObject.CurrentRow == null && formObject.OtherRows.Count == 0) { formsToRemove.Add(formObject); } else if (formObject.OtherRows.Count == 0) { formObject.OtherRows = null; } } foreach (var formObject in formsToRemove) { optionObject.Forms.Remove(formObject); } return(optionObject); }
public OptionObjectDecorator(IOptionObject2015 optionObject) { _optionObject = optionObject; }
/// <summary> /// Transforms an <see cref="IOptionObject2015"/> to a Xml-formatted string. /// </summary> /// <param name="optionObject2015">The <see cref="IOptionObject2015"/> to transform to Xml.</param> /// <returns>A Xml-formatted string based on the provided <see cref="IOptionObject2015"/>.</returns> public static string TransformToXml(IOptionObject2015 optionObject2015) { return(SerializeObjectToXmlString((OptionObject2015)optionObject2015)); }