Example #1
0
        public void Remove()
        {
            AEmployee t = new AEmployee(view.Surname, view.Name, view.DepartmentE);

            model.CurrentEmployeeList.RemoveEmployee(t);

            if (model.CurrentEmployeeList.CountEmployee < 1)
            {
                model.CurrentIndex = -1;

                view.Surname     = string.Empty;
                view.Name        = string.Empty;
                view.DepartmentE = string.Empty;
            }
            else
            {
                model.CurrentIndex--;
                if (model.CurrentIndex < 0)
                {
                    model.CurrentIndex = 0;
                }

                view.Surname     = model.CurrentEmployee.Surname;
                view.Name        = model.CurrentEmployee.Name;
                view.DepartmentE = model.CurrentEmployee.Department;
            }
        }
Example #2
0
        /// <summary>
        /// Удалить сотрудника
        /// </summary>
        /// <param name="RemoveEmployee">сотрудник для удаления</param>
        /// <returns>успешно или нет</returns>
        public bool RemoveEmployee(AEmployee RemoveEmployee)
        {
            bool flag = false;

            if (employeeList.IndexOf(RemoveEmployee) != -1)
            {
                employeeList.Remove(RemoveEmployee);
                flag = true;
            }
            return(flag);
        }
Example #3
0
        /// <summary>
        /// Изменить сотрудника
        /// </summary>
        /// <param name="CurrentDepartment">текущий сотрудник</param>
        /// <param name="AlterDepartment">измененный сотрдуник</param>
        /// <returns>успешно или нет</returns>
        public bool AlterEmployee(AEmployee CurrentEmployee, AEmployee AlterEmployee)
        {
            bool flag = false;

            if (CurrentEmployee != null && AlterEmployee != null)
            {
                int a = employeeList.IndexOf(CurrentEmployee);
                employeeList[a] = AlterEmployee;
                flag            = true;
            }
            return(flag);
        }
Example #4
0
        /// <summary>
        /// Добавить сотрудника
        /// </summary>
        /// <param name="NewEmployee">новый сотрудник</param>
        /// <returns>true - если добавили, false - если такой сотрудник уже есть и не добавили</returns>
        public bool AddEmployee(AEmployee NewEmployee)
        {
            bool flag = false;

            if (!employeeList.Contains(NewEmployee))
            {
                employeeList.Add(NewEmployee);
                flag = true;
            }

            return(flag);
        }