コード例 #1
0
        static void Main(string[] args)
        {
            ResearchTeam pz  = new ResearchTeam("Family", "409 Production", 1234, TimeFrame.Year);
            ResearchTeam px  = new ResearchTeam("Help", "Me", 103, TimeFrame.Long);
            ResearchTeam pxx = new ResearchTeam("Help", "Me", 505, TimeFrame.Long);

            Paper[] newPapers =   //Список новых публикаций
            {
                new Paper("Goddess of Math", new Person(),        new DateTime(2015,                02, 02)),
                new Paper("FSB",             new Person("Alina",  "Ruchinskaya",     new DateTime(1999,   12, 03)), new DateTime(2017, 11, 06)),
                new Paper("Kotja",           new Person("Eugene", "Gerasimov",       new DateTime(2000,   01, 30)), new DateTime(2016, 03, 20))
            };
            Person[] newPerson =
            {
                new Person(),
                new Person("Alina", "Ruchinskaya",  new DateTime(1999, 12, 03)),
                new Person("Eugene","Gerasimov",    new DateTime(2000, 01, 30)),
                new Person("Lina",  "Antonenko",    new DateTime(2000, 07, 19))
            };

            pz.AddPapers(newPapers);  //Добавляем новые публикации и учасников
            pz.AddMembers(newPerson);
            ResearchTeamCollection <string> rtc1 = new ResearchTeamCollection <string>
            {
                CollectionName = "First collection"
            };
            ResearchTeamCollection <string> rtc2 = new ResearchTeamCollection <string>
            {
                CollectionName = "Second collection"
            };
            TeamsJournal <string> tg1 = new TeamsJournal <string>();

            rtc1.ResearchTeamsChanged += tg1.TeamChanged;  //подписка
            rtc2.ResearchTeamsChanged += tg1.TeamChanged;

            rtc1.AddDefaults("150"); // добавление элементов
            rtc2.AddResearchTeams("120", pxx);
            rtc1.AddResearchTeams("17", pz);
            rtc1.AddResearchTeams("188", px);
            rtc2.AddResearchTeams("18", px);
            rtc1.resTeam["17"].Topic = "NEW TOPIC";    //изменение отдельных свойств 1
            rtc2.resTeam["120"].Time = TimeFrame.Year; //2
            rtc2.Remove(px);                           // удаление 3
            px.Topic = "VERY NEW TOPIC";               //4
            rtc1.Replace(pz, pxx);                     //5
            pz.Time = TimeFrame.TwoYears;

            Console.WriteLine("TEAM JOURNAL:\n" + tg1.ToString());
            Console.WriteLine("Count of journals: " + rtc1.CountOfJournals(0, 2000));
            Console.ReadLine();
        }
コード例 #2
0
        public static void Main()
        {
            ResearchTeamCollection <string> firstCollection = new ResearchTeamCollection <string>(team => team.Name)
            {
                CollectionName = "FirstCollection"
            };
            ResearchTeamCollection <string> secondCollection = new ResearchTeamCollection <string>(team => team.Name)
            {
                CollectionName = "SecondCollection"
            };

            TeamsJournal <string> journal = new TeamsJournal <string>();

            firstCollection.ResearchTeamsChanged  += journal.ChangesEventController;
            secondCollection.ResearchTeamsChanged += journal.ChangesEventController;

            ResearchTeam tTeam1 = new ResearchTeam("First", "OAO", 1, "TSquad1", TimeFrame.Long);
            ResearchTeam tTeam2 = new ResearchTeam("Second", "OAO", 2, "TSquad2", TimeFrame.TwoYears);

            ResearchTeam tTeam3 = new ResearchTeam("Third", "PAR", 3, "Ppp1", TimeFrame.TwoYears);
            ResearchTeam tTeam4 = new ResearchTeam("Fourth", "PAR", 4, "Ppp2", TimeFrame.Long);

            firstCollection.AddResearchTeams(tTeam1, tTeam2);
            secondCollection.AddResearchTeams(tTeam3, tTeam4);

            tTeam1.ResearchName     = "New name";
            tTeam2.ResearchDuration = TimeFrame.Long;
            tTeam3.ResearchName     = "Reser Name123";
            tTeam4.ResearchDuration = TimeFrame.Year;

            firstCollection.Remove(tTeam2);
            secondCollection.Remove(tTeam4);

            tTeam2.ResearchDuration = TimeFrame.TwoYears;
            tTeam4.ResearchName     = "Old Research Name";

            firstCollection.Replace(tTeam1, tTeam3);
            tTeam1.ResearchName = "TTeam11 new ResName";

            Console.WriteLine(journal);
        }