Пример #1
0
 public void GetInput(BarCode barCode = null)
 {
     if (barCode != null)
         GetProduct(barCode);
     else
         GetExitCode();
 }
Пример #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");
     }
 }
Пример #3
0
 public int GetProductID(BarCode barCode)
 {
     int productID = -1;
     if (barCode != null && barCode.ProductID.HasValue)
     {
         productID = barCode.ProductID.Value;
     }
     else
     {
         ErrorMessage = "Invalid bar-code";
     }
     return productID;
 }