def create(self, studentID, name): redo = FunctionCall(self.addStudent, student(studentID, name)) undo = FunctionCall(self.removeStudent, studentID) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation)
def create(self, disciplineID, name): redo = FunctionCall(self.addDiscipline, discipline(disciplineID, name)) undo = FunctionCall(self.removeDiscipline, disciplineID) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation)
def updateName(self, studentID, oldName, newName): studentID = int(studentID) redo = FunctionCall(self.setStudentName, studentID, newName) undo = FunctionCall(self.setStudentName, studentID, oldName) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation)
def updateName(self, disciplineID, oldName, newName): disciplineID = int(disciplineID) redo = FunctionCall(self.setDisciplineName, disciplineID, newName) undo = FunctionCall(self.setDisciplineName, disciplineID, oldName) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation)
def delete(self, studentID, eList, gList, name): studentID = int(studentID) redo = FunctionCall(self.removeStudent, studentID) undo = FunctionCall(self.addStudent, student(studentID, name)) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation) for Grade in gList: redo = FunctionCall(self._gCTRL.removeGradeList, Grade) undo = FunctionCall(self._gCTRL.addGradeList, Grade) operation = Operation(redo, undo) self._undoController.recordOperation(operation) for Enroll in eList: redo = FunctionCall(self._eCTRL.removeEnrollStudent, studentID) undo = FunctionCall(self._eCTRL.addEnroll, Enroll) operation = Operation(redo, undo) self._undoController.recordOperation(operation)
def updateID(self, oldID, newID): oldID = int(oldID) newID = int(newID) redo = FunctionCall(self.setStudentID, oldID, newID) undo = FunctionCall(self.setStudentID, newID, oldID) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation) redo = FunctionCall(self._eCTRL.updateStudentID, oldID, newID) undo = FunctionCall(self._eCTRL.updateStudentID, newID, oldID) operation = Operation(redo, undo) self._undoController.recordOperation(operation) redo = FunctionCall(self._gCTRL.setStudentID, oldID, newID) undo = FunctionCall(self._gCTRL.setStudentID, newID, oldID) operation = Operation(redo, undo) self._undoController.recordOperation(operation)
def delete(self, disciplineID, eList, gList, name): disciplineID = int(disciplineID) redo = FunctionCall(self.removeDiscipline, disciplineID) undo = FunctionCall(self.addDiscipline, discipline(disciplineID, name)) operation = Operation(redo, undo) self._undoController.newOperation() self._undoController.recordOperation(operation) for Grade in gList: redo = FunctionCall(self._gCTRL.removeGradeList, Grade) undo = FunctionCall(self._gCTRL.addGradeList, Grade) operation = Operation(redo, undo) self._undoController.recordOperation(operation) for Enroll in eList: redo = FunctionCall(self._eCTRL.removeEnrollDiscipline, Enroll.get_discipline_id()) undo = FunctionCall(self._eCTRL.addEnroll, Enroll) operation = Operation(redo, undo) self._undoController.recordOperation(operation)