//For Deep Copy public Product(Product other) { topSellerStatus = other.topSellerStatus; name = other.name; type = other.type; productID = other.productID; location = other.location; inStock = other.inStock; stockCount = other.stockCount; price = other.price; }
public Product ProductConverterToContext(Backend.Product currentProduct) { TopSeller dataContextTopSeller = new TopSeller(); Product dataContextProduct = new Product(); dataContextProduct.Name = currentProduct.Name; dataContextProduct.Type = (int)currentProduct.Type; dataContextProduct.ProductID = currentProduct.ProductID; dataContextProduct.Location = currentProduct.Location; dataContextProduct.InStock = (int)currentProduct.InStock; dataContextProduct.StockCount = currentProduct.StockCount; dataContextProduct.Price = currentProduct.Price; dataContextTopSeller.CurrentMonth = currentProduct.TopSellerStatus.CurrentMonth; dataContextTopSeller.IsTopSeller = currentProduct.TopSellerStatus.IsTopSeller; dataContextTopSeller.SellCounter = currentProduct.TopSellerStatus.SellCounter; dataContextTopSeller.ProductID = currentProduct.TopSellerStatus.ProductID; dataContextProduct.TopSeller = dataContextTopSeller; return(dataContextProduct); }
public Product(string _name, PType _type, int _location, int _stockCount, int _price, int _productID = 0) { topSellerStatus = new TopSeller(_productID); name = _name; type = _type; productID = _productID; location = _location; stockCount = _stockCount; price = _price; if (stockCount == 0) { inStock = PStatus.Empty; } else if (stockCount <= 20) { inStock = PStatus.LowQuantity; } else { inStock = PStatus.InStock; } }
//Constructors: public Product() { topSellerStatus = new TopSeller(); }
public void ResetSells() { topSellerStatus = new TopSeller(productID); }