/// <summary>
        /// Gets list of object data field for application types.
        /// </summary>
        /// <param name="type">Propery type.</param>
        /// <param name="title">Property title.</param>
        /// <param name="isSourceShape">Flag is source shape file.</param>
        /// <param name="list">Output list object data field.</param>
        private static bool _GetAppTypeFieldInfos(Type type,
                                                  string title,
                                                  bool isSourceShape,
                                                  ref List<ObjectDataFieldInfo> list)
        {
            bool result = true;

            if (typeof(OrderCustomProperties) == type)
            {   // specials type: related object OrderCustomProperty
                OrderCustomPropertiesInfo infos = App.Current.Project.OrderCustomPropertiesInfo;
                for (int index = 0; index < infos.Count; ++index)
                {
                    Type propType = (infos[index].Type == OrderCustomPropertyType.Text) ?
                                        typeof(string) : typeof(double);
                    var info = new DataFieldInfo(infos[index].Name, propType);
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            else if (typeof(Capacities) == type)
            {   // specials type: related object Capacities
                CapacitiesInfo infos = App.Current.Project.CapacitiesInfo;
                for (int index = 0; index < infos.Count; ++index)
                {
                    var info = new DataFieldInfo(infos[index].Name, typeof(double));
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            else if (typeof(Address) == type)
            {   // specials type: related object Address
                AddressField[] fields = App.Current.Geocoder.AddressFields;
                for (int index = 0; index < fields.Length; ++index)
                {
                    var info = new DataFieldInfo(fields[index].Title, typeof(string));
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            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
                var info = new DataFieldInfo(title, typeof(string));
                var fieldInfo = new ObjectDataFieldInfo(info, false);
                list.Add(fieldInfo);
            }

            else
            {
                result = false;
            }

            return result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets list of object data field for application types.
        /// </summary>
        /// <param name="type">Propery type.</param>
        /// <param name="title">Property title.</param>
        /// <param name="isSourceShape">Flag is source shape file.</param>
        /// <param name="list">Output list object data field.</param>
        static private bool _GetAppTypeFieldInfos(Type type,
                                                  string title,
                                                  bool isSourceShape,
                                                  ref List <ObjectDataFieldInfo> list)
        {
            bool result = true;

            if (typeof(OrderCustomProperties) == type)
            {   // specials type: related object OrderCustomProperty
                OrderCustomPropertiesInfo infos = App.Current.Project.OrderCustomPropertiesInfo;
                for (int index = 0; index < infos.Count; ++index)
                {
                    Type propType = (infos[index].Type == OrderCustomPropertyType.Text) ?
                                    typeof(string) : typeof(double);
                    var info = new DataFieldInfo(infos[index].Name, propType);
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            else if (typeof(Capacities) == type)
            {   // specials type: related object Capacities
                CapacitiesInfo infos = App.Current.Project.CapacitiesInfo;
                for (int index = 0; index < infos.Count; ++index)
                {
                    var info = new DataFieldInfo(infos[index].Name, typeof(double));
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            else if (typeof(Address) == type)
            {   // specials type: related object Address
                AddressField[] fields = App.Current.Geocoder.AddressFields;
                for (int index = 0; index < fields.Length; ++index)
                {
                    var info = new DataFieldInfo(fields[index].Title, typeof(string));
                    list.Add(new ObjectDataFieldInfo(info, false));
                }
            }

            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
                var info      = new DataFieldInfo(title, typeof(string));
                var fieldInfo = new ObjectDataFieldInfo(info, false);
                list.Add(fieldInfo);
            }

            else
            {
                result = false;
            }

            return(result);
        }