Example #1
0
 def update():
     
     if field_blank_checking(house_no.get()) == TRUE or field_blank_checking(chat_id.get()) == TRUE or field_blank_checking(name.get()) == TRUE or field_blank_checking(phone_num.get()) == TRUE :
         messagebox.showinfo('Error', 'Please enter all the fields!')
     elif number_format_checking(house_no.get()) == TRUE:
         messagebox.showinfo('Error', 'House number cannot contain alphabet, symbols and whitespaces!')
     elif alphabet_format_checking(name.get()) == TRUE:
         messagebox.showinfo('Error', 'Name cannot contain number, symbols and whitespaces!')
     elif phone_number_format_checking(phone_num.get()) == TRUE:
         messagebox.showinfo('Error', 'Phone number must have the format 0123333444 or +601233334444!')
     else:
             
         try:
             con=pymysql.connect(user='******', password='', host='localhost', database='parking_locator')
             
             cur = con.cursor()
             sql="update resident set chat_id = '%s', name = '%s', phone_number = '%s', lot_area = '%s' where house_no = '%s'" %(chat_id.get(), name.get(), phone_num.get(), tkvar_lot_area_resident.get(), house_no.get())
             cur.execute(sql)
             con.commit()
             con.close()
             messagebox.showinfo('Success', 'Record Modified')
             displayList()
         except:
             messagebox.showinfo('Error', 'Error in data changes')
         finally:
             clear()
Example #2
0
 def search():
     
     if field_blank_checking(house_no.get()) == TRUE:
         messagebox.showinfo('Error', 'Please enter the house number to search!')
     elif number_format_checking(house_no.get()) == TRUE:
         messagebox.showinfo('Error', 'House number cannot contain alphabet, symbols and whitespaces!')
     else:
         
         try:
             con=pymysql.connect(user='******', password='', host='localhost', database='parking_locator')
             
             cur = con.cursor()
             sql="select * from resident where house_no='%s'" %house_no.get()
             cur.execute(sql)
             result = cur.fetchone()
             chat_id.set(result[1])
             name.set(result[2])
             phone_num.set(result[3])            
             tkvar_lot_area_resident.set(result[4])
             
             houseNumberEntry.configure(state='disabled')
             con.close()
         except:
             messagebox.showinfo('No Data', 'No such resident available.')
             clear()
Example #3
0
 def delete():
     
     if field_blank_checking(house_no.get()) == TRUE :
         messagebox.showinfo('Error', 'Please enter the house number to remove it!')
     elif number_format_checking(house_no.get()) == TRUE:
         messagebox.showinfo('Error', 'House number cannot contain alphabet, symbols and whitespaces!')
     else:
         try:
             con=pymysql.connect(user='******', password='', host='localhost', database='parking_locator')
             
             cur = con.cursor()
             sql="delete from resident where house_no = '%s'" %(house_no.get())
             cur.execute(sql)
             con.commit()
             con.close()
             messagebox.showinfo('Success', 'Record Deleted')
             displayList()
         except:
             messagebox.showinfo('Error', 'Error in data deletion')
         finally:
             clear()
Example #4
0
 def update():
     
     if field_blank_checking(lot_area_id.get()) == TRUE or field_blank_checking(desc.get()) == TRUE or field_blank_checking(capacity.get()) == TRUE :
         messagebox.showinfo('Error', 'Please enter all the fields!')
     elif number_format_checking(capacity.get()) == TRUE:
         messagebox.showinfo('Error', 'Capacity cannot contain alphabet, symbols and whitespaces!')
     else:
             
         try:
             con=pymysql.connect(user='******', password='', host='localhost', database='parking_locator')
             
             cur = con.cursor()
             sql="update parking_lot_details set description = '%s', capacity = '%s' where lot_area_id = '%s'" %(desc.get(), capacity.get(), lot_area_id.get())
             cur.execute(sql)
             con.commit()
             con.close()
             messagebox.showinfo('Success', 'Record Modified')
             displayList()
         except:
             messagebox.showinfo('Error', 'Error in data changes')
         finally:
             clear()
Example #5
0
 def add():
     
     if field_blank_checking(lot_area_id.get()) == TRUE or field_blank_checking(desc.get()) == TRUE or field_blank_checking(capacity.get()) == TRUE :
         messagebox.showinfo('Error', 'Please enter all the fields!')
     elif number_format_checking(capacity.get()) == TRUE:
         messagebox.showinfo('Error', 'Capacity cannot contain alphabet, symbols and whitespaces!')
     else:
         
         try:
             con=pymysql.connect(user='******', password='', host='localhost', database='parking_locator')
             
             cur = con.cursor()
             sql="insert into parking_lot_details values ('%s','%s','%s')" %(lot_area_id.get(), desc.get(), capacity.get())
             cur.execute(sql)
             con.commit()
             con.close()
             messagebox.showinfo('Success', 'Record Saved')
             displayList()
         except:
             messagebox.showinfo('Error', 'Lot Area exists')
         finally:
             clear()