Beispiel #1
0
        public void DeleteOfTrainersAsUsers(DataClasses1DataContext db, int userID, int courseID, int trainerID)
        {
            TRAINER_PER_COURSE tRainerPerCourse = new TRAINER_PER_COURSE();
            TrainerPerCourse   trainerPerCourse = new TrainerPerCourse();
            TRAINER            tRainer          = new TRAINER();
            Trainer            trainer          = new Trainer();
            USERR user = new USERR();

            if (trainerID < 1)
            {
                DeleteUser(user, userID, db);
            }
            else if (trainerID > 0 && courseID < 1)
            {
                trainer.DeleteTrainer(db, tRainer, trainerID);
                DeleteUser(user, userID, db);
            }
            else if (trainerID > 0 && courseID > 0)
            {
                trainerPerCourse.DeleteTrainersGeneral(trainerID, tRainerPerCourse, db);
                trainer.DeleteTrainer(db, tRainer, trainerID);
                DeleteUser(user, userID, db);
            }
            Console.WriteLine("\n\tDeleted Succesfully!!!");
        }
Beispiel #2
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();
            }
        }
Beispiel #3
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();
            }
        }