def fill_list(self): '''заполняет список''' self.Client_list.clear() fio = self.FIO_line.text() code = self.Contract_number_line.text() if fio != "": mas = dbd.search_student_by_fio(fio) if code != "": mas = dbd.search_student_by_code(code) i = 1 for person in mas: self.Client_list.addItem(str(i) + '. ФИО: ' + person[1]['ФИО'] + '\n' \ + 'Общежитие: ' + str(person[1]['Общежитие']) + '\n' \ + 'Адрес прописки: ' + str(person[1]['Адрес регистрации']) + '\n' \ + 'Комната: ' + str(person[1]['Комната']) \ + ' Пол: ' + str(person[1]['Пол']) + '\n') i = i + 1
def delete_one(self): fio = self.FIO_line.text() code = self.Contract_number_line.text() if fio != "": mas = dbd.search_student_by_fio(fio) if code != "": mas = dbd.search_student_by_code(code) n = self.Contract_list.currentRow() i = -1 for person in mas: if i == n - 1: dic = person[0] dbd.delite_contract(dic) self.FIO_line.clear() self.Contract_number_line.clear() self.Contract_list.clear()
def add_to_archive(self): fio = self.FIO_line.text() code = self.Contract_number_line.text() if fio != "": mas = dbd.search_student_by_fio(fio) if code != "": mas = dbd.search_student_by_code(code) n = self.Contract_list.currentRow() i = -1 for person in mas: if i == n - 1: dic = person[0] person_data = person[1] if code == "": code = person_data["Договор"]["Шифр"] if fio == "": fio = person_data["ФИО"] dbd.add_to_archive(fio, code, person_data["Договор"]["Дата начала"], person_data["Договор"]["Дата конца"]) dbd.delite_contract(dic) self.FIO_line.clear() self.Contract_number_line.clear() self.Contract_list.clear()