public void calculateProductUnitPrice(Product product, ProductDetailCalculatorParameter parameter)
        {
            ProductDetail productDetail = null;

            if (product.ProductType != null)
            {
                if (product.ProductType.Equals("FoodAndBeverageItems"))
                {
                    productDetail = new FoodAndBeverage(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("MaterialItems"))
                {
                    productDetail = new Material(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("GarmentItems"))
                {
                    productDetail = new Garment(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TransportationServices"))
                {
                    productDetail = new Transportation(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TelecommunicationServices"))
                {
                    productDetail = new Telecommunication(this.Delimeter, product);
                }
                else
                {
                    throw new Exception("Unknown Product Type");
                }

                productDetail.setAdditionalParameter(parameter);
                product.UnitPrice = productDetail.calculateProductCost() * productDetail.getDecCostRate();
            }
        }
Esempio n. 2
0
        public void instantiationProduct(Product product, ProductDetailCalculatorParameter parameter)
        {
            ProductDetail productDetail = null;

            if (product.ProductType != null)
            {
                if (product.ProductType.Equals("FoodAndBeverageItems"))
                {
                    productDetail = new FoodAndBeverage(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("MaterialItems"))
                {
                    productDetail = new Material(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("GarmentItems"))
                {
                    productDetail = new Garment(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TransportationServices"))
                {
                    productDetail = new Transportation(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TelecommunicationServices"))
                {
                    productDetail = new Telecommunication(this.Delimeter, product);
                }
                else
                {
                    throw new Exception("Unknown Product Type");
                }
            }
        }
Esempio n. 3
0
        public Product createProductString()
        {
            var description = "";
            var config      = new MapperConfiguration(con => { });
            var mapper      = new Mapper(config);

            if (this.ProductType.Equals("FoodAndBeverageItems"))
            {
                FoodAndBeverage Foods = mapper.Map <FoodAndBeverage>(this.ProductDetail);
                description = Foods.ConvertToString();
            }
            else if (this.ProductType.Equals("MaterialItems"))
            {
                Material material = mapper.Map <Material>(this.ProductDetail);
                description = material.ConvertToString();
            }
            else if (this.ProductType.Equals("GarmentItems"))
            {
                Garment garment = mapper.Map <Garment>(this.ProductDetail);
                description = garment.ConvertToString();
            }
            else if (this.ProductType.Contains("TransportationServices"))
            {
                Transportation transport = mapper.Map <Transportation>(this.ProductDetail);
                description = transport.ConvertToString();
            }
            else if (this.ProductType.Contains("TelecommunicationServices"))
            {
                Telecommunication telecommunications = mapper.Map <Telecommunication>(this.ProductDetail);
                description = telecommunications.ConvertToString();
            }

            return(new Product()
            {
                ProductID = this.ProductID,
                ProductName = this.ProductName,
                SupplierID = this.SupplierID,
                CategoryID = this.CategoryID,
                QuantityPerUnit = this.QuantityPerUnit,
                UnitPrice = this.UnitPrice,
                UnitsInStock = this.UnitsInStock,
                UnitsOnOrder = this.UnitsOnOrder,
                ReorderLevel = this.ReorderLevel,
                Discontinued = this.Discontinued,
                ProductType = this.ProductType,
                ProductDetail = description
            });
        }