Esempio n. 1
0
        /// <summary>
        /// Add FIRST List For Example
        /// </summary>
        static void AddNEWListForExample()
        {
            LogicLayer.AddTeacher(new Teacher("Anders Hejlsberg", TypeTeacher.Docent));
            LogicLayer.AddStudent(new Student("Jone White", new Group("Group C#"), 25));
            LogicLayer.AddGroup(new Group("Group C#", new Teacher("Anders Hejlsberg", TypeTeacher.Docent)));

            LogicLayer.AddTeacher(new Teacher("James Arthur Gosling", TypeTeacher.Accictent));
            LogicLayer.AddStudent(new Student("Smith Red", new Group("Group Java"), 30));
            LogicLayer.AddGroup(new Group("Group Java", new Teacher("James Arthur Gosling", TypeTeacher.Accictent)));

            LogicLayer.AddTeacher(new Teacher("Tim Berners-Lee", TypeTeacher.Lector));
            LogicLayer.AddStudent(new Student("Dan Black", new Group("Group HTML"), 41));
            LogicLayer.AddGroup(new Group("Group HTML", new Teacher("Tim Berners-Lee", TypeTeacher.Lector)));
        }
Esempio n. 2
0
        /// <summary>
        /// Add FIRST List For Example
        /// </summary>
        static void AddNEWListForExample()
        {
            // магические числа в коде , сейчас мы знаем что означает 25 30 41 итд а через пол года вспомнишь ? выност в переменые\сетинги\константы с самодокументируемым названием
            LogicLayer.AddTeacher(new Teacher("Anders Hejlsberg", TypeTeacher.Docent));
            LogicLayer.AddStudent(new Student("Jone White", new Group("Group C#", new Teacher("Anders Hejlsberg", TypeTeacher.Docent)), 25));
            LogicLayer.AddGroup(new Group("Group C#", new Teacher("Anders Hejlsberg", TypeTeacher.Docent)));

            LogicLayer.AddTeacher(new Teacher("James Arthur Gosling", TypeTeacher.Accictent));
            LogicLayer.AddStudent(new Student("Smith Red", new Group("Group Java", new Teacher("James Arthur Gosling", TypeTeacher.Accictent)), 30));
            LogicLayer.AddGroup(new Group("Group Java", new Teacher("James Arthur Gosling", TypeTeacher.Accictent)));

            LogicLayer.AddTeacher(new Teacher("Tim Berners-Lee", TypeTeacher.Lector));
            LogicLayer.AddStudent(new Student("Dan Black", new Group("Group HTML", new Teacher("Tim Berners-Lee", TypeTeacher.Lector)), 41));
            LogicLayer.AddGroup(new Group("Group HTML", new Teacher("Tim Berners-Lee", TypeTeacher.Lector)));
        }
Esempio n. 3
0
        /// <summary>
        /// Add New Student
        /// </summary>
        private static void addNewStudent()
        {
            try
            {
                int    Age;
                string Name;
                Group  Group;

                //Name
                Console.Write("\t Write Name Student:");
                Name = Console.ReadLine();

                //Age
                bool pr = false;
                do
                {
                    Console.Write("\t Write Age:");
                    pr = int.TryParse(Console.ReadLine(), out Age);
                    if (Age <= 0)
                    {
                        pr = false;
                    }
                } while (!pr);

                //Group
                int index = 0;
                foreach (Group spw in LogicLayer.GetGroup)
                {
                    Console.WriteLine($"[{index++}] \t {spw.Id} \t {spw.Name} \t {spw.Teacher.Name} \t {spw.CountStudents}");
                }

                int NomerGroup;
                do
                {
                    Console.Write("\t Write Group №:");
                } while (!Int32.TryParse(Console.ReadLine(), out NomerGroup));

                LogicLayer.AddStudent(new Student(Name, Group._modelGroup[NomerGroup], Age));

                LogicLayer.AddGroupStudentsCount(NomerGroup);

                Console.WriteLine("\tSuccessfully");
            }
            catch (Exception e)
            {
                Console.WriteLine("\tError. Something went wrong!)", e.Message);
            }
        }