///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Put all properties to string.
        /// </summary>
        /// <param name="properties">Order custom properties values</param>
        internal static string AssemblyDBString(OrderCustomProperties properties, OrderCustomPropertiesInfo info)
        {
            Debug.Assert(properties.Count == info.Count);

            string strSeparator = new string(new char[1] {
                CommonHelpers.SEPARATOR
            });

            StringBuilder result = new StringBuilder();

            for (int index = 0; index < info.Count; ++index)
            {
                OrderCustomProperty propertyInfo = info[index];

                string value = null;
                if (OrderCustomPropertyType.Text == propertyInfo.Type)
                {
                    if (null != properties[index])
                    {
                        Debug.Assert(properties[index] is string);
                        value = (string)properties[index];
                    }
                }
                else if (OrderCustomPropertyType.Numeric == propertyInfo.Type)
                {
                    double tmp = 0.0;
                    if (null != properties[index])
                    {
                        if (properties[index] is double)
                        {
                            tmp = (double)properties[index];
                        }
                        else if (properties[index] is string)
                        {
                            tmp = double.Parse(properties[index].ToString());
                        }
                    }

                    value = tmp.ToString(CultureInfo.GetCultureInfo(CommonHelpers.STORAGE_CULTURE));
                }
                else
                {
                    Debug.Assert(false); // NOTE: not supported
                }

                if (!string.IsNullOrEmpty(value))
                {
                    string prop = value.Replace(strSeparator, CommonHelpers.SEPARATOR_ALIAS);
                    result.Append(prop);
                }

                if (index < properties.Count - 1)
                {
                    result.Append(CommonHelpers.SEPARATOR); // NOTE: after last not neded
                }
            }

            return(result.ToString());
        }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            OrderCustomProperties obj = new OrderCustomProperties(this._propertiesInfo);

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

            return(obj);
        }
        /// <summary>
        /// Parse string and split it to properties values
        /// </summary>
        /// <param name="propertiesValuesString">DB order custom properties string</param>
        /// <param name="orderCustomPropertiesInfo">Project order custom properties info</param>
        /// <returns>Parsed order custom properties</returns>
        internal static OrderCustomProperties CreateFromDBString(string propertiesValuesString,
                                                                 OrderCustomPropertiesInfo orderCustomPropertiesInfo)
        {
            Debug.Assert(orderCustomPropertiesInfo != null);

            // Create order custom properties object using data of orderCustomPropertiesinfo.
            OrderCustomProperties orderCustomProperties = new OrderCustomProperties(orderCustomPropertiesInfo);

            if (null == propertiesValuesString)
            {   // special initialization - of numeric values
                for (int index = 0; index < orderCustomPropertiesInfo.Count; ++index)
                {
                    if (OrderCustomPropertyType.Numeric == orderCustomPropertiesInfo[index].Type)
                    {
                        orderCustomProperties[index] = 0.0;
                    }
                }
            }
            else
            {
                // Values separator.
                char[] valuesSeparator = new char[1] {
                    CommonHelpers.SEPARATOR
                };

                // Get array of values splitted by separator.
                string[] propertiesValues = propertiesValuesString.Split(valuesSeparator, StringSplitOptions.None);

                // This condition is not always true.
                //Debug.Assert(propertiesValues.Length == orderCustomPropertiesinfo.Count);

                string strSeparator = new string(valuesSeparator);

                // Iterate through list of order custom properties.
                for (int index = 0; index < orderCustomPropertiesInfo.Count; ++index)
                {
                    // Get current order custom property.
                    OrderCustomProperty orderCustomProperty = orderCustomPropertiesInfo[index];

                    // If index of item in list of order custom properties info is less than
                    // length of array with values.
                    if (index < propertiesValues.Length)
                    {
                        // Get current value for appropriate custom order property.
                        string currentStrValue = propertiesValues[index];
                        if (!string.IsNullOrEmpty(currentStrValue))
                        {
                            currentStrValue = currentStrValue.Replace(CommonHelpers.SEPARATOR_ALIAS, strSeparator);
                        }

                        // Value of current property.
                        object currentPropertyValue = null;

                        // If type of order custom property is Text.
                        if (OrderCustomPropertyType.Text == orderCustomProperty.Type)
                        {
                            // Assign property valus as it is.
                            currentPropertyValue = currentStrValue;
                        }
                        // Type of custom order property is Numeric.
                        else if (OrderCustomPropertyType.Numeric == orderCustomProperty.Type)
                        {
                            // Convert string value to double.
                            double tmp = 0.0;
                            if (!string.IsNullOrEmpty(currentStrValue))
                            {
                                tmp = double.Parse(currentStrValue, CultureInfo.GetCultureInfo(CommonHelpers.STORAGE_CULTURE));
                            }
                            currentPropertyValue = tmp;
                        }
                        else
                        {
                            Debug.Assert(false); // NOTE: not supported
                        }

                        // Assign value of current custom order property.
                        orderCustomProperties[index] = currentPropertyValue;
                    } // if (index < values.Length)
                }     // for (int index = 0; index < info.Count; ++index)
            }         // else of if (null == value)

            return(orderCustomProperties);
        }