Esempio n. 1
0
        /// <summary>
        /// Gets dictonary title to name for application type.
        /// </summary>
        /// <param name="type">Propery type.</param>
        /// <param name="title">Property title.</param>
        /// <param name="name">Property name.</param>
        /// <param name="map">Dictonary title to name.</param>
        /// <returns>TRUE if processed successly.</returns>
        static private bool _GetAppTypeTitle2NameMap(Type type,
                                                     string title,
                                                     string name,
                                                     ref StringDictionary map)
        {
            bool result = true;

            if (typeof(OrderCustomProperties) == type)
            {   // specials type: related object OrderCustomProperty
                OrderCustomPropertiesInfo info = App.Current.Project.OrderCustomPropertiesInfo;
                for (int index = 0; index < info.Count; ++index)
                {
                    map.Add(info[index].Name, OrderCustomProperties.GetCustomPropertyName(index));
                }
            }

            else if (typeof(Capacities) == type)
            {   // specials type: related object Capacities
                CapacitiesInfo info = App.Current.Project.CapacitiesInfo;
                for (int index = 0; index < info.Count; ++index)
                {
                    map.Add(info[index].Name, Capacities.GetCapacityPropertyName(index));
                }
            }

            else if (typeof(Address) == type)
            {   // specials type: related object Address
                AddressField[] fields = App.Current.Geocoder.AddressFields;
                for (int index = 0; index < fields.Length; ++index)
                {
                    map.Add(fields[index].Title, fields[index].Type.ToString());
                }
            }

            else if ((typeof(IDataObjectCollection <VehicleSpecialty>) == type) ||
                     (typeof(IDataObjectCollection <DriverSpecialty>) == type) ||
                     (typeof(IDataObjectCollection <Location>) == type) ||
                     (typeof(IDataObjectCollection <Zone>) == type) ||
                     (typeof(FuelType) == type) ||
                     (!string.IsNullOrEmpty(title) &&
                      ((typeof(Location) == type) || (typeof(MobileDevice) == type) ||
                       (typeof(Vehicle) == type) || (typeof(Driver) == type))))
            {   // specials types: related objects and objects collection
                map.Add(title, name);
            }

            else
            {
                result = false;
            }

            return(result);
        }
Esempio n. 2
0
 private static void _AddCapacitiesInfos(PropertyInfo property)
 {
     if (App.Current.Project != null)
     {
         CapacitiesInfo info = App.Current.Project.CapacitiesInfo;
         for (int i = 0; i < info.Count; ++i)
         {
             _quantityFieldTitles.Add(info[i].Name);
             _quantityFieldNames.Add(Capacities.GetCapacityPropertyName(i));
             _quantityFieldProperties.Add(property);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Builds collection of dynamic capacities
        /// </summary>
        /// <returns></returns>
        private Collection <DataGridItemProperty> _GetDynamicCapacitiesProperties(string baseValuePath, bool isReadonly)
        {
            Collection <DataGridItemProperty> dynamicProperties = new Collection <DataGridItemProperty>();

            for (int i = 0; i < App.Current.Project.CapacitiesInfo.Count; i++)
            {
                string valuePath = baseValuePath + string.Format("Capacities[{0}]", i);
                string valueName = Capacities.GetCapacityPropertyName(i);

                DataGridItemProperty newProperty = new DataGridItemProperty(valueName, valuePath, typeof(double));
                newProperty.IsReadOnly = isReadonly;
                dynamicProperties.Add(newProperty);
            }
            return(dynamicProperties);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets collection of dynamic capacities columns
        /// </summary>
        /// <returns></returns>
        private Collection <Column> _GetDynamicCapacitiesColumns(bool isReadOnly)
        {
            Collection <Column> dynamicColumns = new Collection <Column>();

            for (int i = 0; i < App.Current.Project.CapacitiesInfo.Count; i++)
            {
                Column col = new Column();
                col.FieldName           = Capacities.GetCapacityPropertyName(i);
                col.Title               = App.Current.Project.CapacitiesInfo[i].Name;
                col.ReadOnly            = isReadOnly;
                col.CellContentTemplate = (DataTemplate)App.Current.FindResource("UnitCellContentTemplate");
                col.CellEditor          = (CellEditor)App.Current.FindResource("UnitEditorTemplate");
                dynamicColumns.Add(col);
            }
            return(dynamicColumns);
        }