Exemple #1
0
 public void GetProduct(BarCode barCode)
 {
     BarCodeScanner = new BarCodeScanner(this.ProductRepository);
     var productID = BarCodeScanner.GetProductID(barCode);
     if (productID != -1)
     {
         var product = BarCodeScanner.GetProduct(productID);
         if (product != null)
         {
             Products.Add(product);
             var message = string.Format("{0}, {1}", product.ProductName, product.ProductPrice);
             LCDisplayDevice.MessageToDisplay = message;
             LCDisplayDevice.PrintMessage(message);
         }
         else
         {
             LCDisplayDevice.MessageToDisplay = "Product not found";
             LCDisplayDevice.PrintMessage("Product not found");
         }
     }
     else
     {
         LCDisplayDevice.MessageToDisplay = "Invalid bar-code";
         LCDisplayDevice.PrintMessage("Invalid bar-code");
     }
 }
Exemple #2
0
        public void GetProduct(BarCode barCode)
        {
            BarCodeScanner = new BarCodeScanner(this.ProductRepository);
            var productID = BarCodeScanner.GetProductID(barCode);

            if (productID != -1)
            {
                var product = BarCodeScanner.GetProduct(productID);
                if (product != null)
                {
                    Products.Add(product);
                    var message = string.Format("{0}, {1}", product.ProductName, product.ProductPrice);
                    LCDisplayDevice.MessageToDisplay = message;
                    LCDisplayDevice.PrintMessage(message);
                }
                else
                {
                    LCDisplayDevice.MessageToDisplay = "Product not found";
                    LCDisplayDevice.PrintMessage("Product not found");
                }
            }
            else
            {
                LCDisplayDevice.MessageToDisplay = "Invalid bar-code";
                LCDisplayDevice.PrintMessage("Invalid bar-code");
            }
        }