Exemplo n.º 1
0
def main():
    print('Welcome!')
    entry = None
    while entry != '2':
        entry = input(
            '\n1. Current Student\n2. New Student\n3. Quit\nPlease, enter 1, 2 or 3: '
        )

        if entry == '1':
            student_dao = DAO.StudentDAO()
            email = input('\nEnter Your Email: ')
            pw = input('Enter Your Password: '******'\nWhat Would You Like To Do?')

                while entry != '2':
                    entry = input(
                        '\n1. Register To Course\n2. Logout\nPlease, enter 1 or 2: '
                    )

                    if entry == '1':
                        show_all_courses(course_list)
                        course_id = input('\nSelect Course By ID Number: ')
                        print("\nAttempting to Register...")
                        if attending_dao.register_student_to_course(
                                email, course_id, course_list):
                            show_my_courses(student, course_list)
                    elif entry == '2':
                        print('\nYou Have Been Logged Out.')
                    else:
                        print('\nInvalid Option...')

            else:
                print('\nWrong Credentials!')
        elif entry == '2':
            print("Welcome to the school!")
            student_dao = DAO.StudentDAO()
            email = input('Please provide your email : ')
            if not student_dao.get_student_by_email(email):
                name = input("What is your full name? : ")
                password = input("What would you like your password to be? : ")
                student_dao.add_new_student(email, name, password)
                entry = '-1'
                continue
            else:
                print("That email is already taken")

        elif entry == '3':
            print("Programming is closing, ")
            break
        else:
            print('Invalid Option...')
    print('\nClosing Program. Goodbye.')
Exemplo n.º 2
0
def main():
    print('Welcome!')
    entry = None
    while entry != '2':
        entry = input(
            '\n1. Student\n2. Quit\n3. Register as a New Student\nPlease, enter 1, 2 or 3: '
        )

        if entry == '1':
            student_dao = DAO.StudentDAO()
            email = input('\nEnter Your Email: ')
            pw = input('Enter Your Password: '******'\nWhat Would You Like To Do?')

                while entry != '2':
                    entry = input(
                        '\n1. Register To Course\n2. Logout\nPlease, enter 1 or 2: '
                    )

                    if entry == '1':
                        show_all_courses(course_list)
                        course_id = input('\nSelect Course By ID Number: ')
                        print("\nAttempting to Register...")
                        if attending_dao.register_student_to_course(
                                email, course_id, course_list):
                            show_my_courses(student, course_list)
                    elif entry == '2':
                        print('\nYou Have Been Logged Out.')
                    else:
                        print('\nInvalid Option...')

            else:
                print('\nWrong Credentials!')
        elif entry == '3':
            email = input('\nEnter Your Email: ')
            name = input('Enter Your Full Name: ')
            pw = input('Enter A Password: '******'students.csv', 'a') as f:
                f.write(f'{email},{name},{pw}\n')
            print('\nRegistration Successful!')
        elif entry != '2':
            print('\nInvalid Option...')
    print('\nClosing Program. Goodbye.')
def main():
    print('Welcome!')

    entry = None
    while entry != '2':
        entry = input('\n1. Student\n2. Quit\nPlease, enter 1 or 2: ')

        if entry == '1':
            student_dao = DAO.StudentDAO()
            email = input('\nEnter Your Email: ')
            pw = input('Enter Your Password: '******'\nWhat Would You Like To Do?')

                while entry != '2':
                    entry = input(
                        '\n1. Register To Course\n2. Logout\nPlease, enter 1 or 2: '
                    )

                    if entry == '1':
                        show_all_courses(course_list)
                        course_id = input('\nSelect Course By ID Number: ')
                        print("\nAttempting to Register...")
                        if attending_dao.register_student_to_course(
                                course_id, email):
                            print(
                                f"\nCongratulations You've Just Registered For: {course_id}"
                            )
                            show_my_courses(student, attending_dao, course_dao)
                        else:
                            print(
                                f"\nYou Are Already Registered For This Course : {course_id}"
                            )
                    elif entry == '2':
                        print('\nYou Have Been Logged Out.')
                    else:
                        print('\nInvalid Option...')
            else:
                print('\nWrong Credentials!')
        elif entry != '2':
            print('\nInvalid Option...')
    print('\nClosing Program. Goodbye.')
Exemplo n.º 4
0
def main():
    print('Welcome!')
    entry = None
    while entry != '2':
        entry = input('\n1. Student\n2. Quit\nPlease, enter 1 or 2: ')

        if entry == '1':
            student_dao = DAO.StudentDAO()
            email = input('\nEnter Your Email: ')
            pw = input('Enter Your Password: '******'\nWhat Would You Like To Do?')

                while entry != '2':
                    entry = input(
                        '\n1. Register To Course\n2. Logout\nPlease, enter 1 or 2: '
                    )

                    if entry == '1':
                        show_all_courses(course_list)
                        course_id = input('\nSelect Course By ID Number: ')
                        print("\nAttempting to Register...")
                        if attending_dao.register_student_to_course(
                                email, course_id, course_list):
                            print(
                                "\nCONGRATULATIONS!!! You have registered to the course {}"
                                .format(course_id))
                            show_my_courses(student, course_list)
                        else:
                            print("You are already registered in this course")
                    elif entry == '2':
                        print('\nYou Have Been Logged Out.')
                    else:
                        print('\nInvalid Option...')

            else:
                print('\nWrong Credentials!')
        else:
            print('\nInvalid Option...')
    print('\nClosing Program. Goodbye.')
Exemplo n.º 5
0
def main():
    print('Welcome!')
    entry = None
    while entry != '3':
        entry = input(
            '\n1. Student\n2. Add New Student\n3. Quit\nPlease, enter 1 or 2 or 3: '
        )

        if entry == '1':
            student_dao = DAO.StudentDAO()
            email = input('\nEnter Your Email: ')
            pw = input('Enter Your Password: '******'\nWhat Would You Like To Do?')

                while entry != '2':
                    entry = input(
                        '\n1. Register To Course\n2. Logout\nPlease, enter 1 or 2: '
                    )

                    if entry == '1':
                        show_all_courses(course_list)
                        course_id = input('\nSelect Course By ID Number: ')
                        print("\nAttempting to Register...")
                        if attending_dao.register_student_to_course(
                                email, course_id, course_list):
                            show_my_courses(student, course_list)
                        else:
                            print(
                                f'Already registered to {course_id}! Choose wisely!'
                            )
                    elif entry == '2':
                        print('\nYou Have Been Logged Out.')
                    else:
                        print('\nInvalid Option...')

            else:
                print('\nWrong Credentials!')
        elif entry == '2':
            s_dao = DAO.StudentDAO()

            print(
                '\nTo add new student enter your Name and chosen Password!\n')
            fname = input('Enter First name here: ')
            lname = input('Enter your Last name here: ')
            if (fname != ""):
                email = fname.strip().lower() + '@pysc.edu'
                print(f'Your Email Id is: {email} ')
                pwd = input('Enter your password here: ')
                s_dao.add_new_student(email, fname + ' ' + lname, pwd)
                print('\nCongratulations! You are enrolled now!\n')
        elif entry == '3':
            print('\nClosing Program. Goodbye.')
        else:
            print('\nInvalid Option...')