def updateRecordsTBarniz(self): try: fila = [] for col in range(self.modeltbarniz.columnCount()): index = self.modeltbarniz.index( self.ui.viewTipoBarniz.currentIndex().row(), col) fila.append(str(self.modeltbarniz.data(index).toString())) tbarniz = DTO.TipoBarniz() tbarniz.setIdTBarniz(fila[0]) tbarniz.setProveedor(str(fila[1])) tbarniz.setTipo(str(fila[2])) tbarniz.setAnilox(str(fila[3])) dialog = editarTBarniz.vEditarTBarniz() dialog.ui.leProveedorTBarniz.setText(tbarniz.getProveedor()) dialog.ui.leTipoTBarniz.setText(tbarniz.getTipo()) dialog.ui.leAniloxTBarniz.setText(tbarniz.getAnilox()) dialog.exec_() except Exception as e: MostrarError(str(e.message)) else: if dialog.editarTBarniz is not None: if (dialog.aceptado): tbarniz.setProveedor(dialog.ui.leProveedorTBarniz.text()) tbarniz.setTipo(dialog.ui.leTipoTBarniz.text()) tbarniz.setAnilox(dialog.ui.leAniloxTBarniz.text()) DAO.TipoBarniz(tbarniz).modificarTBarniz() self.cargarviewtbarniz()
def insertRecordsTBarniz(self): try: tbarniz = DTO.TipoBarniz() tbarniz.setProveedor(self.ui.leProveedorTBarnizMod.text()) tbarniz.setTipo(self.ui.leTipoTBarnizMod.text()) tbarniz.setAnilox(self.ui.leAniloxTBarnizMod.text()) DAO.TipoBarniz(tbarniz).ingresarTBarniz() "crear referencia de forma inmediata" tbf = DAO.TBarnizFicha() tbf.setIdFicha(self.edicion) tbf.setIdTBarniz(DAO.TipoBarniz().idUltimoTBarniz()) tbf.insertarTBarnizFicha() self.cargarviewtbarniz() except Exception as e: MostrarError(str(e.message)) else: self.modeltbarniz.submitAll()
def deleteRecordsTBarniz(self): try: fila = [] for col in range(self.modeltbarniz.columnCount()): index = self.modeltbarniz.index( self.ui.viewTipoBarniz.currentIndex().row(), col) fila.append(str(self.modeltbarniz.data(index).toString())) tbarniz = DTO.TipoBarniz() tbarniz.setIdTBarniz(fila[0]) DAO.TBarnizFicha().eliminarReferencia(fila[0], self.edicion) DAO.TipoBarniz(tbarniz).eliminarTBarniz() except Exception as e: MostrarError(str(e.message)) else: self.modeltbarniz.submitAll()