def updateRecordsTroquel(self): try: fila = [] for col in range(self.modeltroquel.columnCount()): index = self.modeltroquel.index( self.ui.viewTroquel.currentIndex().row(), col) fila.append(str(self.modeltroquel.data(index).toString())) troquel = DTO.Troquel() troquel.setIdTroquel(fila[0]) troquel.setProveedor(str(fila[1])) dialog = editarTroquel.vEditarTroquel() dialog.ui.leProveedorTroquel.setText(troquel.getProveedor()) dialog.exec_() except Exception as e: MostrarError(str(e.message)) else: if dialog.editarTroquel is not None: if (dialog.aceptado): troquel.setProveedor(dialog.ui.leProveedorTroquel.text()) DAO.Troquel(troquel).modificarTroquel() self.cargarviewtroquel()
def deleteRecordsTroquel(self): try: fila = [] for col in range(self.modeltroquel.columnCount()): index = self.modeltroquel.index( self.ui.viewTroquel.currentIndex().row(), col) fila.append(str(self.modeltroquel.data(index).toString())) troquel = DTO.Troquel() troquel.setIdTroquel(fila[0]) DAO.TroquelFicha().eliminarReferencia(fila[0], self.edicion) DAO.Troquel(troquel).eliminarTroquel() except Exception as e: MostrarError(str(e.message)) else: self.modeltroquel.submitAll()
def insertRecordsTroquel(self): try: troquel = DTO.Troquel() troquel.setProveedor(self.ui.leProveedorTroquelMod.text()) DAO.Troquel(troquel).ingresarTroquel() "crear referencia de forma inmediata" trf = DAO.TroquelFicha() trf.setIdFicha(self.edicion) trf.setIdTroquel(DAO.Troquel().idUltimoTroquel()) trf.insertarTroquelFicha() self.cargarviewtroquel() except Exception as e: MostrarError(str(e.message)) else: self.modeltroquel.submitAll()