예제 #1
0
        //CSV FILE OPENING AND GETTING USER DATA

        static void CreationFullList(List <Student> StudentList, List <Teacher> TeacherList, List <Admin> AdminList)
        {
            List <User>      FullList      = new List <User>();
            List <Classroom> ClassroomList = new List <Classroom>();
            List <Student>   listclassA    = new List <Student>();
            List <Student>   listclassB    = new List <Student>();
            List <Student>   listclassC    = new List <Student>();
            List <Class>     classesA      = new List <Class>();
            List <Class>     classesB      = new List <Class>();
            List <Class>     classesC      = new List <Class>();
            TimeTable        timetableA    = new TimeTable(classesA);
            TimeTable        timetableB    = new TimeTable(classesB);
            TimeTable        timetableC    = new TimeTable(classesC);

            Classroom classA = new Classroom("A", listclassA, timetableA);

            ClassroomList.Add(classA);
            //classA.Timetable = timetableA;

            Classroom classB = new Classroom("B", listclassB, timetableB);

            ClassroomList.Add(classB);
            //classB.Timetable = timetableB;

            Classroom classC = new Classroom("C", listclassC, timetableC);

            ClassroomList.Add(classC);
            //classC.Timetable = timetableC;

            string[] linestudent = System.IO.File.ReadAllLines("StudentList.csv");
            foreach (string line in linestudent)
            {
                string[] columns       = line.Split(';');
                string   name          = columns[0];
                string   classroomname = columns[1];
                string   id            = columns[2];
                string   password      = columns[3];


                if (classroomname == "A")
                {
                    List <Class>  noattendance = new List <Class>();
                    List <string> profil       = new List <string>();
                    List <Grade>  listgrade    = new List <Grade>();
                    Student       s            = new Student(name, classA, profil, listgrade, 8900, id, password, "Student");
                    s.Nonattendance = noattendance;
                    classA.Classroomlist.Add(s);
                    StudentList.Add(s);
                    FullList.Add(s);
                }
                else if (classroomname == "B")
                {
                    List <Class>  noattendance = new List <Class>();
                    List <string> profil       = new List <string>();
                    List <Grade>  listgrade    = new List <Grade>();
                    Student       s            = new Student(name, classB, profil, listgrade, 8900, id, password, "Student");
                    s.Nonattendance = noattendance;
                    classB.Classroomlist.Add(s);
                    StudentList.Add(s);
                    FullList.Add(s);
                }
                else if (classroomname == "C")
                {
                    List <Class>  noattendance = new List <Class>();
                    List <string> profil       = new List <string>();
                    List <Grade>  listgrade    = new List <Grade>();
                    Student       s            = new Student(name, classC, profil, listgrade, 8900, id, password, "Student");
                    s.Nonattendance = noattendance;
                    classC.Classroomlist.Add(s);
                    StudentList.Add(s);
                    FullList.Add(s);
                }
                else
                {
                    Console.WriteLine("The class was not found");
                }
            }
            string[] lineteacher = System.IO.File.ReadAllLines("TeacherList.csv");
            foreach (string linet in lineteacher)
            {
                string[] columnsteacher  = linet.Split(';');
                string   nameteacher     = columnsteacher[0];
                string   matter          = columnsteacher[1];
                string   idteacher       = columnsteacher[2];
                string   passwordteacher = columnsteacher[3];

                if (matter == "Mathematics")
                {
                    Teacher t = new Teacher(nameteacher, ClassroomList, Matter.mathematics, idteacher, passwordteacher, "Teacher");
                    TeacherList.Add(t);
                    FullList.Add(t);

                    Date   DateClassroomA     = new Date("Monday", 12);
                    string locationClassroomA = "E106";
                    Class  ClassClassroomA    = new Class(DateClassroomA, Matter.mathematics, locationClassroomA, t);
                    classesA.Add(ClassClassroomA);

                    Date   DateClassroomB     = new Date("Tuesday", 9);
                    string locationClassroomB = "E512";
                    Class  ClassClassroomB    = new Class(DateClassroomB, Matter.mathematics, locationClassroomB, t);
                    classesB.Add(ClassClassroomB);

                    Date   DateClassroomC     = new Date("Monday", 9);
                    string locationClassroomC = "L420";
                    Class  ClassClassroomC    = new Class(DateClassroomC, Matter.mathematics, locationClassroomC, t);
                    classesC.Add(ClassClassroomC);
                }
                else if (matter == "French")
                {
                    Teacher t = new Teacher(nameteacher, ClassroomList, Matter.french, idteacher, passwordteacher, "Teacher");
                    TeacherList.Add(t);
                    FullList.Add(t);

                    Date   DateClassroomA     = new Date("Monday", 15);
                    string locationClassroomA = "L106";
                    Class  ClassClassroomA    = new Class(DateClassroomA, Matter.french, locationClassroomA, t);
                    classesA.Add(ClassClassroomA);

                    Date   DateClassroomB     = new Date("Friday", 9);
                    string locationClassroomB = "E512";
                    Class  ClassClassroomB    = new Class(DateClassroomB, Matter.french, locationClassroomB, t);
                    classesB.Add(ClassClassroomB);

                    Date   DateClassroomC     = new Date("Friday", 15);
                    string locationClassroomC = "L420";
                    Class  ClassClassroomC    = new Class(DateClassroomC, Matter.french, locationClassroomC, t);
                    classesC.Add(ClassClassroomC);
                }
                else if (matter == "Physics")
                {
                    Teacher t = new Teacher(nameteacher, ClassroomList, Matter.physics, idteacher, passwordteacher, "Teacher");
                    TeacherList.Add(t);
                    FullList.Add(t);

                    Date   DateClassroomA     = new Date("Tuesday", 9);
                    string locationClassroomA = "E106";
                    Class  ClassClassroomA    = new Class(DateClassroomA, Matter.physics, locationClassroomA, t);
                    classesA.Add(ClassClassroomA);

                    Date   DateClassroomB     = new Date("Tuesday", 12);
                    string locationClassroomB = "E512";
                    Class  ClassClassroomB    = new Class(DateClassroomB, Matter.physics, locationClassroomB, t);
                    classesB.Add(ClassClassroomB);

                    Date   DateClassroomC     = new Date("Tuesday", 9);
                    string locationClassroomC = "L420";
                    Class  ClassClassroomC    = new Class(DateClassroomC, Matter.physics, locationClassroomC, t);
                    classesC.Add(ClassClassroomC);
                }
                else if (matter == "Litterature")
                {
                    Teacher t = new Teacher(nameteacher, ClassroomList, Matter.litterarenglish, idteacher, passwordteacher, "Teacher");
                    TeacherList.Add(t);
                    FullList.Add(t);

                    Date   DateClassroomA     = new Date("Tuesday", 13);
                    string locationClassroomA = "E106";
                    Class  ClassClassroomA    = new Class(DateClassroomA, Matter.litterarenglish, locationClassroomA, t);
                    classesA.Add(ClassClassroomA);

                    Date   DateClassroomB     = new Date("Wednesday", 9);
                    string locationClassroomB = "E512";
                    Class  ClassClassroomB    = new Class(DateClassroomB, Matter.litterarenglish, locationClassroomB, t);
                    classesB.Add(ClassClassroomB);

                    Date   DateClassroomC     = new Date("Tuesday", 12);
                    string locationClassroomC = "L420";
                    Class  ClassClassroomC    = new Class(DateClassroomC, Matter.litterarenglish, locationClassroomC, t);
                    classesC.Add(ClassClassroomC);
                }
                else if (matter == "Sport")
                {
                    Teacher t = new Teacher(nameteacher, ClassroomList, Matter.sport, idteacher, passwordteacher, "Teacher");
                    TeacherList.Add(t);
                    FullList.Add(t);

                    Date   DateClassroomA     = new Date("Wednesday", 15);
                    string locationClassroomA = "E106";
                    Class  ClassClassroomA    = new Class(DateClassroomA, Matter.sport, locationClassroomA, t);
                    classesA.Add(ClassClassroomA);

                    Date   DateClassroomB     = new Date("Wednesday", 12);
                    string locationClassroomB = "E512";
                    Class  ClassClassroomB    = new Class(DateClassroomB, Matter.sport, locationClassroomB, t);
                    classesB.Add(ClassClassroomB);

                    Date   DateClassroomC     = new Date("Thursday", 15);
                    string locationClassroomC = "L420";
                    Class  ClassClassroomC    = new Class(DateClassroomC, Matter.sport, locationClassroomC, t);
                    classesC.Add(ClassClassroomC);
                }
                else
                {
                    Console.WriteLine("The matter was not found");
                }
            }
            string[] lineadmin = System.IO.File.ReadAllLines("AdminList.csv");
            foreach (string linea in lineadmin)
            {
                string[] columnsadmin  = linea.Split(';');
                string   nameadmin     = columnsadmin[0];
                string   idadmin       = columnsadmin[1];
                string   passwordadmin = columnsadmin[2];
                Admin    a             = new Admin(nameadmin, idadmin, passwordadmin, "Admin");
                AdminList.Add(a);
                FullList.Add(a);
                a.StudentFullList    = StudentList;
                a.TeacherFullList    = TeacherList;
                a.ClassroomsFullList = ClassroomList;
            }

            /*foreach (Student s in StudentList)
             * {
             *  Console.WriteLine(s);
             * }
             * foreach (Teacher t in TeacherList)
             * {
             *  Console.WriteLine(t);
             * }
             * foreach (Admin a in AdminList)
             * {
             *  Console.WriteLine(a);
             * }
             * foreach(User u in FullList)
             * {
             *
             *  Console.WriteLine($"+ {u}");
             * }*/
        }
예제 #2
0
 public Classroom(string name, List <Student> classroomlist, TimeTable timetable)
 {
     Name          = name;
     Classroomlist = classroomlist;
     Timetable     = timetable;
 }