コード例 #1
0
ファイル: Courses.cs プロジェクト: troumel/General
 public Courses(string courseId, string name, Students std, Trainers tr)
 {
     this.Name     = name;
     this.CourseID = courseId;
     this.Std      = std;
     this.Tr       = tr;
 }
コード例 #2
0
ファイル: Courses.cs プロジェクト: troumel/General
 public void InitialCourses()
 {
     Trainers Chamilos    = new Trainers("01", "Chamilos Mixalis", "C#");
     Students roumeliotis = new Students("101", "Roumeliotis Theodoros", "C#", "Individual Assignment Part A");
     Courses  cSharp1     = new Courses("1", "C#", roumeliotis, Chamilos);
     //listCourses.Add(cSharp1);
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: troumel/General
        static void Main(string[] args)
        {
            List <Students> SList = new List <Students>();
            //List<Students> listStudents = new List<Students>();
            List <Courses> CList = new List <Courses>();

            Students std = new Students();
            Courses  crs = new Courses();
            //MainMenu menu = new MainMenu();
            //menu.ShowMainMenu();
            //------------------------------------------------------------------------>>>
            bool mainMenu = true;

            while (mainMenu)
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.WriteLine(@"
                                         _    _      _                           _
                                        | |  | |    | |                         | |
                                        | |  | | ___| | ____ ___  _ __ ___   ___| |
                                        | |/\| |/ _ \ |/  __/ _ \| '_ ` _ \ / _ \ |
                                        \  /\  /  __/ |  (_| (_) | | | | | |  __/_|
                                         \/  \/ \___|_|\____\___/|_| |_| |_|\___(_)");
                Console.WriteLine("\n");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("1) Show Entries");
                Console.WriteLine("2) Create New");
                Console.WriteLine("3) Exit\n");
                Console.Write("Select an option: ");
                int.TryParse(Console.ReadLine(), out int mainMenuChoice);

                while (mainMenuChoice == 0 || mainMenuChoice > 3 || mainMenuChoice < 0)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write("Please choose 1, 2 or 3: ");
                    Console.ForegroundColor = ConsoleColor.White;
                    int.TryParse(Console.ReadLine(), out mainMenuChoice);
                }
                switch (mainMenuChoice)
                {
                case 1:
                    Console.Clear();
                    bool thisMenu = true;
                    while (thisMenu)
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.WriteLine("1) Show Students");
                        Console.WriteLine("2) Show Trainers");
                        Console.WriteLine("3) Show Courses");
                        Console.WriteLine("4) Show Assignments");
                        Console.WriteLine("5) Return To Main Menu\n");
                        Console.Write("Select an option: ");
                        int.TryParse(Console.ReadLine(), out int MenuChoice);

                        while (MenuChoice == 0 || MenuChoice > 5 || MenuChoice < 0)
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("Please choose 1, 2, 3, 4 or 5: ");
                            Console.ForegroundColor = ConsoleColor.White;
                            int.TryParse(Console.ReadLine(), out MenuChoice);
                        }
                        if (MenuChoice == 1)
                        {
                            ShowStudents(SList, std.CList);
                            //Showstudents();
                        }
                        else if (MenuChoice == 2)
                        {
                            Trainers tr = new Trainers();
                            tr.ShowTrainers();
                        }
                        else if (MenuChoice == 3)
                        {
                            //ShowCourses();
                        }
                        else
                        {
                            Console.Clear();
                            thisMenu = false;
                        }
                    }
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine();
                    Console.WriteLine();
                    //Students std = new Students();
                    Console.WriteLine("1) Create student");
                    Console.WriteLine("2) Create student using synthetic data");
                    Console.WriteLine("3) Return to Main Menu\n");
                    Console.Write("Select an option: ");
                    int.TryParse(Console.ReadLine(), out int menuChoice);

                    while (menuChoice == 0 || menuChoice > 3 || menuChoice < 0)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("Please choose 1, 2 or 3: ");
                        Console.ForegroundColor = ConsoleColor.White;
                        int.TryParse(Console.ReadLine(), out menuChoice);
                    }

                    switch (menuChoice)
                    {
                    case 1:
                        //Console.Clear();
                        SList.Add(std.CreateStudents());
                        break;

                    case 2:
                        Console.Clear();
                        Console.WriteLine("Call create new method");
                        break;

                    case 3:
                        Console.Clear();
                        //ShowMainMenu();
                        break;
                    }
                    break;

                case 3:
                    System.Environment.Exit(1);
                    break;
                }
            }
        }