コード例 #1
0
        public void GetStudentPerCourse(int userID, DataClasses1DataContext db)
        {
            AssignmentPerCourse assignmentPerCourse = new AssignmentPerCourse();


            int studentID = GetStudentID(userID, db);
            var resultStudentPerCourse = from i in db.STUDENT_PER_COURSEs
                                         where i.STUDENT_ID == studentID
                                         select i;

            var studentName = resultStudentPerCourse.ToList().Take(1);

            studentName.ToList().ForEach(i => Console.WriteLine("\n\t" + "STUDENT" + "\n" +
                                                                "\t" + "-------" + "\n" +
                                                                "\t" + $"Firstname: {i.STUDENT.F_NAME}" + "\n" +
                                                                "\t" + $"Lastname: {i.STUDENT.L_NAME}" + "\n"));

            Console.WriteLine("\t" + "COURSES" + "\n" + "\t" + "-------");
            resultStudentPerCourse.ToList().ForEach(i => Console.WriteLine("\t" + $"Course Stream: { i.COURSE.STREAM }" + "\n" +
                                                                           "\t" + $"Week Day: {i.COURSE.WEEK_DAY}" + "\n"));

            assignmentPerCourse.GetStudentAssignmentPerCourse(studentID, db);
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: GeLyk/SchoolManagement
        public void Selection(DataClasses1DataContext db)
        {
            STUDENT student = new STUDENT();
            TRAINER trainer = new TRAINER();
            USERR   uSer    = new USERR();

            string selection;
            string newSelection;
            int    choiceCategory;
            bool   iWantTocontinue = true;

            while (iWantTocontinue)
            {
                Console.WriteLine("\t" + "     SELECTION MENU" + "\n\t" + "   ------------------");
                Console.WriteLine("\t" + "For Course Press                {1}");
                Console.WriteLine("\t" + "For Student Press               {2}");
                Console.WriteLine("\t" + "For Assignment Press            {3}");
                Console.WriteLine("\t" + "For Trainer Press               {4}");
                Console.WriteLine("\t" + "For User Press (Only Delete)    {5}");
                Console.WriteLine("\t" + "For Student Per Course Press    {6}");
                Console.WriteLine("\t" + "For Trainer Per Course Press    {7}");
                Console.WriteLine("\t" + "For Assignment Per Course Press {8}");
                Console.WriteLine("\t" + "For Schedule Per Course Press   {9}");
                Console.Write("\n\t" + "Give a choise between {1 - 8}: ");
                selection = Console.ReadLine();

                int choice;
                while (!int.TryParse(selection, out choice) || string.IsNullOrEmpty(selection) || choice < 1 || choice > 9)
                {
                    Console.Write("\n\t" + "Give choice again Only Integer between {1 - 9}!!!: ");
                    selection = Console.ReadLine();
                }
                choiceCategory = choice;

                switch (choiceCategory)
                {
                case (int)SelectionCategory.course:
                    Course course = new Course();
                    course.MenuCourse(db);
                    break;

                case (int)SelectionCategory.student:
                    Student  sTudent  = new Student();
                    Check_ID check_ID = new Check_ID();
                    sTudent.MenuStudent(db, student, sTudent, check_ID);
                    break;

                case (int)SelectionCategory.assignment:
                    Assignment assignment = new Assignment();
                    assignment.MenuAssignment(db);
                    break;

                case (int)SelectionCategory.trainer:
                    Trainer tRainer = new Trainer();
                    tRainer.MenuTrainer(db, trainer);
                    break;

                case (int)SelectionCategory.user:
                    User user = new User();
                    user.MenuUser(db);
                    break;

                case (int)SelectionCategory.student_per_course:
                    StudentPerCourse studentPerCourse = new StudentPerCourse();
                    studentPerCourse.MenuStudentPerCourse(db);
                    break;

                case (int)SelectionCategory.trainer_per_course:
                    TrainerPerCourse trainerPerCourse = new TrainerPerCourse();
                    trainerPerCourse.MenuTrainerPerCourse(db);
                    break;

                case (int)SelectionCategory.assgnment_per_course:
                    AssignmentPerCourse assignmentPerCourse = new AssignmentPerCourse();
                    assignmentPerCourse.MenuAssignmentPerCourse(db);
                    break;

                case (int)SelectionCategory.schedule_per_course:
                    SchedulePerCourse schedulePerCourse = new SchedulePerCourse();
                    schedulePerCourse.MenuSchedulePerCourse(db);
                    break;
                }

                Console.WriteLine("\n\t" + "Do you want a new selection?");
                Console.WriteLine("\t" + "If yes press --> {Y} or {y}");
                Console.WriteLine("\t" + "If no press --> {N} or {n}");
                Console.Write("\n\t" + "Give a new selection: ");
                newSelection = Console.ReadLine();

                while (newSelection != "Y" && newSelection != "y" && newSelection != "N" && newSelection != "n")
                {
                    Console.WriteLine("\n\t" + "     Wrong Choise" + "\n\t" + "   ---------------");
                    Console.WriteLine("\t" + "If yes press --> {Y} or {y}");
                    Console.WriteLine("\t" + "If no press --> {N} or {n}");
                    Console.Write("\n\t" + "Give again a new selection: ");
                    newSelection = Console.ReadLine();
                }
                if (newSelection == "Y" || newSelection == "y")
                {
                    iWantTocontinue = true;
                }
                else if (newSelection == "N" || newSelection == "n")
                {
                    iWantTocontinue = false;
                }
                Console.WriteLine();
            }
        }