Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class.
 /// </summary>
 /// <param name="name">The Name of the Product.</param>
 /// <param name="stockNumber">The Stock Number of the Product.</param>
 /// <param name="quantity">The Quantity of the Product.</param>
 /// <param name="cost">The Cost of the Product.</param>
 /// <param name="price">The Price of the Product.</param>
 public Product(string name, int stockNumber, int quantity, int cost, int price, bool discontinued)
 {
     m_productName  = name;
     m_sn           = new StockNumber(stockNumber);
     m_quantity     = quantity;
     m_cost         = new CashValue(cost);
     m_price        = new CashValue(price);
     m_discontinued = discontinued;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Product"/> class.
 /// </summary>
 /// <param name="i">The Inventory object to create a product from.</param>
 public Product(Inventory i)
 {
     m_productName  = i.Item_Name;
     m_quantity     = i.Quantity;
     m_sn           = new StockNumber(i.Stock_Number);
     m_price        = new CashValue(i.Price);
     m_cost         = new CashValue(i.Cost);
     m_discontinued = i.Discontinued;
 }
Exemple #3
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            StockNumber sn = obj as StockNumber;

            if (sn == null)
            {
                return(false);
            }
            return(m_value == sn.m_value);
        }