Пример #1
0
        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);
        }
Пример #2
0
 public void EditEmployee(int index, BaseEmployee employee)
 {
     if (index >= 0 && index < Employees.Count)
     {
         Employees[index] = employee;
     }
     OnPropertyChanged(nameof(Employees));
 }
Пример #3
0
 public AddEmployeeViewModel(BaseEmployee employee, List <BaseEmployee> existingEmployees)
 {
     _existingEmployees = existingEmployees;
     Name       = employee.Name;
     SurName    = employee.SurName;
     Age        = employee.Age;
     Experience = employee.Experience;
     Profession = employee.Profession;
 }
Пример #4
0
 public void AddEmployee(BaseEmployee employee)
 {
     if (Employees.Contains(employee))
     {
         throw new ArgumentOutOfRangeException(nameof(BaseDepartment.Name), "Такой работник уже существует");
     }
     Employees.Add(employee);
     OnPropertyChanged(nameof(Employees));
 }
Пример #5
0
        public override bool Equals(object obj)
        {
            if (!(obj is BaseEmployee))
            {
                return(false);
            }
            BaseEmployee var = (BaseEmployee)obj;

            return(var.GetHashCode() == this.GetHashCode());
        }
Пример #6
0
        protected override bool CanPressOk(object obj)
        {
            try
            {
                BaseEmployee t = this.Employee;

                return(!(_existingEmployees.Contains(t)));
            }
            catch
            {
                return(false);
            }
        }