Example #1
0
        private void AddProductInCatalog(StorehouseProduct prod)
        {
            SortedDictionary <string, List <ProductCharacteristic> > dictGroups;
            List <ProductCharacteristic> listCharacteristics;

            if (GetCatalogGroupsFromCategory(prod.ProductCategory) == null)
            {
                listCharacteristics = new List <ProductCharacteristic>();
                listCharacteristics.Add(prod.GetProductCharacteristic());
                dictGroups = new SortedDictionary <string, List <ProductCharacteristic> >();
                dictGroups.Add(prod.ProductGroup, listCharacteristics);
                _productCatalog.Add(prod.ProductCategory, dictGroups);
            }
            else
            {
                dictGroups = GetCatalogGroupsFromCategory(prod.ProductCategory);
                if (GetCatalogListProductsFromGroup(dictGroups, prod.ProductGroup) == null)
                {
                    listCharacteristics = new List <ProductCharacteristic>();
                    listCharacteristics.Add(prod.GetProductCharacteristic());
                    dictGroups.Add(prod.ProductGroup, listCharacteristics);
                }
                else
                {
                    listCharacteristics = GetCatalogListProductsFromGroup(dictGroups, prod.ProductGroup);
                    listCharacteristics.Add(prod.GetProductCharacteristic());
                }
            }
        }
        public void UpdateProductCharacteristic()
        {
            ProductCharacteristic characteristic;

            if (_product.GetProductCharacteristic() == null)
            {
                characteristic                 = new ProductCharacteristic();
                characteristic.Measure         = (Measure)_product.Measure.Clone();
                characteristic.Price           = _product.Price;
                characteristic.ProductId       = _product.ProductId;
                characteristic.ProductName     = (string)_product.ProductName.Clone();
                characteristic.ProduceCountry  = (string)_product.ProduceCountry.Clone();
                characteristic.ProductCategory = (string)_product.ProductCategory.Clone();
                characteristic.ProductGroup    = (string)_product.ProductGroup.Clone();
                _product.SetProductCharacteristic(characteristic);
            }
            else
            {
                characteristic = _product.GetProductCharacteristic();
            }

            characteristic.TotalQuantityProduct = _product.TotalQuantityProduct;
        }