/// <summary> /// Sets the FieldValue of a <see cref="FieldObject"/> in a <see cref="IOptionObject"/> by FormId, RowID, and FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <param name="rowId"></param> /// <param name="fieldNumber"></param> /// <param name="fieldValue"></param> /// <returns></returns> public static IOptionObject SetFieldValue(IOptionObject optionObject, string formId, string rowId, string fieldNumber, string fieldValue) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(formId)) { throw new ArgumentNullException(nameof(formId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(rowId)) { throw new ArgumentNullException(nameof(rowId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (optionObject.Forms == null) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("optionObjectMissingForms", CultureInfo.CurrentCulture)); } for (int i = 0; i < optionObject.Forms.Count; i++) { if (optionObject.Forms[i].FormId == formId) { optionObject.Forms[i] = (FormObject)SetFieldValue(optionObject.Forms[i], rowId, fieldNumber, fieldValue); } } return(optionObject); }
/// <summary> /// Flags a <see cref="RowObject"/> for deletion in specified <see cref="IFormObject"/> by RowId. /// </summary> /// <param name="formObject"></param> /// <param name="rowId"></param> /// <returns></returns> public static IFormObject DeleteRowObject(IFormObject formObject, string rowId) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(rowId)) { throw new ArgumentNullException(nameof(rowId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow == null) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("formObjectMissingCurrentRow", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow.RowId == rowId) { formObject.CurrentRow.RowAction = RowAction.Delete; return(formObject); } if (formObject.MultipleIteration) { foreach (RowObject rowObject in formObject.OtherRows) { if (rowObject.RowId == rowId) { rowObject.RowAction = RowAction.Delete; return(formObject); } } } throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noRowObjectsFoundByRowId", CultureInfo.CurrentCulture), nameof(rowId)); }
/// <summary> /// Transforms an <see cref="IOptionObject2"/> to <see cref="IOptionObject2015"/>. /// </summary> /// <param name="optionObject2"></param> /// <returns></returns> public static IOptionObject2015 TransformToOptionObject2015(IOptionObject2 optionObject2) { if (optionObject2 == null) { throw new ArgumentNullException(nameof(optionObject2), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (!IsValidErrorCode(optionObject2.ErrorCode)) { throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("errorCodeIsNotValid", CultureInfo.CurrentCulture)); } var optionObject2015 = new OptionObject2015 { EntityID = optionObject2.EntityID, EpisodeNumber = optionObject2.EpisodeNumber, ErrorCode = optionObject2.ErrorCode, ErrorMesg = optionObject2.ErrorMesg, Facility = optionObject2.Facility, NamespaceName = optionObject2.NamespaceName, OptionId = optionObject2.OptionId, OptionStaffId = optionObject2.OptionStaffId, OptionUserId = optionObject2.OptionUserId, ParentNamespace = optionObject2.ParentNamespace, ServerName = optionObject2.ServerName, SystemCode = optionObject2.SystemCode, Forms = optionObject2.Forms.Any() ? optionObject2.Forms : new List <FormObject>() }; return(optionObject2015); }
/// <summary> /// Returns the next available RowId for an <see cref="IFormObject"/>. /// </summary> /// <param name="formObject"></param> /// <returns></returns> public static string GetNextAvailableRowId(IFormObject formObject) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow != null && !formObject.MultipleIteration) { throw new ArgumentOutOfRangeException(ScriptLinkHelpers.GetLocalizedString("cannotAddAnotherRowObject", CultureInfo.CurrentCulture)); } int maximumNumberOfMultipleIterationRows = 9999; // To be confirmed with Netsmart if (formObject.CurrentRow != null && formObject.OtherRows.Count + 1 >= maximumNumberOfMultipleIterationRows) { throw new ArgumentOutOfRangeException(ScriptLinkHelpers.GetLocalizedString("cannotAddAnotherRowObject", CultureInfo.CurrentCulture)); } for (int i = 1; i <= maximumNumberOfMultipleIterationRows; i++) { string tempRowId = formObject.FormId + "||" + i.ToString(CultureInfo.InvariantCulture); if (formObject.CurrentRow == null) { return(tempRowId); } if (formObject.CurrentRow.RowId != tempRowId && !formObject.OtherRows.Exists(r => r.RowId == tempRowId)) { return(tempRowId); } } throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("couldNotDetermineNextRowId", CultureInfo.CurrentCulture)); }
/// <summary> /// Sets the FieldValue of a <see cref="FieldObject"/> in a <see cref="IOptionObject"/> by FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldNumber"></param> /// <param name="fieldValue"></param> /// <returns></returns> public static IOptionObject SetFieldValue(IOptionObject optionObject, string fieldNumber, string fieldValue) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (optionObject.Forms == null) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("optionObjectMissingForms", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } foreach (FormObject formObject in optionObject.Forms) { if (formObject.IsFieldPresent(fieldNumber)) { if (formObject.MultipleIteration && formObject.OtherRows.Count > 0) { throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("unableToIdentifyFieldObject", CultureInfo.CurrentCulture), nameof(optionObject)); } string formId = formObject.FormId; string rowId = formObject.GetCurrentRowId(); return(SetFieldValue(optionObject, formId, rowId, fieldNumber, fieldValue)); } } throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noFieldObjectsFoundByFieldNumber", CultureInfo.CurrentCulture) + fieldNumber, nameof(fieldNumber)); }
/// <summary> /// Returns the FieldValue of a specified <see cref="IFieldObject"/> in an <see cref="IOptionObject2015"/> by FormId, RowId, and FieldNumber. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <param name="rowId"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static string GetFieldValue(IOptionObject optionObject, string formId, string rowId, string fieldNumber) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(formId)) { throw new ArgumentNullException(nameof(formId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(rowId)) { throw new ArgumentNullException(nameof(rowId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } foreach (var form in optionObject.Forms) { if (form.FormId == formId) { return(GetFieldValue(form, rowId, fieldNumber)); } } throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noFieldObjectsFoundByFieldNumber", CultureInfo.CurrentCulture) + fieldNumber, nameof(fieldNumber)); }
public static IOptionObject RemoveUneditedRows(IOptionObject optionObject) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } List <FormObject> formsToRemove = new List <FormObject>(); for (int i = 0; i < optionObject.Forms.Count; i++) { optionObject.Forms[i] = (FormObject)RemoveUneditedRows(optionObject.Forms[i]); if (optionObject.Forms[i].CurrentRow == null && optionObject.Forms[i].OtherRows.Count == 0) { formsToRemove.Add(optionObject.Forms[i]); } else if (optionObject.Forms[i].OtherRows.Count == 0) { optionObject.Forms[i].OtherRows = null; } } foreach (var formObject in formsToRemove) { optionObject.Forms.Remove(formObject); } return(optionObject); }
/// <summary> /// Returns a List of the <see cref="IOptionObject2015"/> properties and values. /// </summary> /// <param name="optionObject"></param> /// <returns></returns> public static List <string> GetOptionObjectHeaders(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } List <string> headers = new List <string> { "Entity ID: " + optionObject.EntityID, "Episode Number: " + optionObject.EpisodeNumber, "Error Code: " + optionObject.ErrorCode, "Error Message: " + optionObject.ErrorMesg, "Facility: " + optionObject.Facility, "Namespace Name: " + optionObject.NamespaceName, "Option ID: " + optionObject.OptionId, "Option Staff ID: " + optionObject.OptionStaffId, "Option User ID: " + optionObject.OptionUserId, "Parent Namepace: " + optionObject.ParentNamespace, "Server Name: " + optionObject.ServerName, "System Code: " + optionObject.SystemCode, "SessionToken:" + optionObject.SessionToken }; return(headers); }
/// <summary> /// Adds a <see cref="RowObject"/> to a specified <see cref="FormObject"/> within provided <see cref="OptionObject"/>. /// </summary> /// <param name="optionObject"></param> /// <param name="formId"></param> /// <param name="rowObject"></param> /// <returns></returns> public static IOptionObject AddRowObject(IOptionObject optionObject, string formId, IRowObject rowObject) { if (optionObject == null) { throw new System.ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(formId)) { throw new System.ArgumentNullException(nameof(formId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (rowObject == null) { throw new System.ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (IsFormPresent(optionObject, formId)) { for (int i = 0; i < optionObject.Forms.Count; i++) { if (optionObject.Forms[i].FormId == formId) { optionObject.Forms[i] = (FormObject)AddRowObject(optionObject.Forms[i], rowObject); break; } } } return(optionObject); }
/// <summary> /// Returns a list of FieldValues of a specified <see cref="IFieldObject"/> in the <see cref="IFormObject"/> by FieldNumber. /// </summary> /// <param name="formObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static List <string> GetFieldValues(IFormObject formObject, string fieldNumber) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow == null) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("formObjectMissingCurrentRow", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotbeNull", CultureInfo.CurrentCulture)); } List <string> values = new List <string>(); if (IsFieldPresent(formObject, fieldNumber)) { values.Add(GetFieldValue(formObject.CurrentRow, fieldNumber)); if (formObject.MultipleIteration) { foreach (var row in formObject.OtherRows) { values.Add(GetFieldValue(row, fieldNumber)); } } return(values); } return(values); }
/// <summary> /// Returns the FieldValue of a <see cref="IFieldObject"/> in a <see cref="IFormObject"/> by RowId and FieldNumber. /// </summary> /// <param name="formObject"></param> /// <param name="rowId"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static string GetFieldValue(IFormObject formObject, string rowId, string fieldNumber) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(rowId)) { throw new ArgumentNullException(nameof(rowId), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow.RowId == rowId) { return(GetFieldValue(formObject.CurrentRow, fieldNumber)); } foreach (RowObject rowObject in formObject.OtherRows) { if (rowObject.RowId == rowId) { return(GetFieldValue(rowObject, fieldNumber)); } } throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noFieldObjectsFoundByFieldNumber", CultureInfo.CurrentCulture) + fieldNumber, nameof(fieldNumber)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IRowObject"/> as disabled by FieldNumbers. /// </summary> /// <param name="rowObject"></param> /// <param name="fieldNumbers"></param> /// <returns></returns> public static IRowObject SetDisabledFields(IRowObject rowObject, List <string> fieldNumbers) { if (rowObject == null) { throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(SetFieldObjects(rowObject, FieldAction.Disable, fieldNumbers)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject"/> as required. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldObjects"></param> /// <returns></returns> public static IOptionObject SetRequiredFields(IOptionObject optionObject, List <FieldObject> fieldObjects) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(SetFieldObjects(optionObject, FieldAction.Require, fieldObjects)); }
/// <summary> /// Adds a <see cref="RowObject"/> to a provided <see cref="IFormObject"/> using provided RowId and ParentRowId. /// </summary> /// <param name="formObject"></param> /// <param name="rowId"></param> /// <param name="parentRowId"></param> /// <returns></returns> public static IFormObject AddRowObject(IFormObject formObject, string rowId, string parentRowId) { if (formObject == null) { throw new System.ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(AddRowObject(formObject, rowId, parentRowId, RowAction.Add)); }
/// <summary> /// Returns the FieldValue of a <see cref="IFieldObject"/> in a <see cref="IFormObject"/> by FieldNumber. /// </summary> /// <param name="formObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static string GetFieldValue(IFormObject formObject, string fieldNumber) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(GetFieldValue(formObject, formObject.CurrentRow.RowId, fieldNumber)); }
/// <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> /// Returns the FieldValue of a <see cref="IFieldObject"/>. /// </summary> /// <param name="fieldObject"></param> /// <returns></returns> public static string GetFieldValue(IFieldObject fieldObject) { if (fieldObject == null) { throw new ArgumentNullException(nameof(fieldObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(fieldObject.FieldValue); }
/// <summary> /// Sets all <see cref="IFieldObject"/> in the <see cref="IOptionObject"/> to disabled. /// </summary> /// <param name="optionObject"></param> /// <returns></returns> public static IOptionObject DisableAllFieldObjects(IOptionObject optionObject) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(DisableAllFieldObjects(optionObject, new List <string>())); }
/// <summary> /// Returns whether the <see cref="IFieldObject"/> is enabled. /// </summary> /// <param name="fieldObject"></param> /// <returns></returns> public static bool IsFieldEnabled(IFieldObject fieldObject) { if (fieldObject == null) { throw new ArgumentNullException(nameof(fieldObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(fieldObject.Enabled == "1"); }
/// <summary> /// Returns whether a <see cref="IFormObject"/> is Multiple Iteration. /// </summary> /// <param name="formObject"></param> /// <returns></returns> public static bool GetMultipleIterationStatus(IFormObject formObject) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(formObject.MultipleIteration); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as required by FieldNumber. /// </summary> /// <param name="formObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static IFormObject SetRequiredField(IFormObject formObject, string fieldNumber) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(SetFieldObject(formObject, FieldAction.Require, fieldNumber)); }
/// <summary> /// Sets the <see cref="IFieldObject"/> in a <see cref="IRowObject"/> as optional by FieldNumber. /// </summary> /// <param name="rowObject"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static IRowObject SetOptionalField(IRowObject rowObject, string fieldNumber) { if (rowObject == null) { throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(SetFieldObject(rowObject, FieldAction.Optional, fieldNumber)); }
/// <summary> /// Used to create the <see cref="IOptionObject2015"/> for return to myAvatar. /// </summary> /// <returns></returns> public static IOptionObject2015 GetReturnOptionObject(IOptionObject2015 optionObject) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(GetReturnOptionObject(optionObject, 0, "")); }
/// <summary> /// Sets <see cref="FieldObject"/> in an <see cref="IOptionObject"/> according to specified FieldAction. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldAction"></param> /// <param name="fieldObjects"></param> /// <returns></returns> public static IOptionObject SetFieldObjects(IOptionObject optionObject, string fieldAction, List <FieldObject> fieldObjects) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } List <string> fieldNumbers = GetFieldNumbersToSet(fieldObjects); return(SetFieldObjects(optionObject, fieldAction, fieldNumbers)); }
/// <summary> /// Sets <see cref="FieldObject"/> in an <see cref="IOptionObject"/> according to specified FieldAction. /// </summary> /// <param name="optionObject"></param> /// <param name="fieldAction"></param> /// <param name="fieldNumbers"></param> /// <returns></returns> public static IOptionObject SetFieldObjects(IOptionObject optionObject, string fieldAction, List <string> fieldNumbers) { if (optionObject == null) { throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (optionObject.Forms == null || optionObject.Forms.Count == 0) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("optionObjectMissingForms", CultureInfo.CurrentCulture)); } if (string.IsNullOrEmpty(fieldAction)) { throw new ArgumentNullException(nameof(fieldAction), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (fieldNumbers == null || fieldNumbers.Count == 0) { throw new ArgumentNullException(nameof(fieldNumbers), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } List <string> fieldsToSet = new List <string>(); foreach (string fieldNumber in fieldNumbers) { if (IsFieldPresent(optionObject, fieldNumber)) { fieldsToSet.Add(fieldNumber); } } if (fieldsToSet.Count == 0) { throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noFieldObjectsFound", CultureInfo.CurrentCulture)); } int formErrors = 0; for (int i = 0; i < optionObject.Forms.Count; i++) { try { optionObject.Forms[i] = (FormObject)SetFieldObjects(optionObject.Forms[i], fieldAction, fieldsToSet); } catch { // The FieldObjects to set may not be present on each FormObject formErrors++; } } if (formErrors == optionObject.Forms.Count) { throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noFieldObjectsWereSet", CultureInfo.CurrentCulture)); } return(optionObject); }
/// <summary> /// Adds a <see cref="IFieldObject"/> to a <see cref="IRowObject"/> using supplied FieldNumber and FieldValue. /// </summary> /// <param name="rowObject"></param> /// <param name="fieldNumber"></param> /// <param name="fieldValue"></param> /// <returns></returns> public static IRowObject AddFieldObject(IRowObject rowObject, string fieldNumber, string fieldValue) { if (rowObject == null) { throw new System.ArgumentNullException(nameof(rowObject)); } if (string.IsNullOrEmpty(fieldNumber)) { throw new System.ArgumentNullException(nameof(fieldNumber), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(AddFieldObject(rowObject, fieldNumber, fieldValue, false, false, false)); }
/// <summary> /// Gets the CurrentRow.RowId of the <see cref="IFormObject"/>. /// </summary> /// <param name="formObject"></param> /// <returns></returns> public static string GetCurrentRowId(IFormObject formObject) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (formObject.CurrentRow == null) { throw new NullReferenceException(ScriptLinkHelpers.GetLocalizedString("formObjectMissingCurrentRow", CultureInfo.CurrentCulture)); } return(formObject.CurrentRow.RowId); }
/// <summary> /// Flags a <see cref="IRowObject"/> for deletion in specified <see cref="IFormObject"/>. /// </summary> /// <param name="formObject"></param> /// <param name="rowObject"></param> /// <returns></returns> public static IFormObject DeleteRowObject(IFormObject formObject, IRowObject rowObject) { if (formObject == null) { throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } if (rowObject == null) { throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } return(DeleteRowObject(formObject, rowObject.RowId)); }
/// <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> /// Sets <see cref="FieldObject"/> in an <see cref="IRowObject"/> according to specified FieldAction. /// </summary> /// <param name="rowObject"></param> /// <param name="fieldAction"></param> /// <param name="fieldNumber"></param> /// <returns></returns> public static IRowObject SetFieldObject(IRowObject rowObject, string fieldAction, string fieldNumber) { if (rowObject == null) { throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture)); } List <string> fieldNumbers = new List <string> { fieldNumber }; return(SetFieldObjects(rowObject, fieldAction, fieldNumbers)); }