/// <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("Parameter cannot be null", "formObject");
            }
            if (formObject.CurrentRow == null)
            {
                throw new NullReferenceException("The FormObject does not have a CurrentRow.");
            }
            List <string> values = new List <string>();

            if (formObject.MultipleIteration == false && IsFieldPresent(formObject, fieldNumber))
            {
                values.Add(GetFieldValue(formObject.CurrentRow, fieldNumber));
                return(values);
            }
            else if (formObject.MultipleIteration == true && IsFieldPresent(formObject, fieldNumber))
            {
                values.Add(GetFieldValue(formObject.CurrentRow, fieldNumber));
                foreach (var row in formObject.OtherRows)
                {
                    values.Add(GetFieldValue(row, fieldNumber));
                }
                return(values);
            }
            return(values);
        }
        /// <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>
        /// Sets the value of a <see cref="FieldObject"/> in the <see cref="CurrentRow"/> of a <see cref="FormObject"/>.
        /// </summary>
        /// <param name="fieldNumber"></param>
        /// <param name="fieldValue"></param>
        public void SetFieldValue(string fieldNumber, string fieldValue)
        {
            IFormObject tempFormObject = OptionObjectHelpers.SetFieldValue(this, fieldNumber, fieldValue);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
        /// <summary>
        /// Sets the specified fields as enabled and required.
        /// </summary>
        /// <param name="fieldNumbers"></param>
        public void SetRequiredFields(List <string> fieldNumbers)
        {
            IFormObject tempFormObject = OptionObjectHelpers.SetRequiredFields(this, fieldNumbers);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
        /// <summary>
        /// Marks a <see cref="RowObject"/> for deletion.
        /// </summary>
        /// <param name="rowId"></param>
        public void DeleteRowObject(RowObject rowObject)
        {
            IFormObject tempFormObject = OptionObjectHelpers.DeleteRowObject(this, rowObject);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
        /// <summary>
        /// Adds a <see cref="RowObject"/> to the <see cref="CurrentRow"/> of a <see cref="FormObject"/>.
        /// </summary>
        /// <param name="rowId"></param>
        /// <param name="parentRowId"></param>
        public void AddRowObject(string rowId, string parentRowId)
        {
            IFormObject tempFormObject = OptionObjectHelpers.AddRowObject(this, rowId, parentRowId);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
示例#7
0
 /// <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>
        /// Sets the specified field as unlocked.
        /// </summary>
        /// <param name="fieldNumber"></param>
        public void SetUnlockedField(string fieldNumber)
        {
            IFormObject tempFormObject = OptionObjectHelpers.SetUnlockedField(this, fieldNumber);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
示例#9
0
 /// <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 specified field as enabled and required.
        /// </summary>
        /// <param name="fieldNumber"></param>
        public void SetRequiredField(string fieldNumber)
        {
            IFormObject tempFormObject = ScriptLinkHelpers.SetRequiredField(this, fieldNumber);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
示例#11
0
        /// <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("Parameter cannot be null.", "formObject");
            }
            if (formObject.CurrentRow != null && !formObject.MultipleIteration)
            {
                throw new ArgumentOutOfRangeException("FormObject has maximum number of rows because it not a multiple iteration form.");
            }
            int maximumNumberOfMultipleIterationRows = 9999;

            if (formObject.CurrentRow != null && formObject.OtherRows.Count + 1 >= maximumNumberOfMultipleIterationRows)
            {
                throw new ArgumentOutOfRangeException("FormObject has maximum number of rows (" + (formObject.OtherRows.Count + 1) + ").");
            }
            for (int i = 1; i <= maximumNumberOfMultipleIterationRows; i++)
            {
                string tempRowId = formObject.FormId + "||" + i.ToString();
                if (formObject.CurrentRow == null)
                {
                    return(tempRowId);
                }
                if (formObject.CurrentRow.RowId != tempRowId &&
                    !formObject.OtherRows.Exists(r => r.RowId == tempRowId))
                {
                    return(tempRowId);
                }
            }
            throw new ArgumentException("Could not determine next available RowId in this FormObject.");    // This should never be thrown.
        }
        /// <summary>
        /// Marks a <see cref="RowObject"/> for deletion.
        /// </summary>
        /// <param name="rowId"></param>
        public void DeleteRowObject(string rowId)
        {
            IFormObject tempFormObject = ScriptLinkHelpers.DeleteRowObject(this, rowId);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
        /// <summary>
        /// Sets the value of a <see cref="FieldObject"/> in a <see cref="FormObject"/>.
        /// </summary>
        /// <param name="rowId"></param>
        /// <param name="fieldNumber"></param>
        /// <param name="fieldValue"></param>
        /// <returns></returns>
        public void SetFieldValue(string rowId, string fieldNumber, string fieldValue)
        {
            IFormObject tempFormObject = ScriptLinkHelpers.SetFieldValue(this, rowId, fieldNumber, fieldValue);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
 /// <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("Parameter cannot be null.", "optionObject");
     }
     if (rowId == null || rowId == "")
     {
         throw new ArgumentNullException("Parameter cannot be null or blank.", "rowId");
     }
     if (formObject.CurrentRow == null)
     {
         throw new NullReferenceException("The FormObject is missing a CurrentRow.");
     }
     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("No RowObjects were found in this FormObject matching that RowId.");
 }
        /// <summary>
        /// Adds a <see cref="RowObject"/> to a <see cref="FormObject"/>.
        /// </summary>
        /// <param name="rowId"></param>
        /// <param name="parentRowId"></param>
        /// <param name="rowAction"></param>
        public void AddRowObject(string rowId, string parentRowId, string rowAction)
        {
            IFormObject tempFormObject = ScriptLinkHelpers.AddRowObject(this, rowId, parentRowId, rowAction);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
示例#16
0
        /// <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 specified fields as unlocked.
        /// </summary>
        /// <param name="fieldNumbers"></param>
        public void SetUnlockedFields(List <string> fieldNumbers)
        {
            IFormObject tempFormObject = ScriptLinkHelpers.SetUnlockedFields(this, fieldNumbers);

            this.CurrentRow = tempFormObject.CurrentRow;
            this.OtherRows  = tempFormObject.OtherRows;
        }
 /// <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("Parameter cannot be null", "formObject");
     }
     return(formObject.MultipleIteration);
 }
示例#19
0
 /// <summary>
 /// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as disabled by FieldNumbers.
 /// </summary>
 /// <param name="formObject"></param>
 /// <param name="fieldNumbers"></param>
 /// <returns></returns>
 public static IFormObject SetDisabledFields(IFormObject formObject, List <string> fieldNumbers)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
     }
     return(SetFieldObjects(formObject, FieldAction.Disable, fieldNumbers));
 }
示例#20
0
 /// <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>
 /// 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("Parameter cannot be null.", "formObject");
     }
     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("Parameter cannot be null", "formObject");
     }
     return(GetFieldValue(formObject, formObject.CurrentRow.RowId, fieldNumber));
 }
示例#23
0
 /// <summary>
 /// Returns <see cref="IFormObject"/> as an HTML string without HTML headers.
 /// </summary>
 /// <param name="formObject"></param>
 /// <returns></returns>
 public static string TransformToHtmlString(IFormObject formObject)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
     }
     return(TransformToHtmlString(formObject, false));
 }
示例#24
0
 /// <summary>
 /// Returns <see cref="IFormObject"/> as an HTML string without HTML headers.
 /// </summary>
 /// <param name="formObject"></param>
 /// <returns></returns>
 public static string TransformToHtmlString(IFormObject formObject)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException("Parameter cannot be null.", "formObject");
     }
     return(TransformToHtmlString(formObject, false));
 }
 /// <summary>
 /// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as enabled by FieldNumber.
 /// </summary>
 /// <param name="formObject"></param>
 /// <param name="fieldNumber"></param>
 /// <returns></returns>
 public static IFormObject SetEnabledField(IFormObject formObject, string fieldNumber)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException("Parameter cannot be null.", "formObject");
     }
     return(SetFieldObject(formObject, FieldAction.Enable, fieldNumber));
 }
示例#26
0
 /// <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 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);
 }
示例#28
0
 /// <summary>
 /// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as optional by FieldNumbers.
 /// </summary>
 /// <param name="formObject"></param>
 /// <param name="fieldNumbers"></param>
 /// <returns></returns>
 public static IFormObject SetOptionalFields(IFormObject formObject, List <string> fieldNumbers)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException("Parameter cannot be null.", "formObject");
     }
     return(SetFieldObjects(formObject, FieldAction.Optional, fieldNumbers));
 }
 /// <summary>
 /// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as optional by FieldNumber.
 /// </summary>
 /// <param name="formObject"></param>
 /// <param name="fieldNumber"></param>
 /// <returns></returns>
 public static IFormObject SetOptionalField(IFormObject formObject, string fieldNumber)
 {
     if (formObject == null)
     {
         throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
     }
     return(SetFieldObject(formObject, FieldAction.Optional, fieldNumber));
 }
示例#30
0
        public static IFormObject Clone(IFormObject formObject)
        {
            if (formObject == null)
            {
                throw new ArgumentNullException("The parameter cannot be null.", "formObject");
            }

            return(TransformToFormObject(formObject.ToJson()));
        }