Ejemplo n.º 1
0
        public void DeleteOfStudentsAsUsers(DataClasses1DataContext db, int studentID, int userID, int courseID, int assignmentIDThisUser)
        {
            ASSIGNMENT_PER_STUDENT assignmnetPerStudent = new ASSIGNMENT_PER_STUDENT();
            STUDENT_PER_COURSE     sTudentPerCourse     = new STUDENT_PER_COURSE();
            StudentPerAssignment   studentPerAssignment = new StudentPerAssignment();
            StudentPerCourse       studentPerCourse     = new StudentPerCourse();
            STUDENT sTudent = new STUDENT();
            Student student = new Student();
            USERR   user    = new USERR();

            if (studentID < 1)
            {
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID < 1 && assignmentIDThisUser < 1)
            {
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID > 0 && assignmentIDThisUser < 1)
            {
                studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db);
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            else if (studentID > 0 && courseID > 0 && assignmentIDThisUser > 0)
            {
                studentPerAssignment.DeleteAssignemnts(studentID, assignmnetPerStudent, db);
                studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db);
                student.DeleteStudent(db, sTudent, studentID);
                DeleteUser(user, userID, db);
            }
            Console.WriteLine("\n\tDeleted Succesfully!!!");
        }
Ejemplo n.º 2
0
        public void CheckAvailableCoursesID(List <int> listNumbersOfCourses, Check_ID check_ID, int studentID, int courseID, DataClasses1DataContext db)
        {
            StudentPerCourse   studentPerCourse = new StudentPerCourse();
            STUDENT_PER_COURSE sTudentPerCourse = new STUDENT_PER_COURSE();

            bool thisCourseIDExist = GetAvailableCoursesIdForThisStudentFromDB(studentID, courseID, db);

            while (thisCourseIDExist)
            {
                Console.WriteLine("\tΥou are enrolled in this course!");
                courseID          = check_ID.GetTrueCourseID(studentID, courseID, db); // Έγκυρο COURSE ID
                thisCourseIDExist = GetAvailableCoursesIdForThisStudentFromDB(studentID, courseID, db);
            }

            studentPerCourse.AddStudentsToCourses(studentID, courseID, sTudentPerCourse, check_ID, db);
            listNumbersOfCourses.Add(courseID);
        }
Ejemplo n.º 3
0
        public void CreateStudentsPerCourses(STUDENT_PER_COURSE sTudentPerCourse, DataClasses1DataContext db)
        {
            StudentPerCourse studentPerCourse = new StudentPerCourse();
            Student          student          = new Student();

            Console.WriteLine("\n\n\t" + "CREATE STUDENTS PER COURSES" +
                              "\n\t----------------------------");

            Console.WriteLine("\tFor Create a new student press  --> {1}");
            Console.WriteLine("\tAdd Student to course/s press   --> {2}");
            Console.Write("\tEnter a choice between     -->  {1 - 2}: ");
            string stringChoice = Console.ReadLine();

            Console.WriteLine();
            int outChoice;

            while (!int.TryParse(stringChoice, out outChoice) || outChoice < 1 || outChoice > 2)
            {
                Console.WriteLine("\n\tThe choice should be Only integer between {1- 2}!!!");
                Console.Write("\tEnter a new choice: ");
                stringChoice = Console.ReadLine();
            }
            int choice = outChoice;
            int studentID;

            switch (choice)
            {
            case (int)SelectionCreateStudentOrAdd.create:
                int user_ID = CreateUser(db);
                student.CreateStudent(user_ID, db);
                break;

            case (int)SelectionCreateStudentOrAdd.add:
                Check_ID check_ID = new Check_ID();
                studentID = check_ID.GetTrueStudentID(student, db);     // Έγκυρο STUDENT ID
                TimesToInsertToCourses(studentID, check_ID, db);
                break;
            }
        }
Ejemplo n.º 4
0
        public static void Login(DataClasses1DataContext db)
        {
            StudentPerCourse studentPerCourse = new StudentPerCourse();
            TrainerPerCourse trainerPerCourse = new TrainerPerCourse();
            User             user             = new User();
            Menu             menu             = new Menu();

            bool iWantTocontinue = true;

            while (iWantTocontinue)
            {
                string newSelection;
                Console.WriteLine("\n\tEnter Username and Password to Login!");
                Console.Write("\tEnter Username: "******"\n\t" + "Username shouldn't be empty!!!");
                    Console.Write("\n\t" + "Give a newr username: "******"\tEnter Password: "******"\n\t" + "Password shouldn't be empty!!!");
                    Console.Write("\n\t" + "Give a new password: "******"{ ROLEE = STUDENT }":
                        studentPerCourse.GetStudentPerCourse(userID, db);
                        break;

                    case "{ ROLEE = TRAINER }":
                        trainerPerCourse.GetTrainerPerCourse(userID, db);
                        break;

                    case "{ ROLEE = HEADMASTER }":
                        menu.Selection(db);
                        break;

                    default:
                        Console.WriteLine("\n\tUser not exist !!!");
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("\n\tThis User not exist!");
                }

                Console.WriteLine("\n\t" + "Do you want a new logg in?");
                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();
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }