Ejemplo n.º 1
0
 public void Update()
 {
     if (Decanat.Instance().Forgotters.ContainsKey(this.Name))
     {
         foreach (var teacher in Decanat.Instance().Forgotters[this.Name])
         {
             if (BadTeachers.ContainsKey(StudyWeek.Instance().Num))
             {
                 BadTeachers[StudyWeek.Instance().Num].Add(teacher);
             }
             else
             {
                 BadTeachers.Add(StudyWeek.Instance().Num, new List <Teacher>());
                 BadTeachers[StudyWeek.Instance().Num].Add(teacher);
             }
         }
     }
     else
     {
         BadTeachers.Add(StudyWeek.Instance().Num, new List <Teacher>());
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            List <Teacher> teachers = new List <Teacher>()
            {
                new Teacher("Teach1"),
                new Teacher("Teach2"),
                new Teacher("Teach3")
            };

            foreach (var teacher in teachers)
            {
                StudyWeek.Instance().AddObserver(teacher);
            }

            List <Cathedra> cathedras = new List <Cathedra>()
            {
                new Cathedra("Cth1", new List <Teacher>()
                {
                    teachers[0], teachers[1]
                }),
                new Cathedra("Cth2", new List <Teacher>()
                {
                    teachers[1], teachers[2]
                })
            };

            AchievementState achievementsStats = AchievementState.Instance();

            List <Discipline> disciplines = new List <Discipline>()
            {
                new Discipline("d1", cathedras[0], teachers[0])
                {
                    Groups = new List <string>()
                    {
                        "G1", "G2"
                    }
                },
                new Discipline("d2", cathedras[0], teachers[1])
                {
                    Groups = new List <string>()
                    {
                        "G3", "G2"
                    }
                },
                new Discipline("d3", cathedras[1], teachers[1])
                {
                    Groups = new List <string>()
                    {
                        "G4", "G3"
                    }
                },
                new Discipline("d4", cathedras[1], teachers[2])
                {
                    Groups = new List <string>()
                    {
                        "G1", "G4"
                    }
                }
            };

            achievementsStats.Disciplines.AddRange(disciplines);

            //achievementsStats.AddObserver(Decanat.Instance());
            StudyWeek.Instance().AddObserver(Decanat.Instance());
            foreach (var cathedra in cathedras)
            {
                Decanat.Instance().AddObserver(cathedra);
            }


            StudyWeek.Instance().NewWeek();
            while (!StudyWeek.Instance().IsSession)
            {
                //show info about current week achievements
                Console.WriteLine(achievementsStats.Info(StudyWeek.Instance().Num));
                //show info message for current week for all cathedras
                Console.WriteLine($"Bad teaqchers on {StudyWeek.Instance().Num}th week:");
                foreach (var cathedra in cathedras)
                {
                    Console.WriteLine(cathedra.MesInfo(StudyWeek.Instance().Num));
                }
                Console.WriteLine();

                //new week begin
                StudyWeek.Instance().NewWeek();
            }

            Console.ReadKey();
        }