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.Client_list.currentRow() i = -1 for person in mas: if i == n-1: dic = person[0] if person[1]['Общежитие'] != '': if person[1]['Комната'] != 'queue' and '': way = "dormitory"+str(person[1]['Общежитие']) + "/" + "rooms"+"/" + str(person[1]['Комната']+"/" + "members"+"/" + person[0]) else: way = "dormitory"+str(person[1]['Общежитие']) + "/"+ "rooms"+"/" + "queue"+"/" + person[0] else: way = "queue"+"/" + person[0] break i = i+1 dbd.delete_student(dic, way) self.FIO_line.clear() self.Contract_number_line.clear() self.Client_list.clear()
def redaction(self): # добавляет в буфер студента, который будет редактироваться, в red_client_2 из буфера забираются данные и буфер удаляется 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.Client_list.currentRow() i = -1 for person in mas: if i == n - 1: dic = person[0] hostel = str(person[1]['Общежитие']) fio = str(person[1]['ФИО']) phone = person[1]['Телефон'] passport = person[1]['Паспорт'] address = person[1]['Адрес регистрации'] educ_form = person[1]['Форма обучения'] sex = person[1]['Пол'] if 'Комната' in person[1]: room = person[1]['Комната'] else: room = '' i = i + 1 dbd.add_student_buffer(dic, fio, phone, passport, address, educ_form, sex, room, hostel) self.FIO_line.clear() self.Contract_number_line.clear() self.Client_list.clear()
def redaction(self): # добавляет в буфер студента, который будет редактироваться, в red_contract_3 из буфера забираются данные и буфер удаляется 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] fio = str(person[1]['ФИО']) if "Договор" in person[1].keys(): code = str(person[1]['Договор']['Шифр']) start_date = str(person[1]['Договор']['Дата начала']) end_date = str(person[1]['Договор']['Дата конца']) cost = str(person[1]['Договор']['Стоимость']) facility = str(person[1]['Договор']['Льгота']) else: code = '' start_date = '' end_date = '' cost = '' facility = '' room = str(person[1]['Комната']) i = i + 1 dbd.add_contract_buffer(dic, fio, start_date, end_date, room, cost, facility, code) self.FIO_line.clear() self.Contract_list.clear()
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()