def delete_items_slot(self, answer): if answer: selection = self.jednostki.selectedItems() if selection: res = [] for x in selection: res.append(self.jednostki.item(x.row(), 0).text()) res = list(dict.fromkeys(res)) Connector.delete_items("jednostki", res, "identyfikator", int) self.set_jednostki()
def delete_items_slot(self, answer): if answer: selection = self.equipment.selectedItems() if selection: res = [] for x in selection: res.append(self.equipment.item(x.row(), 0).text()) res = list(dict.fromkeys(res)) Connector.delete_items("ekwipunek", res, "numer_seryjny", int) self.refresh_eq()
def delete_officers_slot(self, answer): if answer: selection = self.tabela_oficerowie.selectedItems() if selection: res = [] for x in selection: res.append(self.tabela_oficerowie.item(x.row(), 2).text()) res = list(dict.fromkeys(res)) Connector.delete_items("oficerowie", res, "pesel", str) self.refresh_officers()
def delete_vehicles_slot(self, answer): if answer: selection = self.tabela_pojazdy.selectedItems() if selection: res = [] for x in selection: res.append(self.tabela_pojazdy.item(x.row(), 0).text()) res = list(dict.fromkeys(res)) Connector.delete_items("pojazdy", res, "id_pojazdu", int) self.refresh_vehicles()
def delete_building_slot(self, answer): if answer: selection = self.tabela_budynki.selectedItems() if selection: res = [] for x in selection: res.append(self.tabela_budynki.item(x.row(), 0).text()) res = list(dict.fromkeys(res)) Connector.delete_items("budynki", res, "oznaczenie", str) self.refresh_buildings()
def delete_vh_order_slot(self, answer): if answer: selection = self.tabela_pojazdy.selectedItems() if selection: rows = [] for x in selection: rows.append(x.row()) rows = list(dict.fromkeys(rows)) res = [] for x in rows: res.append(self.tabela_pojazdy.item(x, 0).text()) Connector.delete_items('pojazdy', res, "id_zamowienia", int) Connector.delete_items('"Zamowienie-pojazd"', res, "id_zamowienia", int) self.refresh_vh_orders()
def finish_vh_order_slot(self, answer): if answer: selection = self.tabela_pojazdy.selectedItems() if selection: rows = [] for x in selection: rows.append(x.row()) rows = list(dict.fromkeys(rows)) res = [] for x in rows: res.append(self.tabela_pojazdy.item(x, 0).text()) if len(res) == 1: Connector.update_row('pojazdy', ["id_zamowienia", "status"], [None, "Dostępny"], res[0], "id_zamowienia", int) Connector.delete_items('"Zamowienie-pojazd"', res, "id_zamowienia", int) self.refresh_vh_orders()
def delete_vh_assignment_slot(self, answer): if answer: selection = self.tabela_pojazdy.selectedItems() if selection: rows = [] for x in selection: rows.append(x.row()) rows = list(dict.fromkeys(rows)) res = [] for x in rows: res.append("'" + self.tabela_pojazdy.item(x, 0).text() + "' AND pesel_oficera = '" + self.tabela_pojazdy.item(x, 2).text() + "' AND id_pojazdu = " + self.tabela_pojazdy.item(x, 3).text()) Connector.delete_items('"Przydzial-pojazd"', res, "data_od", int) for x in rows: Connector.update_row("pojazdy", ["status"], ["Dostępny"], self.tabela_pojazdy.item(x, 3).text(), "id_pojazdu", int) self.refresh_vh_assignments()
def delete_eq_assignment_slot(self, answer): if answer: selection = self.tabela_eq.selectedItems() if selection: rows = [] for x in selection: rows.append(x.row()) rows = list(dict.fromkeys(rows)) res = [] for x in rows: res.append("'" + self.tabela_eq.item(x, 0).text() + "' AND pesel_oficera = '" + self.tabela_eq.item(x, 2).text() + "' AND numer_seryjny = " + self.tabela_eq.item(x, 3).text()) Connector.delete_items('"Przydzial-ekwipunek"', res, "data_od", int) for x in rows: Connector.update_row("ekwipunek", ["status"], ["Dostępny"], self.tabela_eq.item(x, 3).text(), "numer_seryjny", int) self.refresh_eq_assignments()