def updateRecordsdhcofo(self): try: fila = [] for col in range(self.modeladhcofo.columnCount()): index = self.modeladhcofo.index( self.ui.viewAdhCofo.currentIndex().row(), col) fila.append(str(self.modeladhcofo.data(index).toString())) adhcofo = DTO.AdhesivoColdFoil() adhcofo.setIdAdhCoFo(fila[0]) adhcofo.setProveedor(str(fila[1])) adhcofo.setAncho(float(fila[2])) dialog = editarAdhCoFo.vEditarAdhCoFo() dialog.ui.leProveedorAdhCoFo.setText(adhcofo.getProveedor()) dialog.ui.dsbAnchoAdhCoFo.setValue(adhcofo.getAncho()) dialog.exec_() except Exception as e: MostrarError(str(e.message)) else: if dialog.editarAdhCoFo is not None: if (dialog.aceptado): adhcofo.setProveedor(dialog.ui.leProveedorAdhCoFo.text()) adhcofo.setAncho(dialog.ui.dsbAnchoAdhCoFo.value()) DAO.AdhesivoColdFoil(adhcofo).modificarAdhCoFo() self.cargarviewadhcofo()
def insertRecordsdhcofo(self): try: adhcofo = DTO.AdhesivoColdFoil() adhcofo.setProveedor(self.ui.leProveedorAdhCoFoMod.text()) adhcofo.setAncho(self.ui.dsbAnchoAdhCoFoMod.value()) DAO.AdhesivoColdFoil(adhcofo).ingresarAdhCoFo() "crear referencia de forma inmediata" acf = DAO.AdhCoFoFicha() acf.setIdFicha(self.edicion) acf.setIdAdhCoFo(DAO.AdhesivoColdFoil().idUltimoAdhCoFo()) acf.insertarAdhCoFoFicha() self.cargarviewadhcofo() except Exception as e: MostrarError(str(e.message)) else: self.modeladhcofo.submitAll()
def deleteRecordsdhcofo(self): try: fila = [] for col in range(self.modeladhcofo.columnCount()): index = self.modeladhcofo.index( self.ui.viewAdhCofo.currentIndex().row(), col) fila.append(str(self.modeladhcofo.data(index).toString())) acf = DTO.AdhesivoColdFoil() acf.setIdAdhCoFo(fila[0]) DAO.AdhCoFoFicha().eliminarReferencia(fila[0], self.edicion) DAO.AdhesivoColdFoil(acf).eliminarAdhCoFo() except Exception as e: MostrarError(str(e.message)) else: self.modeladhcofo.submitAll()