예제 #1
0
        public static void ShowProgsWithSpec()
        {
            foreach (var programArea in AllLists.ProgramAreas)
            {
                Console.WriteLine("Program id: {0}, Program name: {1}", programArea.Id, programArea.ProgramName);
            }
            Console.Write("Select program by id: ");
            string      programId       = Console.ReadLine();
            ProgramArea SelectedProgram = null;
            int         prgId;

            if (int.TryParse(programId, out prgId))
            {
                bool correctProgram = false;
                foreach (var programArea in AllLists.ProgramAreas)
                {
                    if (programArea.Id == prgId)
                    {
                        correctProgram  = true;
                        SelectedProgram = programArea;
                        break;
                    }
                }
                if (correctProgram)
                {
                    Console.WriteLine("Selected program name: {0} ", SelectedProgram.ProgramName);
                    foreach (var programArea in SelectedProgram.ProgSpecifications)
                    {
                        Console.WriteLine("Program title: {0}, Program value: {1}", programArea.Title, programArea.Value);
                    }
                }
            }
        }
예제 #2
0
        public static void AddProgram()
        {
            Console.WriteLine("Program name");
            string      programName = Console.ReadLine();
            ProgramArea prog        = new ProgramArea(programName);

            Console.WriteLine("Program was created successfully");
            AllLists.ProgramAreas.Add(prog);
        }
예제 #3
0
        static void Main(string[] args)
        {
            int userInputInt;

            do
            {
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("*****************\n");
                Console.WriteLine("Select one of the followings");
                Console.WriteLine("1.Create group and group list");
                Console.WriteLine("2.Add program");
                Console.WriteLine("3.Select program id and add specification");
                Console.WriteLine("4.Select the program for the group");
                Console.WriteLine("5.Add teacher and teacher list");
                string userInput = Console.ReadLine();
                if (int.TryParse(userInput, out userInputInt))
                {
                    switch (userInputInt)
                    {
                    case 1:
                        Group.AddGroup();
                        break;

                    case 2:
                        ProgramArea.AddProgram();
                        break;

                    case 3:
                        ProgramArea.ShowProgram();
                        break;

                    case 4:
                        ProgramArea.ShowProgsWithSpec();
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\nWarning: You can not enter a letter!!!");
                }
            } while (true);
        }
예제 #4
0
        public static void ShowProgram()
        {
            foreach (var programArea in AllLists.ProgramAreas)
            {
                Console.WriteLine("Program id: {0}, Program name: {1}", programArea.Id, programArea.ProgramName);
            }
            Console.Write("Select program by id: ");
            string      programId       = Console.ReadLine();
            ProgramArea SelectedProgram = null;
            int         prgId;

            if (int.TryParse(programId, out prgId))
            {
                bool correctProgram = false;
                foreach (var programArea in AllLists.ProgramAreas)
                {
                    if (programArea.Id == prgId)
                    {
                        correctProgram  = true;
                        SelectedProgram = programArea;
                        break;
                    }
                }
                if (correctProgram)
                {
                    Console.Write("Write specification title: ");
                    string title = Console.ReadLine();
                    Console.Write("Write specification value: ");
                    string            value   = Console.ReadLine();
                    ProgSpecification newSpec = new ProgSpecification(title, value);
                    SelectedProgram.ProgSpecifications.Add(newSpec);
                    Console.WriteLine("This specification was added successfully");
                    foreach (var programArea in SelectedProgram.ProgSpecifications)
                    {
                        Console.WriteLine("Program title: {0}, Program value: {1}", programArea.Title, programArea.Value);
                    }
                }
            }
        }