/// <summary> /// Attempts to add the item based on id and date. In case of an invalid item a prompt is displayed /// </summary> /// <param name="id">Id of the item</param> /// <param name="date">Expiry date</param> private void AddItem(long id, DateTime date) { ProductBase prodB = db.GetProduct(id); if (prodB == null) { MessageBox.Show("The specified product does not exist"); } else { Product prod = new Product(prodB, date); AddItem(prod); } }
public Product(ProductBase p, int daysUntilExpiry) : this(p, DateTime.Today.AddDays(daysUntilExpiry)) { }
public Product(ProductBase p, DateTime expiryDate) : this(p.Id, p.ImageName, p.Label, p.Category, p.IsDiary, p.Limit, p.Price, p.Facing, expiryDate) { }
/// <summary> /// Creates a copy of the ProductBase /// </summary> /// <param name="p">The object to be copied</param> public ProductBase(ProductBase p) : this(p.Id, p.ImageName, p.Label, p.Category, p.IsDiary, p.Limit, p.Price, p.Facing) { }