public inventoryItem findByID(string search) { inventoryItem result = null; for (int i = 0; i < theList.Count(); i++) { //does this product have the same id as id? if (theList[i].id.Equals(search)) { result = theList[i]; return(result); } } return(null); }
public inventoryItem findByModel(string search) { inventoryItem result = null; for (int i = 0; i < theList.Count(); i++) { if (theList[i].model.Equals(search)) { result = theList[i]; return(result); } } return(result); }
public Form1() { InitializeComponent(); this.AutoSize = true; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; sr = new System.IO.StreamReader("inventoryManager.txt"); while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] fileLine = line.Split(','); inventoryItem fileItem = new inventoryItem(fileLine[0], fileLine[1], int.Parse(fileLine[2]), fileLine[3], fileLine[4], double.Parse(fileLine[5])); itemList.Add(fileItem); } sr.Close(); }
public void restock(inventoryItem item, int restock) { item.stock = restock; }