예제 #1
0
        /// <summary>
        /// Find the effective (inherited) value of a column in a debt class.
        /// </summary>
        /// <typeparam name="T">The type of the column.</typeparam>
        /// <param name="debtClassId">The DebtClassId of the debt class in question.</param>
        /// <param name="field">The column to retrieve.</param>
        /// <returns>Effective value of the indicated column, eg. the value in the debt class with the indicated ID, or, if that debt class has no
        /// value for the column, the value of the column in nearest ancestor debt class that has a value for that column. If no value can be found,
        /// returns null.</returns>
        private static object FindEffectiveField <T>(Guid debtClassId, DataColumn field)
        {
            object value = null;

            lock (DataModel.SyncRoot)
            {
                DebtClassRow parent = DebtClass.FindParentWithField(debtClassId, field);

                if (parent != null)
                {
                    value = (object)parent.Field <T>(field);
                }
            }

            return(value);
        }