def deleteRecord(self): msg = QtGui.QMessageBox.question(self, 'Message', 'Are you sure to delete this record ?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) if msg == QtGui.QMessageBox.Yes: row = self.ui.tableWidget.currentRow() appInst.delete(self.tableName, self.primaryKeys[row]) appInst.updateTableViews()
def deleteRecord(self): msg = QtGui.QMessageBox.question(self, 'Message', 'Are you sure to delete this record ?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) if msg == QtGui.QMessageBox.Yes: row = self.ui.tableWidget.currentRow() if len(dbi.session.execute(''' select 1 from tasks as a, projectemployees as b where a.projectId = b.projectId and a.employeeId = b.employeeId and a.state != %s''' % STAGE_TASK_FINISHED).fetchall()): raise DBException('There are unfinished tasks and on this project assigned on this employee ') appInst.delete(self.tableName, self.primaryKeys[row]) appInst.updateTableViews()
def deleteRecord(self): msg = QtGui.QMessageBox.question(self, 'Message', 'Are you sure to delete this record ?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) if msg == QtGui.QMessageBox.Yes: row = self.ui.tableWidget.currentRow() if len(dbi.session.execute(''' select 1 from projectemployees as a, employees as b, contracts as c, projects as d where a.projectId = c.projectId and a.employeeId = b.id and b.companyId = c.companyId and c.id = %s''' % self.primaryKeys[row][0]['value']).fetchall()): raise DBException('There are employees of this company that are assigned on this project') appInst.delete(self.tableName, self.primaryKeys[row]) appInst.updateTableViews()