示例#1
0
        public void SetInfo()
        {
            //-------------------------------
            Write("Название обьединения : ");

            title = MainActions.GetCorrectString();

            //-------------------------------
            Write("Изучаемая область : ");

            studyArea = MainActions.GetCorrectString();
        }
示例#2
0
        public void SetInfo()
        {
            //------------------------------
            Write("Название : ");
            title = MainActions.GetCorrectString();

            //------------------------------
            Write("Год издания : ");
            year = MainActions.GetCorrectPositiveInt(1500, 2020);

            //------------------------------
            Write("Цена($) : ");
            price = MainActions.GetCorrectPositiveInt();
        }
示例#3
0
        public override void SetInfo()
        {
            base.SetInfo();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Стаж работы : ");
            workExperience = MainActions.GetCorrectPositiveInt(200);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Заработная плата($) : ");
            salary = MainActions.GetCorrectPositiveInt();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            WriteLine("Форма оплаты труда : ");
            formOfRemuneration = MainActions.ChoosenFormOfRemuneration();
        }
示例#4
0
        // Using delegate.
        public static void ShowAssociationParticipants()
        {
            int  ourID;
            bool flag = false;

            Show ourShowInfo;

            MainActions.ChoosenTypeOfAssociation(out TypeOfEntity ourTypeOfEntity);

            Write("Введите ID обьединения : ");

            ourID = MainActions.GetCorrectPositiveInt();

            switch (ourTypeOfEntity)
            {
            case TypeOfEntity.Student:
            {
                foreach (ScientificAssociation <Student> ourAssociation in ListOfAssociations.Journal)
                {
                    if (ourID == ourAssociation.AssociationID)
                    {
                        ourShowInfo = ourAssociation.ShowParticipants;
                        ourShowInfo?.Invoke();
                        flag = true;
                        break;
                    }
                }
            }
            break;

            case TypeOfEntity.Employee:
            {
                foreach (ScientificAssociation <Employee> ourAssociation in ListOfAssociations.Journal)
                {
                    if (ourID == ourAssociation.AssociationID)
                    {
                        ourAssociation.ShowParticipants();
                        flag = true;
                        break;
                    }
                }
            }
            break;
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Association, AmountOfEntities.One);
        }
示例#5
0
        public static void ShowAll()
        {
            bool flag = false;

            WriteLine(" (ID работника, Имя, Фамилия, Должность, Стаж) ");

            for (int i = 0; i < ActualNumberOfEmployees; i++)
            {
                if (journal[i] != null)
                {
                    MainActions.ShowEmployeeInfo(journal[i]);
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfPerson.Employee, AmountOfPersons.Several);
        }
示例#6
0
        public static void ShowAll()
        {
            bool flag = false;

            WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия, Успеваемость)");

            for (int i = 0; i < ActualNumberOfStudents; i++)
            {
                if (journal[i] != null)
                {
                    MainActions.ShowStudentInfo(journal[i]);
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Student, AmountOfEntities.Several);
        }
示例#7
0
        // Using delegate.
        public static void AddEmployee()
        {
            Employee ourEmployee;
            int      choice;

            WriteLine("\tВыберите один из возможных вариантов : ");
            WriteLine("\t1. Преподаватель");
            WriteLine("\t2. Администрация");
            WriteLine("\t3. Другое");

            Write("\tВвод : ");
            choice = MainActions.GetCorrectPositiveInt(1, 3);

            switch (choice)
            {
            case 1:
            {
                ourEmployee = new Teacher();
                Set ourSet = ourEmployee.SetInfo;
                ourSet?.Invoke();

                ListOfEmployees.Add(ourEmployee);
            }
            break;

            case 2:
            {
                ourEmployee = new Administration();
                Set ourSet = ourEmployee.SetInfo;
                ourSet?.Invoke();

                ListOfEmployees.Add(ourEmployee);
            }
            break;

            case 3:
            {
                ourEmployee = new OtherEmployees();
                Set ourSet = ourEmployee.SetInfo;
                ourSet?.Invoke();
                ListOfEmployees.Add(ourEmployee);
            }
            break;
            }
        }
示例#8
0
        public static void ShowAllBooks(List <Book> listOfBooks)
        {
            bool flag = false;

            WriteLine("( ID, title, year, price($) )");
            foreach (Book ourBook in listOfBooks.ToArray())
            {
                string tmp = ourBook.ToString("Standart", new CultureInfo("en-US"));
                WriteLine(tmp);
            }

            if (listOfBooks.Count != 0)
            {
                flag = true;
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Book, AmountOfEntities.Several);
        }
示例#9
0
        public static void RemoveBook(List <Book> listOfBooks)
        {
            Write("Введите ID книги : ");
            int ourBookID = MainActions.GetCorrectPositiveInt();

            bool flag = false;

            foreach (Book ourBook in listOfBooks.ToArray())
            {
                if (ourBook.BookID == ourBookID)
                {
                    listOfBooks.Remove(ourBook);
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Book, AmountOfEntities.One);
        }
示例#10
0
        public override void SetInfo()
        {
            base.SetInfo();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            WriteLine("Должность : ");
            WriteLine("выберите один из предложенных вариантов : ");

            for (int i = 0; i < JobsPositions[1].Length; i++)
            {
                WriteLine($"{i + 1}. " + JobsPositions[1][i]);
            }

            Write("\tВвод : ");
            jobPositionNumber = MainActions.GetCorrectPositiveInt(1, JobsPositions[1].Length);

            jobPosition = JobsPositions[1][jobPositionNumber - 1];
        }
示例#11
0
文件: Person.cs 项目: Miuroku/LabsCS
        public virtual void SetInfo()
        {
            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Имя : ");
            Name = MainActions.GetCorrectString();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Фамилия : ");
            Surname = MainActions.GetCorrectString();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Отчество : ");
            Patronymic = MainActions.GetCorrectString();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Write("Возраст : ");
            Age = MainActions.GetCorrectPositiveInt(15, 200);
        }
示例#12
0
        public static void FindStudentByID()
        {
            bool flag = false;
            int  ourID;

            Write("Введите ID студента: ");
            ourID = MainActions.GetCorrectPositiveInt();

            foreach (Student ourStudent in ListOfStudents.journal.ToArray())
            {
                if (ourStudent.PersonID == ourID)
                {
                    ourStudent.ShowInfo();
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfPerson.Student, AmountOfPersons.One);
        }
示例#13
0
        public static void FindEmployeeByID()
        {
            bool flag = false;
            int  ourID;

            Write("Введите ID сотрудника: ");
            ourID = MainActions.GetCorrectPositiveInt();

            foreach (Employee ourEmployee in ListOfEmployees.journal.ToArray())
            {
                if (ourEmployee.PersonID == ourID)
                {
                    ourEmployee.ShowInfo();
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfPerson.Employee, AmountOfPersons.One);
        }
示例#14
0
        public override void SetInfo()
        {
            base.SetInfo();   // Calling the base class SetInfo method;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Faculty = MainActions.ChoosenFaculty(out facultyNumber);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Specialty = MainActions.ChoosenSpecialty(facultyNumber);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Year = MainActions.ChoosenYear();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Group = MainActions.ChoosenGroup();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Progress = MainActions.ChoosenProgress();
        }
示例#15
0
        public static void RemoveEmployee()
        {
            bool flag = false;
            int  ourInputID;

            Write("Введите ID сотрудника : ");
            ourInputID = MainActions.GetCorrectPositiveInt();

            foreach (Employee ourEmployee in ListOfEmployees.Journal.ToArray()) //that's possible if List -> Array ... but for my new class it isn't necc
            {
                if (ourInputID == ourEmployee.PersonID)
                {
                    ListOfEmployees.Remove(ourEmployee);
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Employee, AmountOfEntities.One);
        }
示例#16
0
        public static void RemoveStudent()
        {
            bool flag = false;
            int  ourInputID;

            Write("Введите ID студента : ");
            ourInputID = MainActions.GetCorrectPositiveInt();

            // That's possible if List -> Array ... but for my new class it isn't necessary.
            foreach (Student ourStudent in ListOfStudents.journal.ToArray())
            {
                if (ourInputID == ourStudent.PersonID)
                {
                    ListOfStudents.Remove(ourStudent);
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfPerson.Student, AmountOfPersons.One);
        }
示例#17
0
        public override void SetInfo()
        {
            Move?.Invoke("Start set student info !\n");
            // Calling the base class SetInfo method.
            base.SetInfo();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Faculty = MainActions.ChoosenFaculty(out facultyNumber);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Specialty = MainActions.ChoosenSpecialty(facultyNumber);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Year = MainActions.ChoosenYear();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Group = MainActions.ChoosenGroup();

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Progress = MainActions.ChoosenProgress();
        }
示例#18
0
        public void ShowParticipants() //тут ошибка!
        {
            bool flag = false;

            WriteLine("(AssociationID, TypeOfAssociation, Title, StudyArea )");

            ShowInfo();

            if (typeOfEntity == TypeOfEntity.Student)
            {
                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия, Успеваемость)");
            }
            else if (typeOfEntity == TypeOfEntity.Employee)
            {
                WriteLine("(ID работника, Имя, Фамилия, Должность, Стаж)");
            }


            for (var i = 0; i < ActualNumberOfParticipants; i++)
            {
                if (membersArray[i] != null)
                {
                    if (typeOfEntity == TypeOfEntity.Student)
                    {
                        //Student ourStuedent = membersArray[i] as Student;
                        MainActions.ShowStudentInfo(membersArray[i] as Student);
                    }
                    else if (typeOfEntity == TypeOfEntity.Employee)
                    {
                        //Employee ourEmployee = membersArray[i] as Employee;
                        MainActions.ShowEmployeeInfo(membersArray[i] as Employee);
                    }

                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Student, AmountOfEntities.Several);
        }
示例#19
0
        public static void ShowBookInfo(List <Book> listOfBooks)
        {
            int  ourID;
            bool flag = false;

            Write("Введите ID книги : ");

            ourID = MainActions.GetCorrectPositiveInt();

            foreach (Book ourBook in listOfBooks.ToArray())
            {
                if (ourBook.BookID == ourID)
                {
                    string ourAnswer;
                    ourAnswer = ourBook.ToString("Full", new CultureInfo("en-US"));
                    WriteLine(ourAnswer);
                    flag = true;
                    break;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Book, AmountOfEntities.One);
        }
示例#20
0
        // Here i use delegate.
        public static void FindStudentByID()
        {
            bool flag = false;
            int  ourID;

            Show ourShowInfo;

            Write("Введите ID студента: ");
            ourID = MainActions.GetCorrectPositiveInt();

            foreach (Student ourStudent in ListOfStudents.Journal)
            {
                if (ourStudent.PersonID == ourID)
                {
                    ourStudent.Move += (ms) => WriteLine(ms);
                    ourShowInfo      = ourStudent.ShowInfo;
                    // Check for null and execute.
                    ourShowInfo?.Invoke();
                    flag = true;
                }
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Student, AmountOfEntities.One);
        }
示例#21
0
        static void Main(string[] args)
        {
            WriteLine("\t\t--------------BSUIR Students, employees and book List --------------");


            while (true)
            {
                int mainChoice;

GotoMainMenu:
                WriteLine("Menu:");
                WriteLine("1. Списки студентов");
                WriteLine("2. Списки сотрудников");
                WriteLine("3. Библиотека");
                WriteLine("4. Выход.");

                Write("\nВыберите пункт: ");
                mainChoice = MainActions.GetCorrectPositiveInt(1, 4);

                switch (mainChoice)
                {
                case 1:
                {
                    ListOfStudents listOfStudents = new ListOfStudents();

                    while (true)
                    {
                        int firstChoice;

                        WriteLine("Students Menu:");
                        WriteLine("1. Добавить студента");
                        WriteLine("2. Удалить студента");
                        WriteLine("3. Показать список студентов");
                        WriteLine("4. Найти студента по ID");
                        WriteLine("5. Вывести всех студентов с учетом успеваемости");
                        WriteLine("6. Вернуться в главное меню");
                        WriteLine("7. Выход.");

                        Write("\nВыберите пункт: ");
                        firstChoice = MainActions.GetCorrectPositiveInt(1, 7);

                        Write("\n");

                        switch (firstChoice)
                        {
                        case 1:
                        {
                            Student addedStudent = new Student();

                            addedStudent.SetInfo();

                            ListOfStudents.Add(addedStudent);
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveStudent();
                        }
                        break;

                        case 3:
                        {
                            int ourChoice3;

                            WriteLine("\tВыберите один из пунктов: ");
                            WriteLine("\t1. Показать всех студентов в университете");
                            WriteLine("\t2. Показать всех студентов факультета");
                            WriteLine("\t3. Показать всех студентов специальности");
                            WriteLine("\t4. Показать всех студентов группы");

                            Write("\tВвод : ");
                            ourChoice3 = MainActions.GetCorrectPositiveInt(1, 4);                 // in range from 1 to 4

                            switch (ourChoice3)
                            {
                            case 1:
                            {
                                ListOfStudents.ShowAll();
                            }
                            break;

                            case 2:
                            {
                                bool   flag = false;
                                string ourFaculty;
                                int    ourFacultyNumber;

                                ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                                {
                                    if (ourStudent.Faculty == ourFaculty)
                                    {
                                        MainActions.ShowStudentInfo(ourStudent);
                                        flag = true;
                                    }
                                }

                                MainActions.NoExistMassege(flag, TypeOfPerson.Student, AmountOfPersons.Several);
                            }
                            break;

                            case 3:
                            {
                                bool   flag = false;
                                string ourFaculty;
                                int    ourFacultyNumber;
                                string ourSpecialty;

                                ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                                ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                                {
                                    if (ourStudent.Specialty == ourSpecialty)
                                    {
                                        MainActions.ShowStudentInfo(ourStudent);
                                        flag = true;
                                    }
                                }

                                MainActions.NoExistMassege(flag, TypeOfPerson.Student, AmountOfPersons.Several);
                            }
                            break;

                            case 4:
                            {
                                bool   flag = false;
                                string ourFaculty;
                                int    ourFacultyNumber;
                                string ourSpecialty;
                                string ourGroup;
                                int    ourYear;

                                ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                                ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                                ourYear = MainActions.ChoosenYear();

                                ourGroup = MainActions.ChoosenGroup();

                                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                                {
                                    if (ourStudent.Group == ourGroup && ourStudent.Year == ourYear && ourStudent.Specialty == ourSpecialty)
                                    {
                                        MainActions.ShowStudentInfo(ourStudent);
                                        flag = true;
                                    }
                                }

                                MainActions.NoExistMassege(flag, TypeOfPerson.Student, AmountOfPersons.Several);
                            }
                            break;
                            }
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.FindStudentByID();
                        }
                        break;

                        case 5:
                        {
                            ListOfStudents.SortByProgress();
                            ListOfStudents.ShowAll();

                            if (ListOfStudents.ActualNumberOfStudents == 0)
                            {
                                WriteLine("( There is no any students )");
                            }
                        }
                        break;

                        case 6:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 7:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 2:
                {
                    while (true)
                    {
                        int secondChoice;

                        WriteLine("Employees Menu:");
                        WriteLine("1. Добавить сотрудника");
                        WriteLine("2. Удалить сотрудника");
                        WriteLine("3. Показать список сотрудников");
                        WriteLine("4. Найти сотрудника по ID");
                        WriteLine("5. Вывести всех сотрудников с учетом стажа работы");
                        WriteLine("6. Вернуться в главное меню");
                        WriteLine("7. Выход.");

                        Write("\nВыберите пункт: ");
                        secondChoice = MainActions.GetCorrectPositiveInt(1, 7);

                        switch (secondChoice)
                        {
                        case 1:
                        {
                            SwitchCaseActions.AddEmployee();
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveEmployee();
                        }
                        break;

                        case 3:
                        {
                            ListOfEmployees.ShowAll();
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.FindEmployeeByID();
                        }
                        break;

                        case 5:
                        {
                            ListOfEmployees.SortByWorkExperience();
                            ListOfEmployees.ShowAll();
                        }
                        break;

                        case 6:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 7:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 3:
                {
                    List <Book> listOfBooks = new List <Book>();

                    while (true)
                    {
                        int thirdChoice;

                        WriteLine("Libruary Menu : ");
                        WriteLine("1. Добавить книгу");
                        WriteLine("2. Удалить книгу");
                        WriteLine("3. Показать все книги");
                        WriteLine("4. В главное меню");
                        WriteLine("5. Выход.");

                        Write("Ввод : ");
                        thirdChoice = MainActions.GetCorrectPositiveInt(1, 5);

                        switch (thirdChoice)
                        {
                        case 1:
                        {
                            Book newBook = new Book(listOfBooks.Count);

                            newBook.SetInfo();

                            listOfBooks.Add(newBook);
                        }
                        break;

                        case 2:
                        {
                            Write("Введите ID книги : ");
                            int ourBookID = MainActions.GetCorrectPositiveInt();

                            bool flag = false;

                            foreach (Book ourBook in listOfBooks.ToArray())
                            {
                                if (ourBook.BookID == ourBookID)
                                {
                                    listOfBooks.Remove(ourBook);
                                    flag = true;
                                }
                            }

                            if (flag == false)
                            {
                                WriteLine("( There's no such book )");
                            }
                        }
                        break;

                        case 3:
                        {
                            bool flag = false;

                            WriteLine("( ID, title, year, price )");
                            foreach (Book ourBook in listOfBooks.ToArray())
                            {
                                ourBook.ShowInfo();
                                flag = true;
                            }

                            if (flag == false)
                            {
                                WriteLine("( There's no any book )");
                            }
                        }
                        break;

                        case 4:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 5:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 4:
                {
                    Environment.Exit(0);
                }
                break;
                }
            }
        }
示例#22
0
        public static void AddAssocation()
        {
            int amountOfParticipants;

            MainActions.ChoosenTypeOfAssociation(out TypeOfEntity ourTypeOfEntity);

            switch (ourTypeOfEntity)
            {
            case TypeOfEntity.Student:
            {
                ScientificAssociation <Student> ourAssociation =
                    new ScientificAssociation <Student>(TypeOfEntity.Student);

                ourAssociation.SetInfo();

                Write("Кол-во студентов(1-6) : ");

                amountOfParticipants = MainActions.GetCorrectPositiveInt(1, 6);

                for (int i = 0; i < amountOfParticipants; i++)
                {
                    int  ourID;
                    bool flag = false;

SomeException:
                    Write($"Введите ID студента №{i + 1} : ");

                    ourID = MainActions.GetCorrectPositiveInt();

                    foreach (Student ourStudent in ListOfStudents.Journal)
                    {
                        if (ourID == ourStudent.PersonID)
                        {
                            ourAssociation.Add(ourStudent);
                            flag = true;
                        }
                    }

                    MainActions.NoExistMassege(flag, TypeOfEntity.Student, AmountOfEntities.One);

                    if (flag == false)
                    {
                        goto SomeException;
                    }
                }

                ListOfAssociations.Add(ourAssociation);
            }
            break;

            case TypeOfEntity.Employee:
            {
                ScientificAssociation <Employee> ourAssociation =
                    new ScientificAssociation <Employee>(TypeOfEntity.Employee);

                ourAssociation.SetInfo();

                Write("Кол-во преподавателей(1-6) : ");

                amountOfParticipants = MainActions.GetCorrectPositiveInt(1, 6);

                for (int i = 0; i < amountOfParticipants; i++)
                {
                    int  ourID;
                    bool flag = false;

SomeException:
                    Write($"Введите ID преподавателя №{i + 1} : ");

                    ourID = MainActions.GetCorrectPositiveInt();

                    foreach (Employee ourEmployee in ListOfEmployees.Journal)
                    {
                        if (ourID == ourEmployee.PersonID)
                        {
                            ourAssociation.Add(ourEmployee);
                            flag = true;
                        }
                    }

                    MainActions.NoExistMassege(flag, TypeOfEntity.Employee, AmountOfEntities.One);
                    if (flag == false)
                    {
                        goto SomeException;
                    }
                }

                ListOfAssociations.Add(ourAssociation);
            }
            break;
            }
        }
示例#23
0
        public static void ShowAll(UniversityElements ourElement)
        {
            bool   flag = false;
            string ourFaculty;
            int    ourFacultyNumber;

            ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

            switch (ourElement)
            {
            case UniversityElements.Faculty:
            {
                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                {
                    if (ourStudent.Faculty == ourFaculty)
                    {
                        MainActions.ShowStudentInfo(ourStudent);
                        flag = true;
                    }
                }
            }
            break;

            case UniversityElements.Specialty:
            {
                string ourSpecialty;

                ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                {
                    if (ourStudent.Specialty == ourSpecialty)
                    {
                        MainActions.ShowStudentInfo(ourStudent);
                        flag = true;
                    }
                }
            }
            break;

            case UniversityElements.Group:
            {
                string ourSpecialty;
                string ourGroup;
                int    ourYear;

                ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                ourYear = MainActions.ChoosenYear();

                ourGroup = MainActions.ChoosenGroup();

                WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                {
                    if (ourStudent.Group == ourGroup && ourStudent.Year == ourYear && ourStudent.Specialty == ourSpecialty)
                    {
                        MainActions.ShowStudentInfo(ourStudent);
                        flag = true;
                    }
                }
            }
            break;
            }

            MainActions.NoExistMassege(flag, TypeOfEntity.Student, AmountOfEntities.Several);
        }
示例#24
0
        static void Main(string[] args)
        {
            WriteLine("\t\t--------------BSUIR Students, employees and book List --------------");

            while (true)
            {
                int mainChoice;

GotoMainMenu:
                Clear();
                WriteLine("Menu:");
                WriteLine("1. Списки студентов");
                WriteLine("2. Списки сотрудников");
                WriteLine("3. Библиотека");
                WriteLine("4. Научные обьединения");
                WriteLine("5. Выход.");

                Write("\nВыберите пункт: ");
                mainChoice = MainActions.GetCorrectPositiveInt(1, 5);
                // Clear console.
                Clear();

                switch (mainChoice)
                {
                case 1:
                {
                    ListOfStudents listOfStudents = new ListOfStudents();

                    while (true)
                    {
                        int firstChoice;

                        WriteLine("Students Menu:");
                        WriteLine("1. Добавить студента");
                        WriteLine("2. Удалить студента");
                        WriteLine("3. Показать список студентов");
                        WriteLine("4. Найти студента по ID");
                        WriteLine("5. Вывести всех студентов с учетом успеваемости");
                        WriteLine("6. Вернуться в главное меню");
                        WriteLine("7. Выход.");

                        Write("\nВыберите пункт: ");
                        firstChoice = MainActions.GetCorrectPositiveInt(1, 7);

                        Write("\n");

                        switch (firstChoice)
                        {
                        case 1:
                        {
                            SwitchCaseActions.AddStudent();
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveStudent();
                        }
                        break;

                        case 3:
                        {
                            int ourChoice3;

                            WriteLine("\tВыберите один из пунктов: ");
                            WriteLine("\t1. Показать всех студентов в университете");
                            WriteLine("\t2. Показать всех студентов факультета");
                            WriteLine("\t3. Показать всех студентов специальности");
                            WriteLine("\t4. Показать всех студентов группы");

                            Write("\tВвод : ");
                            ourChoice3 = MainActions.GetCorrectPositiveInt(1, 4);

                            switch (ourChoice3)
                            {
                            case 1:
                            {
                                ListOfStudents.ShowAll();
                            }
                            break;

                            case 2:
                            {
                                ListOfStudents.ShowAll(UniversityElements.Faculty);
                            }
                            break;

                            case 3:
                            {
                                ListOfStudents.ShowAll(UniversityElements.Specialty);
                            }
                            break;

                            case 4:
                            {
                                ListOfStudents.ShowAll(UniversityElements.Group);
                            }
                            break;
                            }
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.FindStudentByID();
                        }
                        break;

                        case 5:
                        {
                            // Increase or Decrease.
                            SwitchCaseActions.SortAndShowStudents();
                        }
                        break;

                        case 6:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 7:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 2:
                {
                    while (true)
                    {
                        int secondChoice;

                        WriteLine("Employees Menu:");
                        WriteLine("1. Добавить сотрудника");
                        WriteLine("2. Удалить сотрудника");
                        WriteLine("3. Показать список сотрудников");
                        WriteLine("4. Найти сотрудника по ID");
                        WriteLine("5. Вывести всех сотрудников с учетом стажа работы");
                        WriteLine("6. Вернуться в главное меню");
                        WriteLine("7. Выход.");

                        Write("\nВыберите пункт: ");
                        secondChoice = MainActions.GetCorrectPositiveInt(1, 7);

                        switch (secondChoice)
                        {
                        case 1:
                        {
                            SwitchCaseActions.AddEmployee();
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveEmployee();
                        }
                        break;

                        case 3:
                        {
                            ListOfEmployees.ShowAll();
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.FindEmployeeByID();
                        }
                        break;

                        case 5:
                        {
                            // Increase or Decrease.
                            SwitchCaseActions.SortAndShowEmployees();
                        }
                        break;

                        case 6:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 7:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 3:
                {
                    List <Book> listOfBooks = new List <Book>();

                    while (true)
                    {
                        int thirdChoice;

                        WriteLine("Libruary Menu : ");
                        WriteLine("1. Добавить книгу");
                        WriteLine("2. Удалить книгу");
                        WriteLine("3. Показать все книги");
                        WriteLine("4. Показать информацию о книге");
                        WriteLine("5. В главное меню");
                        WriteLine("6. Выход.");

                        Write("Ввод : ");
                        thirdChoice = MainActions.GetCorrectPositiveInt(1, 6);

                        switch (thirdChoice)
                        {
                        case 1:
                        {
                            SwitchCaseActions.AddBook(listOfBooks);
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveBook(listOfBooks);
                        }
                        break;

                        case 3:
                        {
                            SwitchCaseActions.ShowAllBooks(listOfBooks);
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.ShowBookInfo(listOfBooks);
                        }
                        break;

                        case 5:
                        {
                            goto GotoMainMenu;
                        }
                        //break;

                        case 6:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 4:
                {
                    while (true)
                    {
                        int fourthChoice;

                        WriteLine("Association Menu : ");
                        WriteLine("1. Добавить обьединнение");
                        WriteLine("2. Удалить обьединение");
                        WriteLine("3. Вывести все обьединения");
                        WriteLine("4. Вывести участников обьединения ");
                        WriteLine("5. Вернуться в главное меню");
                        WriteLine("6. Выход.");

                        Write("\nВыберите пункт: ");

                        fourthChoice = MainActions.GetCorrectPositiveInt(1, 6);

                        switch (fourthChoice)
                        {
                        case 1:
                        {
                            SwitchCaseActions.AddAssocation();
                        }
                        break;

                        case 2:
                        {
                            SwitchCaseActions.RemoveAssociation();
                        }
                        break;

                        case 3:
                        {
                            ListOfAssociations.ShowAll();
                        }
                        break;

                        case 4:
                        {
                            SwitchCaseActions.ShowAssociationParticipants();
                        }
                        break;

                        case 5:
                        {
                            goto GotoMainMenu;
                        }
                        break;

                        case 6:
                        {
                            Environment.Exit(0);
                        }
                        break;
                        }
                    }
                }
                break;

                case 5:
                {
                    Environment.Exit(0);
                }
                break;
                }
            }
        }
示例#25
0
        static void Main(string[] args)
        {
            WriteLine("\t\t--------------BSUIR Students List --------------");

            ListOfStudents listOfStudents = new ListOfStudents();

            while (true)
            {
                int choice;

                WriteLine("Menu:");
                WriteLine("1. Добавить студента");
                WriteLine("2. Удалить студента");
                WriteLine("3. Показать список студентов");
                WriteLine("4. Найти студента по ID");
                WriteLine("5. Вывести всех студентов с учетом успеваемости");
                WriteLine("6. Выход.");

                Write("\nВыберите пункт: ");
                choice = MainActions.GetCorrectPositiveInt(1, 6);

                Write("\n");

                switch (choice)
                {
                case 1:
                {
                    Student addedStudent = new Student();

                    addedStudent.SetInfo();

                    listOfStudents.Add(addedStudent);
                }
                break;

                case 2:
                {
                    bool flag = false;
                    int  ourInputID;

                    Write("Введите ID студента : ");
                    ourInputID = MainActions.GetCorrectPositiveInt();

                    foreach (Student ourStudent in ListOfStudents.journal.ToArray())          //that's possible if List -> Array ... but for my new class it isn't necc
                    {
                        if (ourInputID == ourStudent.PersonID)
                        {
                            listOfStudents.Remove(ourStudent);
                            flag = true;
                        }
                    }

                    MainActions.NotExistMassege(flag);
                }
                break;

                case 3:
                {
                    int ourChoice3;

                    WriteLine("\tВыберите один из пунктов: ");
                    WriteLine("\t1. Показать всех студентов в университете");
                    WriteLine("\t2. Показать всех студентов факультета");
                    WriteLine("\t3. Показать всех студентов специальности");
                    WriteLine("\t4. Показать всех студентов группы");

                    Write("\tВвод : ");
                    ourChoice3 = MainActions.GetCorrectPositiveInt(1, 4);        // in range from 1 to 4

                    switch (ourChoice3)
                    {
                    case 1:
                    {
                        bool flag = false;

                        WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                        foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                        {
                            if (ourStudent != null)
                            {
                                MainActions.ShowStudentInfo(ourStudent);
                                flag = true;
                            }
                        }

                        MainActions.NotExistMassege(flag);
                    }
                    break;

                    case 2:
                    {
                        bool   flag = false;
                        string ourFaculty;
                        int    ourFacultyNumber;

                        ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                        WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                        foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                        {
                            if (ourStudent.Faculty == ourFaculty)
                            {
                                MainActions.ShowStudentInfo(ourStudent);
                                flag = true;
                            }
                        }

                        MainActions.NotExistMassege(flag);
                    }
                    break;

                    case 3:
                    {
                        bool   flag = false;
                        string ourFaculty;
                        int    ourFacultyNumber;
                        string ourSpecialty;

                        ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                        ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                        WriteLine("(ID студента, Факультет, Группа, Имя, Фамилия)");

                        foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                        {
                            if (ourStudent.Specialty == ourSpecialty)
                            {
                                MainActions.ShowStudentInfo(ourStudent);
                                flag = true;
                            }
                        }

                        MainActions.NotExistMassege(flag);
                    }
                    break;

                    case 4:
                    {
                        bool   flag = false;
                        string ourFaculty;
                        int    ourFacultyNumber;
                        string ourSpecialty;
                        string ourGroup;
                        int    ourYear;

                        ourFaculty = MainActions.ChoosenFaculty(out ourFacultyNumber);

                        ourSpecialty = MainActions.ChoosenSpecialty(ourFacultyNumber);

                        ourYear = MainActions.ChoosenYear();

                        ourGroup = MainActions.ChoosenGroup();

                        foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                        {
                            if (ourStudent.Group == ourGroup && ourStudent.Year == ourYear && ourStudent.Specialty == ourSpecialty)
                            {
                                MainActions.ShowStudentInfo(ourStudent);
                                flag = true;
                            }
                        }

                        MainActions.NotExistMassege(flag);
                    }
                    break;
                    }
                }
                break;

                case 4:
                {
                    bool flag = false;
                    int  ourID;

                    Write("Введите ID студента: ");
                    ourID = MainActions.GetCorrectPositiveInt();

                    foreach (Student ourStudent in ListOfStudents.journal.ToArray())
                    {
                        if (ourStudent.PersonID == ourID)
                        {
                            ourStudent.ShowInfo();
                            flag = true;
                        }
                    }

                    MainActions.NotExistMassege(flag);
                }
                break;

                case 5:
                {
                    listOfStudents.SortByProgress();
                    listOfStudents.ShowAll();

                    if (ListOfStudents.ActualNumberOfStudents == 0)
                    {
                        WriteLine("( There is no any students )");
                    }
                }
                break;

                case 6:
                {
                    Environment.Exit(0);
                }
                break;
                }
            }
        }