예제 #1
0
        public static void ToFile(string directoryPath, Student student)
        {
            Directory.CreateDirectory(directoryPath);
            string path = directoryPath + student.DisplayName() + ".txt";

            FileWrapper.WriteToFile(student.Bulletin(), path);
        }
        public static void FromFile(string folderpath, Dictionary <string, Course> courses, Dictionary <string, Student> students)
        {
            foreach (string key in courses.Keys)
            {
                string        filePath     = folderpath + key + ".txt";
                List <string> studentNotes = FileWrapper.ReadFile(filePath);

                foreach (string line in studentNotes)
                {
                    string[] param = line.Split(';');
                    if (param.Length == 3)
                    {
                        Console.Write("_");
                        string studentKey = (param[0] + param[1]).ToUpper();
                        if (students.ContainsKey(studentKey))
                        {
                            Console.Write(".");
                            Student currentStudent = students[studentKey];
                            Course  currentCourse  = courses[key];

                            var new_eval = CoteOrApprec(param[2]);
                            currentCourse.AddEval(currentStudent, new_eval);
                            currentStudent.Add(currentCourse);
                        }
                    }
                }
            }
        }
        private static List <Tuple <Student, Teacher> > FromFile(string path)
        {
            List <string> myList = FileWrapper.ReadFile(path);
            List <Tuple <Student, Teacher> > people = new List <Tuple <Student, Teacher> >();

            foreach (string line in myList)
            {
                string[] param = line.Split(';');
                Tuple <Student, Teacher> newTuple = new Tuple <Student, Teacher>(CreatePerson.Student(param), CreatePerson.Teacher(param));
                if (newTuple.Item1 != null || newTuple.Item2 != null)
                {
                    people.Add(newTuple);
                }
            }

            return(people);
        }
        public static Dictionary <string, Course> FromFile(string path, Dictionary <string, Teacher> teacherDict)
        {
            List <string> myList = FileWrapper.ReadFile(path);
            Dictionary <string, Course> courseDict = new Dictionary <string, Course>();

            foreach (string line in myList)
            {
                string[] param        = line.Split(';');
                var      new_activity = CreateActivity.Activity(param, teacherDict);
                if (new_activity != null)
                {
                    Course new_course = new Course(new_activity);
                    courseDict.Add(new_course.DictKey(), new_course);
                }
            }

            return(courseDict);
        }
예제 #5
0
        static void Main(string[] args)
        {
            string rootPathPath   = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
            string configFilePath = rootPathPath + @"\config.ini";

            string globalPath = FileWrapper.ReadFile(configFilePath)[0];
            string notesPath  = globalPath + @"Notes\";
            string outputPath = globalPath + @"Output\";

            var myTeachers = CreateDictPeople.Teachers(globalPath + "Teachers.txt");
            var myStudents = CreateDictPeople.Students(globalPath + "Students.txt");
            var myCourses  = CreateDictCourse.FromFile(globalPath + "Activities.txt", myTeachers);

            LinkEvalToStudent.FromFile(notesPath, myCourses, myStudents);

            var HumanInterface = new Interface(myStudents, myCourses);

            while (HumanInterface.running)
            {
                HumanInterface.Display();
            }
        }