Exemple #1
0
        /// <summary>
        ///     Removes the automatic value (i.e ArcFM Auto Updater) to the subtype source for the specified event.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <returns>
        ///     Returns a <see cref="bool" /> representing <c>true</c> if the value was removed; otherwise <C>false</C>
        /// </returns>
        /// <exception cref="ArgumentNullException">guid</exception>
        public static bool RemoveAutoValue(this IMMSubtype source, mmEditEvent editEvent, Guid guid)
        {
            if (source == null)
            {
                return(false);
            }
            if (guid == Guid.Empty)
            {
                throw new ArgumentNullException("guid");
            }

            var list = source as ID8List;

            if (list == null)
            {
                return(false);
            }

            IMMAutoValue item = source.GetAutoValue(editEvent, guid);

            if (item != null)
            {
                list.Remove((ID8ListItem)item);
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        ///     Adds the automatic value (i.e ArcFM Auto Updater) to the subtype source for the specified event.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="editEvent">The edit event.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <returns>
        ///     Returns a <see cref="IMMAutoValue" /> representing the value that was added; otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">guid</exception>
        public static IMMAutoValue AddAutoValue(this IMMSubtype source, mmEditEvent editEvent, Guid guid)
        {
            if (source == null)
            {
                return(null);
            }
            if (guid == Guid.Empty)
            {
                throw new ArgumentNullException("guid");
            }

            var list = source as ID8List;

            if (list == null)
            {
                return(null);
            }

            var item = source.GetAutoValue(editEvent, guid);

            if (item != null)
            {
                return(item);
            }

            UID uid = new UIDClass();

            uid.Value = guid.ToString("B");

            item = new MMAutoValueClass
            {
                AutoGenID = uid,
                EditEvent = editEvent
            };

            list.Add((ID8ListItem)item);

            return(item);
        }