Exemplo n.º 1
0
        /// <summary>
        /// Fill stops maptips list
        /// </summary>
        private void _CreateStopsTipsConfig(List <object> mapProperties, IList <object> selectedMapProperties, StringCollection selectedConfig)
        {
            Type type = typeof(Stop);

            PropertyInfo[] properties = type.GetProperties();
            foreach (PropertyInfo property in properties)
            {
                if (Attribute.IsDefined(property, typeof(DomainPropertyAttribute)))
                {
                    DomainPropertyAttribute attribute = (DomainPropertyAttribute)Attribute.GetCustomAttribute(property, typeof(DomainPropertyAttribute));
                    System.Diagnostics.Debug.Assert(null != attribute);
                    Type typeProperty = _GetEffectiveType(property.PropertyType);

                    Unit?displayUnits = null;
                    Unit?valueUnits   = null;
                    if (Attribute.IsDefined(property, typeof(UnitPropertyAttribute)))
                    {
                        UnitPropertyAttribute unitAttribute = (UnitPropertyAttribute)Attribute.GetCustomAttribute(
                            property, typeof(UnitPropertyAttribute));

                        displayUnits = (RegionInfo.CurrentRegion.IsMetric) ? unitAttribute.DisplayUnitMetric : unitAttribute.DisplayUnitUS;
                        valueUnits   = unitAttribute.ValueUnits;
                    }

                    if (!property.Name.Equals(Stop.PropertyNameMapLocation) && !property.Name.Equals(Stop.PropertyNameSequenceNumber))
                    {
                        _AddPropertyTip("", property.Name, attribute.Title, mapProperties,
                                        selectedMapProperties, selectedConfig, valueUnits, displayUnits);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get numeric and capacities field names
        /// </summary>
        /// <param name="fieldNames">Field names array</param>
        private static void FillQuantityRequiredFields()
        {
            _quantityFieldTitles.Clear();
            _quantityFieldNames.Clear();
            _quantityFieldProperties.Clear();

            Type type = typeof(Order);

            PropertyInfo[] properties = type.GetProperties();
            foreach (PropertyInfo property in properties)
            {
                if (Attribute.IsDefined(property, typeof(DomainPropertyAttribute)))
                {
                    DomainPropertyAttribute attribute = (DomainPropertyAttribute)Attribute.GetCustomAttribute(property, typeof(DomainPropertyAttribute));
                    System.Diagnostics.Debug.Assert(null != attribute);
                    Type typeProperty = GetEffectiveType(property.PropertyType);

                    if (typeof(OrderCustomProperties) == typeProperty)
                    {
                        _AddCustomOrderProperties(property);
                    }
                    else if (typeof(Capacities) == typeProperty)
                    {
                        _AddCapacitiesInfos(property);
                    }
                    else
                    {
                        _AddProperty(property, typeProperty, attribute);
                    }
                }
            }
        }
Exemplo n.º 3
0
 private static void _AddProperty(PropertyInfo property, Type typeProperty, DomainPropertyAttribute attribute)
 {
     if (typeProperty == typeof(int) || typeProperty == typeof(double))
     {
         _quantityFieldTitles.Add(attribute.Title);
         _quantityFieldNames.Add(property.Name);
         _quantityFieldProperties.Add(property);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fill Orders maptips list
        /// </summary>
        // REV: can be switched to new static methods of Order class that allow to get order properties
        private void _CreateOrdersTipsConfig(string prePath, IList <object> mapProperties, IList <object> selectedMapProperties,
                                             StringCollection selectedConfig)
        {
            Type type = typeof(Order);

            PropertyInfo[] properties = type.GetProperties();
            foreach (PropertyInfo property in properties)
            {
                if (Attribute.IsDefined(property, typeof(DomainPropertyAttribute)))
                {
                    DomainPropertyAttribute attribute = (DomainPropertyAttribute)Attribute.GetCustomAttribute(property, typeof(DomainPropertyAttribute));
                    System.Diagnostics.Debug.Assert(null != attribute);
                    Type typeProperty = _GetEffectiveType(property.PropertyType);

                    if (typeof(OrderCustomProperties) == typeProperty)
                    {
                        _AddCustomOrderProperties(prePath, mapProperties, selectedMapProperties, selectedConfig);
                    }
                    else if (typeof(Capacities) == typeProperty)
                    {
                        _AddCapacityProperties(prePath, mapProperties, selectedMapProperties, selectedConfig);
                    }
                    else if (typeof(Address) == typeProperty)
                    {   // specials type: address
                        ESRI.ArcLogistics.Geocoding.AddressField[] fields = App.Current.Geocoder.AddressFields;
                        for (int i = 0; i < fields.Length; ++i)
                        {
                            _AddPropertyTip(prePath, "Address." + fields[i].Type, fields[i].Title, mapProperties,
                                            selectedMapProperties, selectedConfig, null, null);
                        }
                    }
                    else if (typeof(ESRI.ArcLogistics.Geometry.Point) == typeProperty)
                    {   // specials type: Point
                        _AddPropertyTip(prePath, "GeoLocation.X", "X", mapProperties,
                                        selectedMapProperties, selectedConfig, null, null);
                        _AddPropertyTip(prePath, "GeoLocation.Y", "Y", mapProperties,
                                        selectedMapProperties, selectedConfig, null, null);
                    }
                    else
                    {
                        _AddCoreProperty(property, prePath, attribute, mapProperties, selectedMapProperties, selectedConfig);
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add core properties of class
        /// </summary>
        private void _AddCoreProperty(PropertyInfo property, string prePath, DomainPropertyAttribute attribute,
                                      IList <object> mapProperties, IList <object> selectedMapProperties, StringCollection selectedConfig)
        {
            Unit?displayUnits = null;
            Unit?valueUnits   = null;

            if (Attribute.IsDefined(property, typeof(UnitPropertyAttribute)))
            {
                UnitPropertyAttribute unitAttribute = (UnitPropertyAttribute)Attribute.GetCustomAttribute(
                    property, typeof(UnitPropertyAttribute));

                displayUnits = (RegionInfo.CurrentRegion.IsMetric) ? unitAttribute.DisplayUnitMetric : unitAttribute.DisplayUnitUS;
                valueUnits   = unitAttribute.ValueUnits;
            }

            _AddPropertyTip(prePath, property.Name, attribute.Title, mapProperties,
                            selectedMapProperties, selectedConfig, valueUnits, displayUnits);
        }