示例#1
0
文件: Program.cs 项目: Makarova13/Uni
        static void Main(string[] args)
        {
            int[] keys = { 100, 98, 46, 60, 90, 96 };

            //1
            LecturerCollection <string> c1 = new LecturerCollection <string>();
            LecturerCollection <string> c2 = new LecturerCollection <string>();

            c1.CollectionName = "collection1";
            c2.CollectionName = "collection2";

            //2
            Journal <string> journal = new Journal <string>();

            c1.LecturerChanged += journal.LecturerChanged;
            c2.LecturerChanged += journal.LecturerChanged;

            //3
            Lecturer lecturer1 = new Lecturer(new Person("Варя", "Ганьшина", new DateTime(1997, 10, 8)),
                                              "Кафедра математического обеспечения ЭВМ", Post.AssociateProfessor, keys[0]);
            Lecturer lecturer2 = new Lecturer(new Person("Саша", "Папирнык", new DateTime(2000, 10, 1)),
                                              "Кафедра вычислительной математики и математической кибернетики", Post.Professor, keys[1]);
            Lecturer lecturer3 = new Lecturer(new Person(),
                                              "Кафедра компьютерных технологий", Post.Professor, keys[2]);
            Lecturer lecturer4 = new Lecturer(new Person("Марк", "Мурашов", new DateTime(1999, 4, 30)),
                                              "Кафедра математического обеспечения ЭВМ", Post.Assistant, keys[3]);
            Lecturer lecturer5 = new Lecturer(new Person("Артем", "Косогов", new DateTime(2000, 5, 26)),
                                              "Кафедра компьютерных технологий", Post.Assistant, keys[4]);

            c1.AddLecturer(keys[0].ToString(), lecturer1);
            c1.AddLecturer(keys[1].ToString(), lecturer2);
            c1.AddLecturer(keys[2].ToString(), lecturer3);
            c1.AddLecturer(keys[3].ToString(), lecturer4);
            c1.AddLecturer(keys[4].ToString(), lecturer5);

            c2.AddLecturer("21", new Lecturer());

            c1.Remove(lecturer2);

            lecturer2.Department = "Kafedrarararara";
            lecturer1.Department = "Кафедраааааа";
            lecturer5.Lpost      = Post.AssociateProfessor;

            //4
            Console.WriteLine(journal);

            List <Lecturer> lecturers = new List <Lecturer>();
            string          res       = null;

            //5
            lecturers = c1.SoringDictionary();

            for (int i = 0; i < lecturers.Count; i++)
            {
                res += lecturers[i].ToShortString() + $"\nKey:{lecturers[i].Rating}\n\n";
            }

            Console.WriteLine(res);
            Console.ReadLine();
        }
示例#2
0
文件: Program.cs 项目: Makarova13/Uni
        public static List <Lecturer> SoringDictionary(this LecturerCollection <string> lecturerCollection)
        {
            var             temp      = new Lecturer();
            List <Lecturer> lecturers = lecturerCollection.LectDictionary.Values.ToList();

            lecturers.Sort((a, b) => a.Rating.CompareTo(b.Rating) * -1);
            return(lecturers);
        }