public void SetInventory() { foreach (var allInventoryItem in StaticInventoryTracker.AllInventoryItems) { CurrentInventory.Add(new InventoryItem(allInventoryItem.ProductCode, allInventoryItem.Units, allInventoryItem.PiecesPerUnit, allInventoryItem.Grade, allInventoryItem.MasterID, allInventoryItem.InventoryItemID)); } }
public void UpdateActiveInventory() { ITransaction finder = new ListCurrentInventoryTransaction(sqliteStore); finder.Execute(); CurrentInventory.Clear(); CurrentInventoryBatchNumberToIdMappings.Clear(); BubbleSortEntitiesByBatchDisplayName(finder); for (int i = 0; i < finder.Results.Count; i++) { Entity <InventoryBatch> entity = finder.Results[i] as Entity <InventoryBatch>; CurrentInventory.Add(entity.NativeModel); CurrentInventoryBatchNumberToIdMappings.Add(entity.NativeModel.BatchNumber, entity.SystemId); } }
private void AddPressProduction(DateTime start, DateTime end) { // current day already moved var production = PressManager.Instance.GetProduction(start, end); foreach (var tuple in production) { // add inventory var inv = CurrentInventory.FirstOrDefault(i => i.MasterID == tuple.Item1.MasterID); if (inv != null) { inv.Units += tuple.Item2; } else { InventoryItem newInv = new InventoryItem(tuple.Item1, tuple.Item2, "DEALER"); CurrentInventory.Add(newInv); } } }
public void FillInventory() { // read txt file // set object properties from read-in data try { string currentDirectory = Environment.CurrentDirectory; string inventoryFile = "Inventory.txt"; string fullInventoryPath = Path.Combine(currentDirectory, @"..\..\..\..\..\Example Files", inventoryFile); using (StreamReader sr = new StreamReader(fullInventoryPath)) { while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] lineArray = line.Split("|"); VendingMachineItem vmi = new VendingMachineItem { Category = lineArray[3], Price = Decimal.Parse(lineArray[2]), SlotLocation = lineArray[0], Name = lineArray[1] }; CurrentInventory.Add(vmi); } } } catch (IOException e) { Console.WriteLine("File IO error."); } catch (Exception e) { Console.WriteLine("Application error."); } }