Esempio n. 1
0
        private void _CreateCapacities(CapacitiesInfo capacitiesInfo)
        {
            _capacitiesInfo = capacitiesInfo;
            _capacities     = new Capacities(capacitiesInfo);
            _InitCapacitiesFromDefaults(capacitiesInfo);

            _capacities.PropertyChanged += new PropertyChangedEventHandler(Capacities_PropertyChanged);
        }
Esempio n. 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Clones Capacities object.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            Capacities obj = new Capacities(this._capacitiesInfo);

            for (int index = 0; index < _values.Length; index++)
            {
                obj._values[index] = this._values[index];
            }

            return(obj);
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the error message for the property with the given name.
 /// </summary>
 public override string this[string columnName]
 {
     get
     {
         int index = Capacities.GetCapacityPropertyIndex(columnName);
         if (-1 != index)
         {
             return(_ValidateCapacity(index));
         }
         else
         {
             return(base[columnName]);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Put all capacities to string
        /// </summary>
        /// <param name="capacities">Capacities values</param>
        internal static string AssemblyDBString(Capacities capacities)
        {
            StringBuilder result = new StringBuilder();

            for (int index = 0; index < capacities.Count; ++index)
            {
                result.Append(capacities[index].ToString(CultureInfo.GetCultureInfo(CommonHelpers.STORAGE_CULTURE)));
                if (index < capacities.Count - 1)
                {
                    result.Append(CommonHelpers.SEPARATOR); // NOTE: after last not neded
                }
            }

            return(result.ToString());
        }
Esempio n. 5
0
        /// <summary>
        /// Parse string and split it to capacities values
        /// </summary>
        /// <param name="value">Capacities string</param>
        /// <param name="capacitiesInfo">Project capacities info</param>
        /// <returns>Parsed capacities</returns>
        internal static Capacities CreateFromDBString(string value, CapacitiesInfo capacitiesInfo)
        {
            Capacities capacities = new Capacities(capacitiesInfo);

            if (null != value)
            {
                value = value.Replace(CommonHelpers.SEPARATOR_OLD, CommonHelpers.SEPARATOR); // NOTE: for support old projects

                char[] valuesSeparator = new char[1] {
                    CommonHelpers.SEPARATOR
                };
                string[] capacitiesValues = value.Split(valuesSeparator, StringSplitOptions.None);

                System.Diagnostics.Debug.Assert(capacitiesValues.Length == capacitiesInfo.Count);

                for (int index = 0; index < capacitiesValues.Length; index++)
                {
                    double capacityValue = double.Parse(capacitiesValues[index], CultureInfo.GetCultureInfo(CommonHelpers.STORAGE_CULTURE));
                    capacities[index] = capacityValue;
                }
            }

            return(capacities);
        }
Esempio n. 6
0
 private void _UpdateCapacitiesEntityData()
 {
     _Entity.Capacities = Capacities.AssemblyDBString(_capacities);
 }
Esempio n. 7
0
 private void _ClearCapacities()
 {
     _capacities = new Capacities(_capacitiesInfo);
 }
Esempio n. 8
0
 private void _InitCapacities(DataModel.Vehicles entity, CapacitiesInfo capacitiesInfo)
 {
     _capacities = Capacities.CreateFromDBString(entity.Capacities, capacitiesInfo);
     _capacities.PropertyChanged += new PropertyChangedEventHandler(Capacities_PropertyChanged);
 }