Example #1
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public object Clone()
        {
            // Create a clone of this object.
            CustomOrderProperty clone =
                new CustomOrderProperty(_name, _description, _maximumLength, _orderPairKey);

            return(clone);
        }
Example #2
0
        /// <summary>
        /// Compares this custom order property with given one.
        /// </summary>
        /// <param name="customOrderProperty">Custom order property to compare.</param>
        /// <returns>True - if this custom order property has the same name and description
        /// as onother one, otherwise - false.</returns>
        public bool CompareTo(CustomOrderProperty customOrderProperty)
        {
            bool comparisonResult =
                customOrderProperty != null &&
                Name.Equals(customOrderProperty.Name, StringComparison.CurrentCulture) &&
                Description.Equals(customOrderProperty.Description, StringComparison.CurrentCulture);

            return(comparisonResult);
        }
Example #3
0
        /// <summary>
        /// Sets given name validator for collection of items.
        /// </summary>
        /// <param name="items">Collection of items (CustomOrderProperty objects).</param>
        /// <param name="nameValidator">Name validator.</param>
        private void _SetNameValidatorForItems(IList items, ICustomOrderPropertyNameValidator nameValidator)
        {
            if (items == null)
            {
                return;
            }

            // Iterate thor items in collection.
            foreach (object item in items)
            {
                // Get current item from collection, it should be CustomOrderProperty object.
                CustomOrderProperty orderProperty = item as CustomOrderProperty;
                Debug.Assert(orderProperty != null);

                // Set name validator for custom order property.
                orderProperty.NameValidator = nameValidator;
            }
        }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public object Clone()
        {
            // Create a clone of this object.
            CustomOrderProperty clone =
                new CustomOrderProperty(_name, _description, _maximumLength, _orderPairKey);

            return clone;
        }
        /// <summary>
        /// Compares this custom order property with given one.
        /// </summary>
        /// <param name="customOrderProperty">Custom order property to compare.</param>
        /// <returns>True - if this custom order property has the same name and description
        /// as onother one, otherwise - false.</returns>
        public bool CompareTo(CustomOrderProperty customOrderProperty)
        {
            bool comparisonResult =
                customOrderProperty != null &&
                Name.Equals(customOrderProperty.Name, StringComparison.CurrentCulture) &&
                Description.Equals(customOrderProperty.Description, StringComparison.CurrentCulture);

            return comparisonResult;
        }
        /// <summary>
        /// Loads custom order properties from collection OrderCustomPropertiesInfo.
        /// </summary>
        /// <param name="customPropertiesInfo">OrderCustomPropertiesInfo collection.</param>
        public void LoadCustomOrderProperties(OrderCustomPropertiesInfo customPropertiesInfo)
        {
            Debug.Assert(customPropertiesInfo != null);

            // Clear collection.
            _customOrderProperties.Clear();

            foreach (OrderCustomProperty orderCustomProperty in customPropertiesInfo)
            {
                // Create custom order property using data of item in collection.
                CustomOrderProperty newOrderProperty =
                    new CustomOrderProperty(orderCustomProperty.Name,
                                            orderCustomProperty.Description,
                                            orderCustomProperty.Length,
                                            orderCustomProperty.OrderPairKey);

                // Add new custom order property to collection.
                _customOrderProperties.Add(newOrderProperty);
            }

            // Backup collection of custom order properties.
            _BackupCustomOrderPropertiesCollection();
        }