Пример #1
0
        /// <summary>
        /// Gets all of the field ArcFM Auto Updaters that have been configured for the specified
        /// <paramref name="editEvent" /> on the <paramref name="table" /> object class for specified fields.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="table">The object class.</param>
        /// <param name="subtypeCode">The subtype code.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <param name="fieldNames">The field names.</param>
        /// <returns>
        /// Returns a <see cref="Dictionary{Key, Value}" /> representing the automatic values for the subtypes and the
        /// individual fields.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        /// fieldNames
        /// or
        /// table
        /// </exception>
        /// <exception cref="ArgumentNullException">fieldNames
        /// or
        /// table</exception>
        public static Dictionary <string, IEnumerable <IMMAutoValue> > GetAutoValues(this IMMConfigTopLevel source, IObjectClass table, int subtypeCode, mmEditEvent editEvent, params string[] fieldNames)
        {
            if (source == null)
            {
                return(null);
            }
            if (fieldNames == null)
            {
                throw new ArgumentNullException("fieldNames");
            }
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            Dictionary <string, IEnumerable <IMMAutoValue> > list = new Dictionary <string, IEnumerable <IMMAutoValue> >();

            IMMSubtype subtype = source.GetSubtypeByID(table, subtypeCode, false);

            if (subtype != null)
            {
                foreach (var fieldName in fieldNames)
                {
                    int index  = table.FindField(fieldName);
                    var values = subtype.GetAutoValues(index, editEvent);
                    list.Add(fieldName, values);
                }
            }

            return(list);
        }
Пример #2
0
        /// <summary>
        ///     Gets all of the automatic values (i.e. ArcFM Auto Updaters) that have been configured for the specified
        ///     <paramref name="editEvent" /> for all subtypes
        ///     of the <paramref name="table" /> object class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="table">The table.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <returns>
        ///     Returns a <see cref="Dictionary{Key, Value}" /> representing the automatic values for the specified event and
        ///     object class.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">table</exception>
        public static Dictionary <IMMSubtype, IEnumerable <IMMAutoValue> > GetAutoValues(this IMMConfigTopLevel source, IObjectClass table, mmEditEvent editEvent)
        {
            if (source == null)
            {
                return(null);
            }
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            Dictionary <IMMSubtype, IEnumerable <IMMAutoValue> > list = new Dictionary <IMMSubtype, IEnumerable <IMMAutoValue> >();

            IMMSubtype subtype = source.GetSubtypeByID(table, ALL_SUBTYPES, false);

            if (subtype != null)
            {
                list.Add(subtype, subtype.GetAutoValues(editEvent));
            }

            ISubtypes subtypes = (ISubtypes)table;

            if (subtypes.HasSubtype)
            {
                IEnumerable <int> subtypeCodes = subtypes.Subtypes.AsEnumerable().Select(o => o.Key).OrderBy(o => o);
                foreach (var subtypeCode in subtypeCodes)
                {
                    subtype = source.GetSubtypeByID(table, subtypeCode, false);
                    if (subtype == null)
                    {
                        continue;
                    }

                    list.Add(subtype, subtype.GetAutoValues(editEvent));
                }
            }

            return(list);
        }