Пример #1
0
        public void Update()
        {
            /*Forgotters.Clear();
             * var disciplines = AchievementState.Instance().Disciplines;
             * if (disciplines != null)
             *  foreach (var discipline in disciplines.Where(x =>
             *      x.Achievements.Count != x.Groups.Count))
             *  {
             *      Forgotters.Add(discipline.TeacherCurator);
             *  }
             */
            Forgotters.Clear();
            var disciplines = AchievementState.Instance().Disciplines;

            foreach (var discipline in disciplines /*.Where(x => x == x.Achievements.Where(y => y.Marks.Count == 0))*/)
            {
                if (discipline.Achievements.Where(x => x.Week == StudyWeek.Instance().Num).FirstOrDefault <Achievement>()?.Marks.Count == 0)
                {
                    if (Forgotters.ContainsKey(discipline.CathedraCurator.Name))
                    {
                        Forgotters[discipline.CathedraCurator.Name].Add(discipline.TeacherCurator);
                    }
                    else
                    {
                        Forgotters[discipline.CathedraCurator.Name] = new List <Teacher>();
                        Forgotters[discipline.CathedraCurator.Name].Add(discipline.TeacherCurator);
                    }
                }
            }

            NotifyObservers();
        }
Пример #2
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="o">preferably as study week</param>
        public void Update()
        {
            var disciplines = AchievementState.Instance().Disciplines.Where(x => x.TeacherCurator.Fio.Equals(this.Fio));

            foreach (var discipline in disciplines)
            {
                AchievementState.Instance().AddRecord(
                    discipline,
                    new Achievement().CreateAchievements(
                        StudyWeek.Instance().Num,
                        discipline.Groups
                        )
                    );
            }
        }
 public static AchievementState Instance()
 {
     return(_instance ?? (_instance = new AchievementState()));
 }
Пример #4
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();
        }