def del_query(self, win, values): print("Delete Query") id = phone = values['id_txt'] if not id: display_err("ID cannot be blank.") else: MsgBox = self.msg_confirmation( 'Warning!', 'Are you sure you want DELETE this record?', 'warning') if MsgBox == "yes": qry = "DELETE from Profiles_Table WHERE id = " + id work_profiles_db().execute_query_db(qry) self.set_txtbox_data(win, ['', '', '', '', '', 'N/A']) self.update_table(win)
def mod_query(self, win, values): comms = values['comms_txt'] fname = values['fname_txt'] lname = values['lname_txt'] email = values['email_txt'] phone = values['phone_txt'] id = values['id_txt'] res = self.validate_data(win, values) MsgBox = self.msg_confirmation( 'Verification!', 'Are you sure you want UPDATE this record?', 'question') if MsgBox == "yes": qry = "UPDATE Profiles_Table SET fname = '" + fname + "', lname = '" + lname + "', phone = " + phone + ", email = '" + email + "', comms = '" + comms + "' WHERE id = " + id + "" work_profiles_db().execute_query_db(qry) self.set_txtbox_data(win, ['', '', '', '', '', 'N/A']) self.update_table(win)
def add_query(self, win, values): comms = values['comms_txt'] fname = values['fname_txt'] lname = values['lname_txt'] email = values['email_txt'] phone = values['phone_txt'] res = self.validate_data(win, values) if res: MsgBox = self.msg_confirmation( 'Verification!', 'Are you sure you want to ADD this information?', 'question') if MsgBox == "yes": qry = "INSERT INTO Profiles_Table (fname, lname, phone, email, comms) VALUES ('" + fname + "','" + lname + "'," + str( phone) + ",'" + email + "','" + comms + "')" work_profiles_db().execute_query_db(qry) self.set_txtbox_data(win, [' auto', '', '', '', '', 'N/A']) self.update_table(win)
def grab_data_by_id(self, id): db_data = work_profiles_db().search_one_db(id) type = db_data[0][5] if type == 'Email': self.send_email_msg(db_data[0][4]) elif type == 'SMS': self.send_txt_msg(db_data[0][3]) elif type == 'SMS/Email': self.send_email_msg(db_data[0][4]) self.send_txt_msg(db_data[0][3]) else: messagebox.showerror("Error", "No communications method selected.")
def get_all_names(self): db_data = work_profiles_db().search_all_db() rows_cnt = len(db_data) for i in range(rows_cnt): self.all_names.append( str(db_data[i][0]) + " " + db_data[i][1] + " " + db_data[i][2])
def get_all_dbData(self): prof_db = work_profiles_db().search_all_db self.database_tables(prof_db())