コード例 #1
0
        public void CreateCourse()
        {
            Course course = new Course();

            course.doctor = currentDoctor;
            Console.Write("Code : ");
            course.code = Console.ReadLine();
            Console.Write("Name : ");
            course.name = Console.ReadLine();
            Console.Write("Password : "******"\nDoes this course has limit number for register? (Yes/No) ");
            string reply = Console.ReadLine();

            if (reply == "Yes")
            {
                Console.Write("Limit num : ");
                course.limit = int.Parse(Console.ReadLine());
            }
            else
            {
                course.limit = null;
            }
            Console.Write("Do you want pre-requisites to this course? (Yes/No) ");
            string ans = Console.ReadLine();

            if (ans == "Yes")
            {
                if (Course.courseInSystem.Count == 0)
                {
                    Console.WriteLine("Sorry!! there are no course in system");
                }
                else
                {
                    int pos = 0;
                    foreach (Course item in Course.courseInSystem)
                    {
                        Console.WriteLine("{0}) Course = {1} with code = {2} taught by Dr = {3}",
                                          ++pos, item.name, item.code, item.doctor.name);
                    }
label:
                    Console.Write("Which ith [1 - {0}] Course to add? ", pos);
                    int choice = int.Parse(Console.ReadLine());
                    course.preRequisites.Add(Course.courseInSystem[choice - 1]);
                    Console.WriteLine("Done");
                    Console.WriteLine("\n1) Add another one\n2) Exit");
                    if (int.Parse(Console.ReadLine()) == 1)
                    {
                        goto label;
                    }
                }
            }


            Course.courseInSystem.Add(course);
            currentDoctor.teachingCourse.Add(course);
            Console.WriteLine("Successfuly created");

            Menu();
        }
コード例 #2
0
        public void Menu()
        {
            Console.WriteLine("\nPlease make a choice :");
            Console.WriteLine("\t1 - Create Courses");
            Console.WriteLine("\t2 - List Courses");
            Console.WriteLine("\t3 - Log out");
            Console.Write("Enter choice : ");
            int choice = int.Parse(Console.ReadLine());

            if (choice == 1)
            {
                CreateCourse();
            }
            else if (choice == 2)
            {
                ListCourse();
            }
            else if (choice == 3)
            {
                UserFlowControl.LogOut();
            }
            else
            {
                Console.WriteLine("------------------------");
                Console.WriteLine("invalid choice try again ..");
                Menu();
            }
        }
コード例 #3
0
        public void Menu()
        {
            Console.SetCursorPosition(110, Console.CursorTop);
            Console.WriteLine("---------");
            Console.SetCursorPosition(110, Console.CursorTop);
            Console.WriteLine("| Email |");
            Console.SetCursorPosition(110, Console.CursorTop);
            Console.WriteLine("---------");
            Console.WriteLine("\nPlease make a choice : ");
            Console.WriteLine("\t1)Register in course");
            Console.WriteLine("\t2)List my course");
            Console.WriteLine("\t3)Grades report");
            Console.WriteLine("\t4) View E-mail");
            Console.WriteLine("\t5)Log Out");
            Console.Write("\tEnter a choice : ");
            int choice = int.Parse(Console.ReadLine());

            Console.WriteLine("------------------------");
            switch (choice)
            {
            case 1:
                RegisterCourse();
                break;

            case 2:
                ListCourse();
                break;

            case 3:
                GradesReport();
                break;

            case 4:
                Email();
                break;

            case 5:
                UserFlowControl.LogOut();
                break;

            default:
                Console.WriteLine("Please make correct choice");
                Console.WriteLine("--------------------------------");
                Menu();
                break;
            }
        }
コード例 #4
0
        public void RegisterCourse()
        {
            List <Course> otherCourse = Course.ComplementCourses(currentStudent.registeredCourses);

            if (otherCourse.Count == 0)
            {
                Console.WriteLine("No avaliable course yet\n-------------------------------------");
            }
            else
            {
                Console.WriteLine("\nAvaliable course for you : ");
                int pos = 0;
                foreach (var course in otherCourse)
                {
                    Console.WriteLine("{0}) Course {1} - Code {2}", ++pos, course.name, course.code);
                }
label:
                Console.Write("Which ith [1 - {0}] course to register ? ", pos);
                int choice = int.Parse(Console.ReadLine());
                if (choice > pos)
                {
                    Console.WriteLine("------------------------------------");
                    Console.WriteLine("Error !! please enter correct choice ......");
                    Console.WriteLine("------------------------------------");
                    goto label;
                }
l:
                Console.Write("Password : "******"Registered Successfully");
                }
                else
                {
                    Console.WriteLine("Incorrect password !! try again...");
                    goto l;
                }
            }
            Menu();
        }
コード例 #5
0
        public void Email()
        {
            if (myInbox.Count > 0)
            {
                Console.WriteLine("------------------------------");
                int pos = 0;
                foreach (var item in myInbox)
                {
                    if (item.reply.Count == 0)
                    {
                        Console.WriteLine("{0}) {1}:  {2}   (+{3}) ..... ({1})",
                                          ++pos, UserFlowControl.GetUserByEmail(item.from).name,
                                          item.content, item.reply.Count);
                    }
                    else
                    {
                        Student std = UserFlowControl.GetUserByEmail(item.reply[item.reply.Count - 1].from);
                        Console.WriteLine("{0}) {1}:  {2}   (+{3} .... ({4}))", ++pos, std.name,
                                          item.reply[item.reply.Count - 1].content, item.reply.Count,
                                          UserFlowControl.GetUserByEmail(item.reply[item.reply.Count - 1].to).name);
                    }
                }

                Console.WriteLine("------------------------------");
            }
label:
            Console.WriteLine("1) Sent");
            Console.WriteLine("2) Reply");
            Console.WriteLine("3) Back");
            int ans = int.Parse(Console.ReadLine());

            if (ans == 1)
            {
                Email e = new Email();
                e.from = currentStudent.email;
                Console.Write("TO : ");
                e.to = Console.ReadLine();
                Console.Write("Content ");
                e.content = Console.ReadLine();


                currentStudent.myInbox.Add(e);
                Student other_std = UserFlowControl.GetUserByEmail(e.to);
                other_std.myInbox.Add(e);
                Email();
            }
            else if (ans == 2)
            {
                if (myInbox.Count > 0)
                {
                    Console.WriteLine("which ith [1 - {0}] email to reply", myInbox.Count);
                    int choice = int.Parse(Console.ReadLine());
                    Console.WriteLine("------------------------------");
                    Console.WriteLine("\nAll Conversition : \n");
                    Console.WriteLine("{0}: {1}", UserFlowControl.GetUserByEmail(myInbox[choice - 1].from).name,
                                      myInbox[choice - 1].content);
                    foreach (var item in myInbox[choice - 1].reply)
                    {
                        Student std = UserFlowControl.GetUserByEmail(item.from);
                        Console.WriteLine("{0}: {1}", std.name, item.content);
                    }
                    Console.WriteLine("------------------------------\n");
                    Email e = new Email();
                    e.from = currentStudent.email;
                    e.to   = UserFlowControl.GetUserByEmail(myInbox[choice - 1].from).email;
                    Console.Write("Reply : ");
                    e.content = Console.ReadLine();
                    myInbox[choice - 1].reply.Add(e);
                    Email();
                }
                else
                {
                    Console.WriteLine("Sorry ther are no msg to reply");
                    goto label;
                }
            }
            else if (ans == 3)
            {
                Menu();
            }
            else
            {
                Console.WriteLine("Error!! invalid choice try again");
                goto label;
            }
        }
コード例 #6
0
 static void Main(string[] args)
 {
     UserFlowControl.Run();
     Console.ReadKey();
 }