public KeyValuePair <bool, string> NewMoving(string message) { bool successful = false; //parsing List <string> parameters = message.Split('~').ToList(); string email = parameters[0]; char type = char.Parse(parameters[1]); int eventID = int.Parse(parameters[2]); //generating objects Moving Moving; if (type == 'I') { Moving = new Moving(type, EventContainer.Instance.Imports[eventID], null); Inventory.Instance.AddGoods(Moving.Import.ImportNeed.Goods); Warehouse.Instance.Keepers[email].TruckStand.RemoveGoods(); } else if (type == 'E') { Moving = new Moving(type, null, EventContainer.Instance.ExportNeeds[eventID]); Inventory.Instance.RemoveGoods(Moving.ExportNeed.Goods); Warehouse.Instance.Keepers[email].TruckStand.AddGoods(Moving.ExportNeed.Goods); } else if (type == 'M') { Moving = new Moving(type, null, null); } //output message = Warehouse.Instance.Keepers[email].TruckStand.Print(); message += Inventory.Instance.PrintAllGoods(); successful = true; return(new KeyValuePair <bool, string>(successful, message)); }
public void AddMoving(Moving moving) { Movings.Add(moving); }