Beispiel #1
0
        public void EditByIndex(int index)
        {
            int day;
            int month;
            int year;

            char choice = 'a';

            Io.PrintPropertyList();
            choice = Io.InputChar();

            switch (choice)
            {
            case '1':
                Console.Write("Last name: ");
                _students[index].LastName = Io.InputName();
                break;

            case '2':
                Console.Write("First name: ");
                _students[index].FirstName = Io.InputName();
                break;

            case '3':
                Console.Write("Patronymic: ");
                _students[index].Patronymic = Io.InputName();
                break;

            case '4':
                Console.Write("BirthDay: ");
                day = Io.InputInt();
                Console.Write("BirthMonth: ");
                month = Io.InputInt();
                Console.Write("BirthYear: ");
                year = Io.InputInt();
                _students[index].BirthDate = new DateTime(year, month, day);
                break;

            case '5':
                Console.Write("EnterDay: ");
                day = Io.InputInt();
                Console.Write("EnterMonth: ");
                month = Io.InputInt();
                Console.Write("EnterYear: ");
                year = Io.InputInt();
                _students[index].EnterDate = new DateTime(year, month, day);
                break;

            case '6':
                Console.Write("Group index: ");
                _students[index].GroupIndex = Io.InputChar();
                break;

            case '7':
                Console.Write("Faculty: ");
                _students[index].Faculty = Io.InputName();
                break;

            case '8':
                Console.Write("Specialization: ");
                _students[index].Specialization = Io.InputName();
                break;

            case '9':
                Console.Write("Performance: ");
                _students[index].Performance = Io.InputDouble();
                break;
            }
        }
Beispiel #2
0
        public static void Start()
        {
            const string path   = @"C:\Users\Дмитрий Соколенко\source\repos\DotNet\sokolenko03DN\file.txt";
            var          pigsty = new StudentContainer();
            char         choice = 'a';

            Console.WriteLine("Hello World! Our copany introduces the next level of data base - AllBase");
            Console.WriteLine("The array of Student object is created, my lord.");

            Io.ReadStContainerFromFile(path, pigsty);

            while (choice != '0')
            {
                PrintMenu();
                Console.Write("Make a choice: ");
                choice = Io.InputChar();

                switch (choice)
                {
                case '1':
                    Io.ShowAll(pigsty);
                    break;

                case '2':
                    pigsty.AddStudent(Io.InputStudent());
                    break;

                case '3':
                    if (pigsty.Size() > 0)
                    {
                        Console.Write("Input the index: ");
                        pigsty.DeleteStudent(Io.InputInt());
                    }
                    else
                    {
                        Console.Write("Container is empty");
                    }
                    break;

                case '4':
                    if (pigsty.Size() > 0)
                    {
                        Console.Write("Input the index: ");
                        pigsty.ShowByIndex(Io.InputInt());
                    }
                    else
                    {
                        Console.Write("Container is empty");
                    }
                    break;

                case '5':
                    if (pigsty.Size() > 0)
                    {
                        Console.Write("Input the index: ");
                        pigsty.EditByIndex(Io.InputInt());
                    }
                    else
                    {
                        Console.Write("Container is empty");
                    }
                    break;
                }
            }

            Io.WriteStContainerToFile(path, pigsty);
        }