Exemplo n.º 1
0
 public void insertItemIntoKeyboardBuffer(inventoryItem itm)
 {
     System.Windows.Forms.SendKeys.Send(itm.ItemID + "\r");
 }
Exemplo n.º 2
0
 private void btnAddItem_Click(object sender, EventArgs e)
 {
     if (txtItemToAdd.Text.Length > 0)
     {
         inventoryItem i = new inventoryItem(txtItemToAdd.Text, txtDescription.Text);
         if (lstListOfItems.FindString(i.ToString()) == -1)
         {
             lstListOfItems.Items.Add(i);
         }
     }
 }
Exemplo n.º 3
0
 //Declaration of methods
 // The constructor - we need to have both the barcode string and its associated inventory item
 // when we construct it.  It doesn't make any sense in our system to have a barcode without an
 // associated item.  The only approved constructor of a barcode is an inventory
 // item.  Inventory items create barcodes.  No one else should.
 public barcode(String bc, inventoryItem i)
 {
     barcodeText = bc;
     item = i;
     barcodeList.Add(bc, this);  // this is a new barcode, so we add it to our barcode list
 }
 private void updateBarcodeList(inventoryItem itm)
 {
     lstBarcodes.Items.Clear();
     if (itm != null)
     {
         Dictionary<string, barcode> bcodes = itm.BarcodeList;
         foreach (KeyValuePair<string, barcode> b in bcodes)
         {
             lstBarcodes.Items.Add(b.Value);
         }
     }
 }
Exemplo n.º 5
0
 // Given an xml node named "itemNode" with all its child nodes, this
 // method creates a new inventory item and returns a reference for it
 // to the calling program.  If for some reason, the item cannot be
 // created, most likely because the xml is incorrect, then this
 // method returns a null reference.  The Item node must contain an
 // item_id child node, and it can optionally contain a Description
 // child node, and optionally contain a "Barcodes" child node
 private static inventoryItem createItemFromXML(XmlNode itemNode)
 {
     inventoryItem itm = null;
     String itemText = null;
     String descriptText = null;
     foreach (XmlNode node in itemNode.ChildNodes)
     {
         if (node.Name == "Item_ID")
         {
             itemText = node.InnerText;
         }
         if (node.Name == "Description")
         {
             descriptText = node.InnerText;
         }
     }
     if (itemText != null)
     {
         // let's check to see if the item already exists
         if (itemDictionary.ContainsKey(itemText))
         {
             if(itemDictionary.TryGetValue(itemText, out itm))
             {
                 itm.description = descriptText;
             }
         }
         else
         {
             if (descriptText != null)
             {
                 itm = new inventoryItem(itemText, descriptText);
             }
             else
             {
                 itm = new inventoryItem(itemText);
             }
         }
     }
     return itm;
 }
Exemplo n.º 6
0
 // Given an xml node <Barcodes> with all its child nodes, this
 // method creates a barcode instance for each <Barcode> and
 // assigns it to the inventory item.
 private static void assignBarcodesToItemFromXML(XmlNode bcList, inventoryItem itm)
 {
     if (bcList != null)
     {
         foreach (XmlNode node in bcList.ChildNodes)
         {
             if (node.Name == "Barcode")
             {
                 string bcText = node.InnerText;
                 itm.assignBarcode(bcText);
             }
         }
     }
 }