Пример #1
0
        /// <summary>
        /// Удалить отдел
        /// </summary>
        public bool RemoveDepartment(ADepartment RemoveDepartment)
        {
            bool flag = false;

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

            if (CurrentDepartment != null && AlterDepartment != null)
            {
                int a = departmentList.IndexOf(CurrentDepartment);
                departmentList[a] = AlterDepartment;
                flag = true;
            }
            return(flag);
        }
Пример #3
0
        /// <summary>
        /// Добавить отдел
        /// </summary>
        public bool AddDepartment(ADepartment NewDepartment)
        {
            bool flag = false;

            if (!departmentList.Contains(NewDepartment))
            {
                departmentList.Add(NewDepartment);
                flag = true;
            }

            return(flag);
        }
Пример #4
0
        public void Remove()
        {
            ADepartment t = new ADepartment(view.DepartmentD);

            model.CurrentDepartmentList.RemoveDepartment(t);

            if (model.CurrentDepartmentList.CountDepartment < 1)
            {
                model.CurrentIndex = -1;
                view.DepartmentD   = string.Empty;
            }
            else
            {
                model.CurrentIndex--;
                if (model.CurrentIndex < 0)
                {
                    model.CurrentIndex = 0;
                }
                view.DepartmentD = model.CurrentDepartment.Department;
            }
        }