Exemple #1
0
 public Transaction(decimal ExclusiveDiscount, Product assocProduct, int purchasedQuantity, DateTime SaleDate)
 {
     this.exclusiveDiscount = ExclusiveDiscount;
     this.associatedProduct = assocProduct;
     this.saleDate = SaleDate;
     this.purchasedQuantity = purchasedQuantity;
     this.transactionid = getNextTransactionId();
 }
Exemple #2
0
 public Transaction(decimal ExclusiveDiscount, Product assocProduct, int purchasedQuantity)
     : this(ExclusiveDiscount, assocProduct, purchasedQuantity, DateTime.Now)
 {
 }
Exemple #3
0
        /// <summary>
        /// Queries the database for all objects stored in it
        /// </summary>
        /// <returns>
        /// Returns an array of product objects who's values are stored in the database
        /// </returns>
        public static Product[] GetAllProducts()
        {
            DataRowCollection rows = DatabaseController.GetQueryResults("SELECT * FROM Product_T", new Dictionary<string,object>());

            List<Product> pList = new List<Product>();

            foreach(DataRow dr in rows)
            {
                decimal discountedPrice = (decimal)dr["DiscountedPrice"];
                bool isDicounted = ((byte[])dr["isDiscounted"])[0] == 1 ? true : false;
                string productName = (string)dr["ProductName"];
                string productDescription = (string)dr["ProductDescription"];
                decimal productBuyPrice = (decimal)dr["ProductBuyPrice"];
                decimal productSalesPrice = (decimal)dr["ProductSalePrice"];
                int productId = (int)dr["ID"];
                int productQuantity = (int)dr["ProductQuantity"];

                Product nProduct = new Product(discountedPrice, isDicounted, productBuyPrice, productDescription, productId, productName, productQuantity, productSalesPrice);
                pList.Add(nProduct);
            }

            return pList.ToArray();
        }
Exemple #4
0
 //Constructors
 public Transaction(decimal ExclusiveDiscount, Product assocProduct)
     : this(ExclusiveDiscount, assocProduct, 1, DateTime.Now)
 {
 }
 /// <summary>
 /// Adds a transaction to the list of current transactions
 /// </summary>
 /// <param name="product"></param>
 /// <returns>
 /// Returns the newly added transaction
 /// </returns>
 public Transaction AddTransaction(Product product)
 {
     Transaction transaction = new Transaction(0.0M, product);
     pTransactions.Add(transaction);
     return transaction;
 }