public void restoreMemento(EmployeeMemento memento) { Employee employee = memento.getMemento(); this.Name = employee.Name; this.LastName = employee.LastName; this.EmployeeNumber = employee.EmployeeNumber; }
private void next(EventArgs evt) { EmployeeMemento memento = caretaker.getNextMemento(); if (memento == null) { MessageBox.Show("Next", "There are no more states"); return; } Employee.restoreMemento(memento); updateModel(); }
private void previous(EventArgs evt) { EmployeeMemento menento = caretaker.getPreviousMemento(); if (menento == null) { MessageBox.Show("Previous", "There are no more states"); return; } Employee.restoreMemento(menento); updateModel(); }
public void RevertInfoChanges(EmployeeMemento employeeMemento) { this.Name = employeeMemento.Name; this.Phone = employeeMemento.Phone; }