using System.Collections.Generic;
public char[] ID = new char[2];
public char[] ID = new char[2];
public string CourseName;
public string TeacherName;
public Student[] Students;
public char[] ID = new char[2];
public string StudentName;
static void Main(string[] args)
List<Uni> uni = new List<Uni>();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Menu : 1- Create New Uni | 2- Report");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("Please Inter Number Item : ");
int NumberMenu = Convert.ToInt32(Console.ReadLine());
else if (NumberMenu == 2)
RedMessage("Code is not valid");
RedMessage("Please Inter Just 1 Or 2");
static void CreateNewUni(List<Uni> uni)
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("====== Create New Uni ======");
Console.Write("Uni Code (2 Large Char) : ");
new_uni.ID = Console.ReadLine().ToCharArray();
Console.Write("Uni Name : ");
new_uni.UniName = Convert.ToString(Console.ReadLine());
Console.Write("Creation Date (Example : 01/01/2021) : ");
new_uni.CDate = Convert.ToDateTime(Console.ReadLine());
Console.Write("Number Of Course : ");
new_uni.NCourses = Convert.ToInt32(Console.ReadLine());
new_uni.Courses = new Course[new_uni.NCourses];
for (int i = 0; i < new_uni.NCourses; i++)
new_uni.Courses[i] = new Course();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"====== Course {i + 1} ======");
Console.Write("Course Code (2 Small Char) : ");
new_uni.Courses[i].ID = Console.ReadLine().ToCharArray();
Console.Write("Course Name : ");
new_uni.Courses[i].CourseName = Convert.ToString(Console.ReadLine());
Console.Write("Teacher Name : ");
new_uni.Courses[i].TeacherName = Convert.ToString(Console.ReadLine());
Console.Write("Number Of Students : ");
new_uni.Courses[i].NStudents = Convert.ToInt32(Console.ReadLine());
new_uni.Courses[i].Students = new Student[new_uni.Courses[i].NStudents];
for (int j = 0; j < new_uni.Courses[i].NStudents; j++)
new_uni.Courses[i].Students[j] = new Student();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"====== Student {j + 1} ======");
Console.Write("Student Code (2 Number Char) : ");
new_uni.Courses[i].Students[j].ID = Console.ReadLine().ToCharArray();
Console.Write("Student Name : ");
new_uni.Courses[i].Students[j].StudentName = Convert.ToString(Console.ReadLine());
Console.Write("Student Age : ");
new_uni.Courses[i].Students[j].Age = Convert.ToInt32(Console.ReadLine());
Console.Write("Student Score : ");
new_uni.Courses[i].Students[j].Score = Convert.ToInt32(Console.ReadLine());
static bool Report(List<Uni> uni)
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Please Inter Code : ");
char[] code = Console.ReadLine().ToCharArray();
if (char.IsUpper(code[0]) && char.IsUpper(code[1]))
for (int i = 0; i < uni.Count; i++)
if (uni[i].ID.ToString() == code.ToString())
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("====== Uni Info ======");
Console.WriteLine($"{CharToString(uni[index].ID)} | {uni[index].UniName} | {uni[index].CDate.ToString("yyyy/MM/dd")}");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"====== Courses Info ======");
for (int i = 0; i < uni[index].NCourses; i++)
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Course {i + 1} | {CharToString(uni[index].Courses[i].ID)} | {uni[index].Courses[i].CourseName} | {uni[index].Courses[i].TeacherName}");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"====== Students Info ======");
for (int j = 0; j < uni[index].Courses[i].NStudents; j++)
Console.WriteLine($"Student {j + 1} | {CharToString(uni[index].Courses[i].Students[j].ID)} | {uni[index].Courses[i].Students[j].StudentName} | {uni[index].Courses[i].Students[j].Age} | {uni[index].Courses[i].Students[j].Score}");
else if (char.IsLower(code[2]) && char.IsLower(code[3]))
string codei = code[0].ToString() + code[1].ToString();
string codej = code[2].ToString() + code[3].ToString();
for (int i = 0; i < uni.Count; i++)
if (CharToString(uni[i].ID) == codei)
for (int j = 0; j < uni[i].NCourses; j++)
if (CharToString(uni[i].Courses[j].ID) == codej)
if (indexj == -1 || indexi == -1)
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("====== Uni Info ======");
Console.WriteLine($"{CharToString(uni[indexi].ID)} | {uni[indexi].UniName} | {uni[indexi].CDate.ToString("yyyy/MM/dd")}");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"====== Course Info ======");
Console.WriteLine($"{CharToString(uni[indexi].Courses[indexj].ID)} | {uni[indexi].Courses[indexj].CourseName} | {uni[indexi].Courses[indexj].TeacherName}");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"====== Students Info ======");
for (int j = 0; j < uni[indexi].Courses[indexj].NStudents; j++)
Console.WriteLine($"Student {j + 1} | {CharToString(uni[indexi].Courses[indexj].Students[j].ID)} | {uni[indexi].Courses[indexj].Students[j].StudentName} | {uni[indexi].Courses[indexj].Students[j].Age} | {uni[indexi].Courses[indexj].Students[j].Score}");
else if (char.IsNumber(code[4]) && char.IsNumber(code[5]))
string codei = code[0].ToString() + code[1].ToString();
string codej = code[2].ToString() + code[3].ToString();
string codek = code[4].ToString() + code[5].ToString();
for (int i = 0; i < uni.Count; i++)
if (CharToString(uni[i].ID) == codei)
for (int j = 0; j < uni[i].NCourses; j++)
if (CharToString(uni[i].Courses[j].ID) == codej)
for (int k = 0; j < uni[i].Courses[j].NStudents; k++)
if (CharToString(uni[i].Courses[j].Students[k].ID) == codek)
if (indexj == -1 || indexi == -1 || indexk == -1)
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("====== Uni Info ======");
Console.WriteLine($"{CharToString(uni[indexi].ID)} | {uni[indexi].UniName} | {uni[indexi].CDate.ToString("yyyy/MM/dd")}");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"====== Course Info ======");
Console.WriteLine($"{CharToString(uni[indexi].Courses[indexj].ID)} | {uni[indexi].Courses[indexj].CourseName} | {uni[indexi].Courses[indexj].TeacherName}");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"====== Student Info ======");
Console.WriteLine($"{CharToString(uni[indexi].Courses[indexj].Students[indexk].ID)} | {uni[indexi].Courses[indexj].Students[indexk].StudentName} | {uni[indexi].Courses[indexj].Students[indexk].Age} | {uni[indexi].Courses[indexj].Students[indexk].Score}");
public static void RedMessage(string str)
Console.ForegroundColor = ConsoleColor.Red;
public static string CharToString(char[] c)
string result = string.Empty;
for (int i = 0; i < c.Length; i++)
result += c[i].ToString();