Ejemplo n.º 1
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)
        {
            // Retrieve the input parameter value.
            IGPValue table = utilities.UnpackGPValue(parameters["in_table"]);

            if (!table.IsEmpty())
            {
                // Create the domain based on the fields on the table.
                IObjectClass oclass = utilities.OpenTable(table);
                if (oclass != null)
                {
                    IFields fields = oclass.Fields;
                    if (fields != null)
                    {
                        IGPCodedValueDomain codedValueDomain = new GPCodedValueDomainClass();
                        foreach (var o in fields.AsEnumerable())
                        {
                            codedValueDomain.AddStringCode(o.Name, o.Name);
                        }

                        IGPParameterEdit3 derivedFields = (IGPParameterEdit3)parameters["in_field"];
                        derivedFields.Domain = (IGPDomain)codedValueDomain;
                    }

                    IGPValue field = utilities.UnpackGPValue(parameters["in_field"]);
                    if (!field.IsEmpty())
                    {
                        int index = oclass.FindField(field.GetAsText());

                        IGPCodedValueDomain codedValueDomain = new GPCodedValueDomainClass();
                        foreach (var o in oclass.GetFieldModelNames(oclass.Fields.Field[index]))
                        {
                            codedValueDomain.AddStringCode(o, o);
                        }

                        IGPParameterEdit3 derivedParameter = (IGPParameterEdit3)parameters["in_field_model_names"];
                        derivedParameter.Domain = (IGPDomain)codedValueDomain;
                    }
                }
            }
        }
Ejemplo 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)
        {
            // Retrieve the input parameter value.
            IGPValue value = utilities.UnpackGPValue(parameters["in_table"]);
            if (!value.IsEmpty())
            {
                // Create the domain based on the fields on the table.
                IDETable table = value as IDETable;
                if (table != null)
                {
                    IFields fields = table.Fields;
                    if (fields != null)
                    {
                        IGPCodedValueDomain codedValueDomain = new GPCodedValueDomainClass();
                        foreach (var field in fields.AsEnumerable())
                            codedValueDomain.AddStringCode(field.Name, field.Name);

                        IGPParameterEdit3 derivedFields = (IGPParameterEdit3) parameters["in_fields"];
                        derivedFields.Domain = (IGPDomain) codedValueDomain;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     Builds the query based on the specified fields. When more then one field is available the query will use the
 ///     specified logical operator
 ///     to concatenate the statements.
 /// </summary>
 /// <param name="keyword">The criteria.</param>
 /// <param name="comparisonOperator">The comparison operator.</param>
 /// <param name="logicalOperator">The logical operator.</param>
 /// <param name="fields">The fields.</param>
 /// <returns>
 ///     The SQL where clause for the specified field and workspace.
 /// </returns>
 /// <remarks>
 ///     The subtype values will be extracted for the field automatically.
 /// </remarks>
 public string Build(string keyword, ComparisonOperator comparisonOperator, LogicalOperator logicalOperator, IFields fields)
 {
     return(this.Build(keyword, comparisonOperator, logicalOperator, fields.AsEnumerable().ToArray()));
 }