public void MoveEmployee(int IndexFromDepartment, int IndexToDepartment, int IndexEmployee) { BaseEmployee temp = (BaseEmployee)Departments[IndexFromDepartment].Employees[IndexEmployee].Clone(); Departments[IndexFromDepartment].RemoveEmployee(IndexEmployee); Departments[IndexToDepartment].AddEmployee(temp); }
public void EditEmployee(int index, BaseEmployee employee) { if (index >= 0 && index < Employees.Count) { Employees[index] = employee; } OnPropertyChanged(nameof(Employees)); }
public AddEmployeeViewModel(BaseEmployee employee, List <BaseEmployee> existingEmployees) { _existingEmployees = existingEmployees; Name = employee.Name; SurName = employee.SurName; Age = employee.Age; Experience = employee.Experience; Profession = employee.Profession; }
public void AddEmployee(BaseEmployee employee) { if (Employees.Contains(employee)) { throw new ArgumentOutOfRangeException(nameof(BaseDepartment.Name), "Такой работник уже существует"); } Employees.Add(employee); OnPropertyChanged(nameof(Employees)); }
public override bool Equals(object obj) { if (!(obj is BaseEmployee)) { return(false); } BaseEmployee var = (BaseEmployee)obj; return(var.GetHashCode() == this.GetHashCode()); }
protected override bool CanPressOk(object obj) { try { BaseEmployee t = this.Employee; return(!(_existingEmployees.Contains(t))); } catch { return(false); } }