public static void ResetFilterSubsetParameters(INetworkAttribute2 netAttribute, List <string> netSourceNames)
        {
            IArray netParams = new ESRI.ArcGIS.esriSystem.ArrayClass();
            INetworkAttributeParameter netParam = null;
            object paramValue = null;

            netParam   = new NetworkAttributeParameterClass();
            paramValue = true;

            string paramName = "";

            paramName  = BaseParameterName;
            paramName += "_Restrict";

            netParam.Name         = paramName;
            netParam.VarType      = (int)VarType.Bool;
            netParam.Value        = paramValue;
            netParam.DefaultValue = paramValue;
            netParams.Add(netParam);

            netParam   = new NetworkAttributeParameterClass();
            paramValue = 1;

            foreach (string netSourceName in netSourceNames)
            {
                netParam   = new NetworkAttributeParameterClass();
                paramValue = null;

                paramName             = BaseParameterName;
                paramName            += "_EIDs_";
                paramName            += netSourceName;
                netParam.Name         = paramName;
                netParam.VarType      = (int)(VarType.Array | VarType.Integer);
                netParam.Value        = paramValue;
                netParam.DefaultValue = paramValue;
                netParams.Add(netParam);
            }

            //does not preserve existing parameters if any
            netAttribute.Parameters = netParams;
        }
        private void CheckAttributeParameter()
        {
            IArray parameters = m_networkAttribute.Parameters;

            for (int parameter_index = 0; parameter_index < parameters.Count; ++parameter_index)
            {
                INetworkAttributeParameter parameter = (INetworkAttributeParameter)parameters.get_Element(parameter_index);

                /*
                 * From http://www.w3schools.com/vbscript/func_vartype.asp
                 *  0 = vbEmpty - Indicates Empty (uninitialized)
                 *  1 = vbNull - Indicates Null (no valid data)
                 *  2 = vbInteger - Indicates an integer
                 *  3 = vbLong - Indicates a long integer
                 *  4 = vbSingle - Indicates a single-precision floating-point number
                 *  5 = vbDouble - Indicates a double-precision floating-point number
                 *  6 = vbCurrency - Indicates a currency
                 *  7 = vbDate - Indicates a date
                 *  8 = vbString - Indicates a string
                 *  9 = vbObject - Indicates an automation object
                 *  10 = vbError - Indicates an error
                 *  11 = vbBoolean - Indicates a boolean
                 *  12 = vbVariant - Indicates a variant (used only with arrays of Variants)
                 *  13 = vbDataObject - Indicates a data-access object
                 *  17 = vbByte - Indicates a byte
                 *  8192 = vbArray - Indicates an array
                 *  8200 = string array parameter (Melinda added this)
                 */

                if (parameter.Name == "Use Specific Dates")
                {
                    if (parameter.VarType == 11)
                    {
                        m_UseSpecificDates = (bool)parameter.Value;
                        if (m_VerboseLogging)
                        {
                            WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_UseSpecificDates set to: " + m_UseSpecificDates);
                        }
                    }
                }

                if (parameter.Name == "Cache on every solve")
                {
                    if (parameter.VarType == 11)
                    {
                        m_CacheOnEverySolve = (bool)parameter.Value;
                        if (m_VerboseLogging)
                        {
                            WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_CacheOnEverySolve set to: " + m_CacheOnEverySolve);
                        }
                    }
                }

                if (parameter.Name == "Riding a bicycle")
                {
                    if (parameter.VarType == 11)
                    {
                        m_RidingABicycle = (bool)parameter.Value;
                        if (m_VerboseLogging)
                        {
                            WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_RidingABicycle set to: " + m_RidingABicycle);
                        }
                    }
                }

                if (parameter.Name == "Traveling with a wheelchair")
                {
                    if (parameter.VarType == 11)
                    {
                        m_UsingAWheelchair = (bool)parameter.Value;
                        if (m_VerboseLogging)
                        {
                            WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_UsingAWheelchair set to: " + m_UsingAWheelchair);
                        }
                    }
                }

                if (parameter.Name == "Exclude trip_ids")
                {
                    if (parameter.VarType == 8)
                    {
                        // First reset the trips to exclude to empty so there are none lingering from the previous solve.
                        // We have to reset this, or the evaluator won't recognize a blank value if the user erases a trip they were previously excluding.
                        m_ExcludeTrips = null;
                        // Then check if the user wants to exclude any trips.
                        if (parameter.Value != System.DBNull.Value)
                        {
                            string   tripsToExcludeString = (string)parameter.Value;
                            string[] tripsToExclude;
                            string[] separator = new string[] { ", " };
                            tripsToExclude = tripsToExcludeString.Split(separator, StringSplitOptions.RemoveEmptyEntries).Select(trip => trip.Trim()).ToArray();
                            m_ExcludeTrips = tripsToExclude.ToDictionary(v => v, v => true); // Add it to a dictionary for quick lookups later.
                            if (m_VerboseLogging)
                            {
                                WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_ExcludeTrips set to: " + tripsToExcludeString);
                            }
                        }
                    }
                }

                if (parameter.Name == "Exclude route_ids")
                {
                    if (parameter.VarType == 8)
                    {
                        // First reset the routes to exclude to empty so there are none lingering from the previous solve.
                        // We have to reset this, or the evaluator won't recognize a blank value if the user erases a route they were previously excluding.
                        m_ExcludeRoutes = null;
                        // Then check if the user wants to exclude any routes.
                        if (parameter.Value != System.DBNull.Value)
                        {
                            string   routesToExcludeString = (string)parameter.Value;
                            string[] routesToExclude;
                            string[] separator = new string[] { ", " };
                            routesToExclude = routesToExcludeString.Split(separator, StringSplitOptions.RemoveEmptyEntries).Select(route => route.Trim()).ToArray();
                            m_ExcludeRoutes = routesToExclude.ToDictionary(v => v, v => true); // Add it to a dictionary for quick lookups later.
                            if (m_VerboseLogging)
                            {
                                WriteToOutputFile(m_LogFile, "CheckAttributeParameter. m_ExcludeTrips set to: " + routesToExcludeString);
                            }
                        }
                    }
                }
            }
        }
        public static void UpdateEIDArrayParameterValuesFromEIDLists(INetworkAnalystExtension nax, Dictionary <string, List <int> > eidsBySourceName, string baseName)
        {
            if (nax == null)
            {
                return;
            }

            bool             naxEnabled = false;
            IExtensionConfig naxConfig  = nax as IExtensionConfig;

            naxEnabled = naxConfig.State == esriExtensionState.esriESEnabled;

            if (!naxEnabled)
            {
                return;
            }

            INAWindow       naWindow  = nax.NAWindow;
            INALayer        naLayer   = null;
            INAContext      naContext = null;
            INetworkDataset nds       = null;

            naLayer = naWindow.ActiveAnalysis;
            if (naLayer != null)
            {
                naContext = naLayer.Context;
            }

            if (naContext != null)
            {
                nds = naContext.NetworkDataset;
            }

            if (nds == null)
            {
                return;
            }

            IDatasetComponent dsComponent = nds as IDatasetComponent;
            IDENetworkDataset deNet       = dsComponent.DataElement as IDENetworkDataset;

            INASolver          naSolver          = naContext.Solver;
            INASolverSettings2 naSolverSettings2 = naSolver as INASolverSettings2;

            if (naSolverSettings2 == null)
            {
                return;
            }

            string  prefix = GetEIDArrayPrefixFromBaseName(baseName);
            VarType vt     = GetEIDArrayParameterType();

            int cAttributes = nds.AttributeCount;

            for (int a = 0; a < cAttributes; ++a)
            {
                INetworkAttribute2 netAttribute = nds.get_Attribute(a) as INetworkAttribute2;
                IArray             netParams    = netAttribute.Parameters;
                int    cParams = netParams.Count;
                object paramValue;
                for (int p = 0; p < cParams; ++p)
                {
                    INetworkAttributeParameter param = netParams.get_Element(p) as INetworkAttributeParameter;
                    if (param.VarType != (int)vt)
                    {
                        continue;
                    }

                    string paramName  = param.Name;
                    string sourceName = GetSourceNameFromParameterName(prefix, paramName);
                    if (sourceName.Length == 0)
                    {
                        continue;
                    }

                    List <int> eids = null;
                    if (eidsBySourceName.TryGetValue(sourceName, out eids))
                    {
                        if (eids != null)
                        {
                            if (eids.Count == 0)
                            {
                                eids = null;
                            }
                        }
                    }

                    paramValue = (eids != null) ? eids.ToArray() : null;
                    naSolverSettings2.set_AttributeParameterValue(netAttribute.Name, param.Name, paramValue);
                }
            }
        }