def welcome():
    print(
        "Please select\n1. Login as Elder \n2. Login as Younger\n3. Register\n4. View all youngers who are taking care\n5. View who is taking care of older couple\n6. Exit"
    )
    task = int(input())
    if task == 1:
        mobile = input("Welcome Elder\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Welcome younger\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Register Yourself\nEnter Your Full Name: ")
        email = input("Enter your email: ")
        mobile = input("Enter Your Mobile Number: ")
        password = input("Enter Your Password: "******"select your role:\n1. Elder\n2. Younger\n"))
            try:
                if role == 1:
                    role = "elder"
                    break
                elif role == 2:
                    role = "younger"
                    break
            except:
                print(f'option not Valid! Please try again')

        user_signup = User(name, email, password, mobile, role)
        user_signup.user_registration()

    # display name of youngers who are taking care of
    elif task == 4:
        pass

    # enter elder's mobile number of email boh are unique here and display their take care name
    elif task == 5:
        pass

    elif task == 6:
        exit()
示例#2
0
def welcome():
    print(
        "Please select\n1. Login as Elder \n2. Login as Younger\n3. Register\n4. View all youngers who are taking care\n5. View who is taking care of older couple\n6. Exit"
    )
    task = int(input())
    if task == 1:
        mobile = input("Welcome Elder\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Welcome younger\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Register Yourself\nEnter Your Full Name: ")
        email = input("Enter your email: ")
        mobile = input("Enter Your Mobile Number: ")
        password = input("Enter Your Password: "******"select your role:\n1. Elder\n2. Younger\n"))
            try:
                if role == 1:
                    role = "elder"
                    break
                elif role == 2:
                    role = "younger"
                    break
            except:
                print(f'option not Valid! Please try again')

        user_signup = User(name, email, password, mobile, role)
        user_signup.user_registration()

    # display name of youngers who are taking care of
    elif task == 4:
        sql = 'select name from users where PK_user_id = (select FK_user_id from youngers where PK_younger_id = (select FK_younger_id from elders where FK_younger_id >= 1))'
        mycursor.execute(sql)
        print(mycursor.fetchone())

    # enter elder's mobile number of email boh are unique here and display their take care name
    elif task == 5:
        print(
            "Enter Email or mobile number to find who is taking of the respective elder\n1.Email\n2.Mobile Number"
        )
        choice = int(input())
        if choice == 1:
            email = str(input('Enter the Email :'))
            sql = f'SELECT name FROM users WHERE PK_user_id = (SELECT FK_user_id FROM youngers where FK_user_id = (SELECT FK_younger_id FROM elders where FK_user_id = (SELECT PK_user_id FROM users where email = "{email}")))'
            mycursor.execute(sql)
            print(mycursor.fetchone())
        elif choice == 2:
            mobile_no = str(input('Mobile No :'))
            sql = f'SELECT name FROM users WHERE PK_user_id = (SELECT FK_user_id FROM youngers where FK_user_id = (SELECT FK_younger_id FROM elders where FK_user_id = (SELECT PK_user_id FROM users where mobile = "{mobile_no}")))'
            mycursor.execute(sql)
            print(mycursor.fetchone())

    #It will come out from the application, Run the application again if you want to go inside
    elif task == 6:
        return "\n\n\nWelcome to CareAll\n\n\n"
示例#3
0
def welcome():
    print(
        "Please select\n1. Login as Elder \n2. Login as Younger\n3. Register\n4. View all youngers who are taking care\n5. View who is taking care of older couple\n6. Exit"
    )
    task = int(input())
    if task == 1:
        mobile = input("Welcome Elder\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Welcome younger\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Register Yourself\nEnter Your Full Name: ")
        email = input("Enter your email: ")
        mobile = input("Enter Your Mobile Number: ")
        password = input("Enter Your Password: "******"select your role:\n1. Elder\n2. Younger\n"))
            try:
                if role == 1:
                    role = "elder"
                    break
                elif role == 2:
                    role = "younger"
                    break
            except:
                print(f'option not Valid! Please try again')

        user_signup = User(name, email, password, mobile, role)
        user_signup.user_registration()

    # display name of youngers who are taking care of
    elif task == 4:
        sql = '''SELECT `name` FROM users WHERE `PK_user_id` IN 
            (SELECT FK_user_id FROM `youngers` WHERE `PK_younger_id` IN 
            (SELECT `FK_younger_id` FROM elders))'''
        mycursor.execute(sql)
        user_data = mycursor.fetchall()
        for data in user_data:
            print(data)
        # pass

    # enter elder's mobile number of email both are unique here and display their take care name
    elif task == 5:
        print("Enter elders email id to check their take cares name")
        email_id = input()
        sql1 = "SELECT `FK_user_id` FROM elders WHERE `FK_user_id` IN (SELECT `PK_user_id` FROM users WHERE email = %s);"
        val = (email_id)
        mycursor.execute(sql1, val)
        elder_id = mycursor.fetchall()
        if not elder_id:
            print("No Elder or User found with this mail id")
            welcome()
            return
        sql2 = "SELECT `FK_younger_id` FROM request WHERE `request_status` = 1  AND `FK_elder_id` = %d;"
        val2 = (elder_id)
        mycursor.execute(sql2, val2)
        names = mycursor.fetchall()
        for name in names:
            print(name)

    elif task == 6:
        exit()
示例#4
0
def welcome():
    print(
        "Please select\n1. Login as Elder \n2. Login as Younger\n3. Register\n4. View all youngers who are taking care\n5. View who is taking care of older couple\n6. Exit"
    )
    task = int(input())
    if task == 1:
        mobile = input("Welcome Elder\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Welcome younger\nEnter Your Email: ")
        password = input("Enter Your Password: "******"Register Yourself\nEnter Your Full Name: ")
        email = input("Enter your email: ")
        mobile = input("Enter Your Mobile Number: ")
        password = input("Enter Your Password: "******"select your role:\n1. Elder\n2. Younger\n"))
            try:
                if role == 1:
                    role = "elder"
                    break
                elif role == 2:
                    role = "younger"
                    break
            except:
                print(f'option not Valid! Please try again')

        user_signup = User(name, email, password, mobile, role)
        user_signup.user_registration()

    elif task == 4:
        sql = f'SELECT name from users where PK_user_id in (select FK_younger_ID from elders)'
        mycursor.execute(sql)
        younger_info = mycursor.fetchall()
        print(younger_info)
        print("This all youngeFolks are taking care of some older")
        for i in range(len(younger_info)):
            print(f'{i+1}. {younger_info[i][0]}')
        welcome()

    elif task == 5:
        elder_number = int(input("Please enter elder's mobile number.\n"))
        sql = f'SELECT PK_user_id from users where mobile={elder_number}'
        mycursor.execute(sql)
        user_id = mycursor.fetchone()
        sql = f'SELECT FK_younger_id, available from elders WHERE FK_user_id={user_id[0]}'
        mycursor.execute(sql)
        elder_detail = mycursor.fetchone()
        print(elder_detail)
        if elder_detail[1] == 0:
            sql = f'select name from users where PK_user_id={elder_detail[0]}'
            val = (elder_detail[0])
            mycursor.execute(sql, val)
            younger_name = mycursor.fetchone()
            print(f'{younger_name[0]} is taking care of {elder_detail[0]}.')
        else:
            print(f'No one is taking care of {elder_detail[0]}')
        welcome()
    elif task == 6:
        exit()