/// <summary>
        ///     Add the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
        /// </summary>
        /// <param name="uids">The dictionary of events and UIDs.</param>
        /// <param name="list">The list of events and UIDs.</param>
        /// <param name="messages">The messages.</param>
        protected void Add(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
        {
            // Enumerate through the dictionary of events and UIDs.
            foreach (var uid in uids)
            {
                // Locate all of the "AutoValue" types.
                foreach (var item in list.AsEnumerable())
                {
                    if (item.ItemType == mmd8ItemType.mmitAutoValue)
                    {
                        IMMAutoValue autoValue = (IMMAutoValue)item;
                        if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                        {
                            // When the UID is not contained within the list.
                            if (!uid.Value.Contains(autoValue.AutoGenID))
                            {
                                // Enumerate through all of the UIDs in the collection and add them to list.
                                foreach (var id in uid.Value)
                                {
                                    IMMAutoValue newAutoValue = new MMAutoValueClass();
                                    newAutoValue.EditEvent = uid.Key;
                                    newAutoValue.AutoGenID = new UIDClass()
                                    {
                                        Value = id
                                    };

                                    ((ID8List)item).AddEx(newAutoValue);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
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);
        }
Example #3
0
        /// <summary>
        ///     Exports the row.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value">The value.</param>
        /// <param name="subtypeCode">The subtype code.</param>
        /// <param name="subtypeName">Name of the subtype.</param>
        /// <param name="dataset">The dataset.</param>
        /// <param name="featureDataset">The feature dataset.</param>
        /// <returns></returns>
        private object[] ExportRow <T>(IMMAutoValue value, int subtypeCode, string subtypeName, IDataset dataset, IFeatureDataset featureDataset)
        {
            var row = new List <object>();

            var name = this.GetComponentName <T>(value.AutoGenID);

            row.Add(featureDataset != null ? featureDataset.Name : "");
            row.Add(dataset != null ? dataset.Name : "");
            row.Add(subtypeCode);
            row.Add(subtypeName);
            row.Add(((ID8ListItem)value).DisplayName);
            row.Add(name);
            row.Add(value.AutoGenID.Value);

            return(row.ToArray());
        }
 /// <summary>
 ///     Removes the <paramref name="uids" /> from the <paramref name="list" /> that match the event and UID.
 /// </summary>
 /// <param name="uids">The dictionary of events and UIDs.</param>
 /// <param name="list">The list of events and UIDs.</param>
 /// <param name="messages">The messages.</param>
 protected void Remove(Dictionary <mmEditEvent, IEnumerable <IUID> > uids, ID8List list, IGPMessages messages)
 {
     // Enumerate through the dictionary of events and UIDs.
     foreach (var uid in uids)
     {
         // Locate all of the "AutoValue" types.
         foreach (var item in list.AsEnumerable())
         {
             if (item.ItemType == mmd8ItemType.mmitAutoValue)
             {
                 IMMAutoValue autoValue = (IMMAutoValue)item;
                 if (autoValue.AutoGenID != null && autoValue.EditEvent == uid.Key)
                 {
                     // When the UID is contained within the list it should be removed.
                     if (uid.Value.Contains(autoValue.AutoGenID))
                     {
                         list.Remove(item);
                         messages.Add(esriGPMessageType.esriGPMessageTypeInformative, "Removing the {0} from the {1} event.", autoValue.AutoGenID.Value, autoValue.EditEvent);
                     }
                 }
             }
         }
     }
 }