Exemplo n.º 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="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="ArgumentNullException">
        ///     fieldNames
        ///     or
        ///     table
        /// </exception>
        public static Dictionary <int, Dictionary <string, IEnumerable <IMMAutoValue> > > GetAutoValues(this IMMConfigTopLevel source, IObjectClass table, 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 <int, Dictionary <string, IEnumerable <IMMAutoValue> > > list = new Dictionary <int, Dictionary <string, IEnumerable <IMMAutoValue> > >();

            var values = source.GetAutoValues(table, ALL_SUBTYPES, editEvent, fieldNames);

            list.Add(ALL_SUBTYPES, values);

            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)
                {
                    values = source.GetAutoValues(table, subtypeCode, editEvent, fieldNames);
                    list.Add(subtypeCode, values);
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Pre validates the given set of values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void UpdateParameters(Dictionary <string, IGPParameter> parameters, IGPEnvironmentManager environmentManager, IGPUtilities2 utilities)
        {
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);

            if (!value.IsEmpty())
            {
                IObjectClass table = utilities.OpenTable(value);
                if (table != null)
                {
                    IGPParameterEdit3 parameter = (IGPParameterEdit3)parameters["in_field"];
                    parameter.Domain = base.GetFields(table);
                    string fieldName = utilities.UnpackGPValue(parameter).GetAsText();

                    parameter        = (IGPParameterEdit3)parameters["in_subtype"];
                    parameter.Domain = base.GetSubtypes(table);

                    IGPValue subtype = utilities.UnpackGPValue(parameter);
                    if (!subtype.IsEmpty())
                    {
                        if (!string.IsNullOrEmpty(fieldName))
                        {
                            var subtypeCode = subtype.Cast(-1);
                            IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                            configTopLevel.Workspace = utilities.GetWorkspace(value);

                            var values = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureCreate, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_create"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);

                            values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureUpdate, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_update"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);

                            values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureDelete, fieldName);
                            parameter        = (IGPParameterEdit3)parameters["in_delete"];
                            parameter.Domain = base.CreateDomain <IMMAttrAUStrategy>(values[subtypeCode][fieldName]);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Pre validates the given set of values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void UpdateParameters(Dictionary <string, IGPParameter> parameters, IGPEnvironmentManager environmentManager, IGPUtilities2 utilities)
        {
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);

            if (!value.IsEmpty())
            {
                IRelationshipClass relClass = utilities.OpenRelationshipClass(value);
                if (relClass != null)
                {
                    IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                    configTopLevel.Workspace = utilities.GetWorkspace(value);

                    var values = configTopLevel.GetAutoValues(relClass, mmEditEvent.mmEventRelationshipCreated);
                    IGPParameterEdit3 parameter = (IGPParameterEdit3)parameters["in_create"];
                    parameter.Domain = base.CreateDomain <IMMRelationshipAUStrategy>(values);

                    values           = configTopLevel.GetAutoValues(relClass, mmEditEvent.mmEventRelationshipDeleted);
                    parameter        = (IGPParameterEdit3)parameters["in_delete"];
                    parameter.Domain = base.CreateDomain <IMMRelationshipAUStrategy>(values);
                }
            }
        }
Exemplo n.º 4
0
        public void IMMConfigTopLevel_GetAutoValues_NotNull()
        {
            IFeatureClass testClass = base.GetTestClass();

            Assert.IsNotNull(testClass);

            IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;

            Assert.IsNotNull(configTopLevel);

            var list = configTopLevel.GetAutoValues(testClass, mmEditEvent.mmEventFeatureCreate);

            Assert.IsTrue(list.Count > 0);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Pre validates the given set of values.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="environmentManager">Provides access to all the current environments and settings of the current client.</param>
        /// <param name="utilities">
        ///     The utilities object that provides access to the properties and methods of a geoprocessing
        ///     objects.
        /// </param>
        protected override void UpdateParameters(Dictionary <string, IGPParameter> parameters, IGPEnvironmentManager environmentManager, IGPUtilities2 utilities)
        {
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);

            if (!value.IsEmpty())
            {
                IObjectClass table = utilities.OpenTable(value);
                if (table != null)
                {
                    // Populate the subtype parameter with the subtypes from the table and ensure the it's editable.
                    IGPParameterEdit3 subtypeParameter = (IGPParameterEdit3)parameters["in_subtype"];
                    subtypeParameter.Domain = this.GetSubtypes(table);

                    // Populate the auto updater values for the object class for the specific subtype.
                    IGPValue subtype = utilities.UnpackGPValue(subtypeParameter);
                    if (!subtype.IsEmpty())
                    {
                        var subtypeCode = subtype.Cast(-1);
                        IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance;
                        configTopLevel.Workspace = utilities.GetWorkspace(value);

                        var values = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureCreate);
                        IGPParameterEdit3 parameter = (IGPParameterEdit3)parameters["in_create"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureUpdate);
                        parameter        = (IGPParameterEdit3)parameters["in_update"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureDelete);
                        parameter        = (IGPParameterEdit3)parameters["in_delete"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventBeforeFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_before"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_split"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);

                        values           = configTopLevel.GetAutoValues(table, mmEditEvent.mmEventAfterFeatureSplit);
                        parameter        = (IGPParameterEdit3)parameters["in_after"];
                        parameter.Domain = base.CreateDomain <IMMSpecialAUStrategyEx>(values[subtypeCode]);
                    }
                }
            }
        }