Exemplo n.º 1
0
        public void AddWrkGroupToCourse() //this method allow the creation of workgroup inside a course
        {
            Console.WriteLine("In order to create the group, you must add at least one student in a workgroup");
            Console.WriteLine("Note that if there is no student added to this group after its creation, it won't be saved. ");
            Console.WriteLine("type the name of the workGroup: ");
            string    name  = Console.ReadLine();
            WorkGroup group = new WorkGroup(name);

            allGroups.Add(group);
            Console.WriteLine();
        }
Exemplo n.º 2
0
        public List <WorkGroup> RebuildFromFiles(Database_Marks marks) //this function enables to rebuilt a course from a csv file.
        {
            List <List <string> > data           = marks.ReturnDatas();
            List <string>         workGroupName  = new List <string>(); //this list is temporary and used in order to create the correct wkgp and not 2x the same one
            List <WorkGroup>      everyWorkGroup = new List <WorkGroup>();

            foreach (List <string> personInfo in data)
            {
                if (workGroupName.Contains(personInfo[3]) == false)
                {
                    workGroupName.Add(personInfo[3]);
                    WorkGroup group = new WorkGroup(personInfo[3]);
                    try
                    {
                        if (personInfo[4] != null && personInfo[5] != null)
                        {
                            Teacher teacher = Program.GetPerson(personInfo[4], personInfo[5]) as Teacher;
                            group.professor = teacher;  //at this point, the workgroup and its teacher is generated
                        }
                    }
                    catch
                    {
                    }
                    everyWorkGroup.Add(group);
                }
                Person person = Program.GetPerson(personInfo[2]);
                {
                    if (person is Student)
                    {
                        Student student = person as Student;
                        foreach (WorkGroup wkgp in everyWorkGroup)
                        {
                            if (wkgp.name == personInfo[3])
                            {
                                wkgp.members.Add(student);    //at this point the student is added inside its workgroup
                                student.group.Add(wkgp);
                                student.courseList.Add(name); //the course is added to the student course list
                            }
                        }
                    }
                }
            }
            return(everyWorkGroup);   //should get the list of all WorkGroup in it
        }