// Add New Badge public void AddNewBadgeToList(int badgeID, Badge newBadge) { badgeDictionary.Add(badgeID, newBadge); }
public void RemoveDoorFromBadge(int badge) { Badge newBadge = new Badge(); newBadge.Doors = new List <DoorID>(); int newBadgeID = badge; newBadge.BadgeID = newBadgeID; DoorID newDoorID = new DoorID(); Console.WriteLine("What door would you like to Remove from this badge?"); string newDoor = Console.ReadLine(); Console.WriteLine(newDoor); if (newDoor == "A1") { newDoorID = DoorID.A1; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "A2") { newDoorID = DoorID.A2; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "A3") { newDoorID = DoorID.A3; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "A4") { newDoorID = DoorID.A4; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "A5") { newDoorID = DoorID.A5; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "B1") { newDoorID = DoorID.B1; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "B2") { newDoorID = DoorID.B2; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "B3") { newDoorID = DoorID.B3; newBadge.Doors.Remove(newDoorID); } else if (newDoor == "B4") { newDoorID = DoorID.B4; newBadge.Doors.Remove(newDoorID); } bool wasRemoved = _repo.RemoveDoorFromBadge(newBadgeID, newDoorID); if (wasRemoved) { Console.WriteLine("Door was removed from badge"); } else { Console.WriteLine("Door was not removed from badge."); } }
private void AddBadge() { Console.Clear(); Badge newBadge = new Badge(); newBadge.Doors = new List <DoorID>(); Console.WriteLine("What is the badge number on the badge?"); int newBadgeID = Convert.ToInt32(Console.ReadLine()); newBadge.BadgeID = newBadgeID; Console.WriteLine("Would you like to assign door access to this badge (y/n)?"); string input = Console.ReadLine(); while (input == "y") { Console.WriteLine("List a door that it needs access to"); string newDoor = Console.ReadLine(); if (newDoor == "A1") { DoorID newDoorID = DoorID.A1; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A2") { DoorID newDoorID = DoorID.A2; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A3") { DoorID newDoorID = DoorID.A3; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A4") { DoorID newDoorID = DoorID.A4; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A5") { DoorID newDoorID = DoorID.A5; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B1") { DoorID newDoorID = DoorID.B1; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B2") { DoorID newDoorID = DoorID.B2; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B3") { DoorID newDoorID = DoorID.B3; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B4") { DoorID newDoorID = DoorID.B4; newBadge.Doors.Add(newDoorID); } Console.WriteLine("Any other doors(y/n)?"); input = Console.ReadLine(); } if (_repo.CreateNewBadge(newBadgeID, newBadge.Doors)) { Console.WriteLine("New badge successfully created"); } else { Console.WriteLine("Could not create new badge."); } Console.Clear(); Menu(); }
public void AddDoorToBadge(int badge) { Badge newBadge = new Badge(); newBadge.Doors = new List <DoorID>(); int newBadgeID = badge; newBadge.BadgeID = newBadgeID; DoorID newDoorID = new DoorID(); Console.WriteLine("What door would you like to add to this badge?"); string newDoor = Console.ReadLine(); Console.WriteLine(newDoor); if (newDoor == "A1") { newDoorID = DoorID.A1; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A2") { newDoorID = DoorID.A2; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A3") { newDoorID = DoorID.A3; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A4") { newDoorID = DoorID.A4; newBadge.Doors.Add(newDoorID); } else if (newDoor == "A5") { newDoorID = DoorID.A5; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B1") { newDoorID = DoorID.B1; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B2") { newDoorID = DoorID.B2; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B3") { newDoorID = DoorID.B3; newBadge.Doors.Add(newDoorID); } else if (newDoor == "B4") { newDoorID = DoorID.B4; newBadge.Doors.Add(newDoorID); } bool wasAdded = _repo.AddDoorToBadge(newBadgeID, newDoorID); if (wasAdded) { Console.WriteLine("Door was added to badge"); } else { Console.WriteLine("No badge corresponds with the provided badge number."); } }