public static void Main()
        {
            Personnel     personnel = new Personnel();
            string        path      = "text.txt";
            List <string> lines     = personnel.ReadFile(path);

            foreach (string l in lines)
            {
                Console.WriteLine(l);
            }
        }
        static void Main(string[] args)
        {
            // Create the teacher(s)
            Teacher teacher1 = new Teacher("bob", "123");
            Teacher teacher2 = new Teacher("Kent", "123");
            // Create the classroom(s)
            ClassRoom classA1 = new ClassRoom(teacher1, "A1");
            ClassRoom classA2 = new ClassRoom(teacher2, "A2");

            // Assign teacher to classroom(s)
            new ClassRoom(teacher2, "A2");
            // Create the student(s)
            new Student("elev", "123").AssignClassRoom(classA1);
            new Student("elev2", "123").AssignClassRoom(classA1);
            new Student("elev3", "123").AssignClassRoom(classA1);
            new Student("elev4", "123").AssignClassRoom(classA1);
            new Student("elev5", "123").AssignClassRoom(classA2);
            new Student("elev6", "123").AssignClassRoom(classA2);
            new Student("elev7", "123").AssignClassRoom(classA2);
            new Student("elev8", "123").AssignClassRoom(classA2);


            Console.WriteLine("Personnel Login");
            Personnel user;
            string    username;
            string    password;

            while (true)
            {
                // Get username
                Console.Write("USERNAME: "******"PASSWORD: "******"Incorrect username or password");
                }
            }

            // welcome message
            Console.WriteLine($"Welcome back {user.type} {user.username}");

            // Conditions if user is either student or teahcer
            if (user.type == Personnel.PersonnelTypes.Student)
            {
                // Menu
                Console.WriteLine("1. Print Student Infomation");
                Console.WriteLine("2. Quit");
                while (true)
                {
                    int input = MenuInput();
                    if (input == 2)
                    {
                        break;
                    }
                    switch (input)
                    {
                    case 1:
                        Console.WriteLine(user);
                        Console.WriteLine("You are in the following classrooms:");
                        foreach (var room in ClassRoom.classRooms)
                        {
                            if (room.students.Contains((Student)user))
                            {
                                Console.WriteLine(room);
                            }
                        }
                        break;

                    default:
                        Console.WriteLine("Not a valid option.");
                        break;
                    }
                }
            }
            else if (user.type == Personnel.PersonnelTypes.Teacher)
            {
                // Menu
                Console.WriteLine("1. Print Teacher Infomation");
                Console.WriteLine("2. Print Students In Class");
                Console.WriteLine("3. Quit");
                while (true)
                {
                    int input = MenuInput();
                    if (input == 3)
                    {
                        break;
                    }
                    switch (input)
                    {
                    case 1:
                        Console.WriteLine(user);
                        break;

                    case 2:
                        // cast to teacher class
                        var _ = (Teacher)user;
                        _.PrintStudents();

                        break;

                    default:
                        Console.WriteLine("Not a valid option.");
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Personnel personnel = new Personnel(connect);

            personnel.Show();
        }