Пример #1
0
        private void DataList()
        {
            List <string> doorsOne = new List <string> {
                "A1", "A2", "B1", "B2"
            };
            List <string> doorsTwo = new List <string> {
                "C1", "C2", "D1", "D2"
            };
            Badge badge    = new Badge(101, doorsOne);
            Badge badgeTwo = new Badge(102, doorsTwo);

            _badgeRepo.AddBadge(101, badge);
            _badgeRepo.AddBadge(102, badgeTwo);
        }
Пример #2
0
        private void AddBadgeMenu()
        {
            List <string> doors = new List <string>();

            Console.WriteLine("What is the badge number?");
            int badge = int.Parse(Console.ReadLine());

            Console.WriteLine("List a door that badge should be able to access.");
            string doorAccess = Console.ReadLine();

            Console.WriteLine("Should any other doors be added to that badge (y/n?)");
            string answer = Console.ReadLine();

            if (answer == "y")
            {
                Console.WriteLine("List another door to add to that badge.");
            }

            if (answer == "n")
            {
                Console.WriteLine("Press any key to continue");
                Console.ReadKey();
            }
            _badgeRepository.AddBadge(badge, doors);
        }
Пример #3
0
        public void Run()
        {
            //Test data
            badgeRepo.AddBadge(new Badge(123, new List <string> {
                "A1", "A2", "A3"
            }));
            badgeRepo.AddBadge(new Badge(223, new List <string> {
                "B1", "B2"
            }));
            badgeRepo.AddBadge(new Badge(323, new List <string> {
                "C3"
            }));

            Console.WriteLine("Welcome, security admin.\n Enter 'a' to add a badge, 'v' to view badges, 'e' to edit a badge, or 'x' to exit.");
            while (running)
            {
                Console.Write("Make a selection: ");
                switch (Console.ReadLine().ToLower()[0])
                {
                case 'a':
                    AddBadgeMenu();
                    break;

                case 'v':
                    ShowAllBadgesMenu();
                    break;

                case 'e':
                    EditBadgeMenu();
                    break;

                case 'x':
                    running = false;
                    Console.WriteLine("Bye!");
                    break;

                default:
                    Console.WriteLine("Unrecognised command.");
                    break;
                }
            }

            Console.ReadLine();
        }