def delete_the_admin(): if messagebox.askokcancel("Quit", "Are you sure?"): con = mysql.connect( host="localhost", user="******", password="******", database="FMS" ) cursor = con.cursor() cursor.callproc("DELETE_ADMIN_DETAILS", [admin_id]) cursor.execute("commit") messagebox.showwarning("Request successful", "Your account has been successfully deleted.") admin.destroy() import login login.main_screen()
def register_user(): name = register_entry_name.get() email = register_entry_email.get() password = register_entry_password.get() DOB_day = register_entry_day.get() DOB_month = register_entry_month.get() DOB_year = register_entry_year.get() gender = gender_mapper[g.get()] street = register_entry_street.get() city = register_entry_city.get() zipcode = register_entry_zipcode.get() phone = register_entry_contact.get() dob = str(DOB_year) + '-' + str(DOB_month) + '-' + str(DOB_day) code = entry_code.get() if (name == '' or email == '' or password == '' or street == '' or city == '' or phone == '' or DOB_day == '' or DOB_month == '' or DOB_year == '' or code == ''): messagebox.showwarning( "Invalid request", "Please make sure you have filled all the fields.") else: try: phone = int(phone) zipcode = int(zipcode) if (len(str(phone)) == 10 and len(str(zipcode)) == 6): if code == '1111': cursor = con.cursor() cursor.execute( "SELECT EXISTS(SELECT EMAIL_ID FROM SYS_ADMIN WHERE EMAIL_ID = %s);", [email]) status = cursor.fetchall() if (status[0][0] == 0): cursor.callproc("INSERT_ADMIN", [ name, email, password, gender, dob, street, city, zipcode, phone ]) cursor.execute("commit") messagebox.showinfo( "Status", "You have successfully registered!") cursor.execute( 'SELECT ADMIN_ID FROM SYS_ADMIN WHERE EMAIL_ID = %s;', [email]) records = cursor.fetchall() id = records[0][0] con.close() admin_register.destroy() login.main_screen() else: messagebox.showwarning( "User already exists", "Try registering with different email-id.") else: messagebox.showwarning( "Code Error", "Please enter the correct code provided \nto you by FMS Developers." ) else: messagebox.showwarning("Code Error", "Please enter valid details.") except: messagebox.showwarning("Code Error", "Please enter valid details.")
def on_closing(): admin_register.destroy() login.main_screen()
def update_data(user_id, update): name1 = entry_name1.get() email1 = entry_email.get() password1 = entry_password.get() DOB_day1 = entry_day.get() DOB_month1 = entry_month.get() DOB_year1 = entry_year.get() street1 = entry_street.get() city1 = entry_city.get() zipcode1 = entry_zipcode.get() phone1 = entry_contact.get() dob = str(DOB_year1) + '-' + str(DOB_month1) + '-' + str(DOB_day1) if (name1 == '' or email1 == '' or password1 == '' or street1 == '' or city1 == '' or phone1 == '' or DOB_day1 == '' or DOB_month1 == '' or DOB_year1 == '' or zipcode1 == ''): messagebox.showwarning( "Invalid request", "Please make sure you have filled all the fields.") else: con1 = mysql.connect(host="localhost", user="******", password="******", database="FMS", port=3306) cursor1 = con1.cursor() cursor1.execute( "SELECT EXISTS(SELECT EMAIL_ID FROM SYS_ADMIN WHERE ADMIN_ID<>%s AND EMAIL_ID=%s);", [str(user_id), str(email1)]) check = cursor1.fetchmany(size=1) if check[0][0] == 1: messagebox.showwarning( "Invalid request", "Email ID has already been taken. Please select another email id." ) else: try: phone1 = int(phone1) zipcode1 = int(zipcode1) if (len(str(phone1)) == 10 and len(str(zipcode1)) == 6): args = cursor1.callproc("UPDATE_ADMIN_DETAILS", [ int(user_id), str(name1), str(email1), str(password1), str(dob), str(street1), str(city1), int(zipcode1), int(phone1) ]) cursor1.execute("commit") messagebox.showinfo( "Updation successful", "Your data has been successfully updated.") update.destroy() import login login.main_screen() else: messagebox.showwarning("Code Error", "Please enter valid details.") except: messagebox.showwarning("Code Error", "Please enter valid details.")
def on_closing(): update.destroy() login.main_screen()
def logout(homepage): homepage.destroy() import login login.main_screen()
def on_closing(): if messagebox.askokcancel( "Quit", "Are you sure? \nYour ticket will not be booked if you quit."): pay_window.destroy() login.main_screen()
def on_closing(): about.destroy() login.main_screen()
def get_logout(): admin.destroy() import login login.main_screen()