Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
 /// <summary>
 /// Добавление нового отдела
 /// </summary>
 /// <param name="managerDepartment">Руководящий отдел</param>
 /// <param name="departmentType">Тип отдела</param>
 /// <returns></returns>
 public Department CreateNewDepartment(Department managerDepartment, DepartmentType departmentType)
 {
     Department result = new Department();
     result.Department1 = managerDepartment;
     result.DepartmentType = departmentType;
     result.DepartmentName = "Не указано";
     result.DepartmentSmallName = "Не указано";
     Departments.InsertOnSubmit(result);
     return result;
 }
 public PlanStaff CreateNewPlanStaff(Department department)
 {
     PlanStaff result = new PlanStaff();
     result.Department = department;
     result.Category = NullCategory.Instance;
     result.Post = NullPost.Instance;
     result.Prikaz = NullPrikaz.Instance;
     PlanStaffs.InsertOnSubmit(result);
     return result;
 }
Beispiel #3
0
        /// <summary>
        /// Поиск и выбор отдела в дереве
        /// </summary>
        /// <param name="department"></param>
        /// <returns></returns>
        public Kadr.KadrTreeView.RootNodeObject FindAndSelectDepartment(Department Department)
        {
            IsSeaching = true;
            try
            {
                //если такого отдела нет
                Dep department = KadrController.Instance.Model.Deps.Where(dep => dep.id == Department.id).FirstOrDefault();
                if (KadrController.Instance.Model.Deps.Where(dep => dep == department).First() == null)
                    return null;

                Dep rootDep;
                rootDep = department;
                //находим узловой-отдел (самого верхнего уровня)
                while (rootDep.ManagerDepartment != null)
                {
                    rootDep = rootDep.ManagerDepartment;
                }

                //найдем узловой отдел в узлах дерева
                Kadr.KadrTreeView.RootNodeObject rootObj = depObjects.ToArray().Where(dep
                    => (dep as Kadr.KadrTreeView.RootNodeObject).Department == rootDep).First() as Kadr.KadrTreeView.RootNodeObject;
                Dep nodeDep;
                while ((rootDep != department) && (!rootObj.IsTerminalNode))
                {
                    nodeDep = department;
                    while (nodeDep.ManagerDepartment != rootDep)
                    {
                        nodeDep = nodeDep.ManagerDepartment;
                    }
                    //если состояние дочернего узла не соответствует выставленному фильтру, добавляем его
                    if (!rootObj.DepartmentFilters.Contains((nodeDep as IObjectState).State()))
                    {
                        rootObj.DepartmentFilters.Add((nodeDep as IObjectState).State());
                    }
                    rootObj.AddChildNodes();
                    rootObj = rootObj.Where(depObj
                        => (depObj as Kadr.KadrTreeView.RootNodeObject).Department == nodeDep).First() as Kadr.KadrTreeView.RootNodeObject;
                    //this.SelectedNode = rootObj.Node;
                    rootDep = nodeDep;
                }
                SelectedNode = rootObj.Node;
                return rootObj;
            }
            finally
            {
                IsSeaching = false;
               }
        }
 public DepartmentDecorator(Department department)
 {
     this.department = department;
 }
 partial void DeleteDepartment(Department instance);
 partial void UpdateDepartment(Department instance);
 partial void InsertDepartment(Department instance);
		private void detach_Departments(Department entity)
		{
			this.SendPropertyChanging();
			entity.DepartmentType = null;
		}
		private void attach_Departments(Department entity)
		{
			this.SendPropertyChanging();
			entity.DepartmentType = this;
		}
Beispiel #10
0
		private void detach_Departments(Department entity)
		{
			this.SendPropertyChanging();
			entity.PlanStaff = null;
		}
 private void cbDepartment_SelectedValueChanged(object sender, EventArgs e)
 {
     currentDepartment = cbDepartment.SelectedValue as Department;
     planStaffLoad();
 }
Beispiel #12
0
 /// <summary>
 /// При создании модели перезаписывает отдел
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Model_Created(object sender, EventArgs e)
 {
     if (department != null)
         if (KadrController.Instance.Model.Departments.Where(dep => dep.id == department.id).Count()>0)
             department = KadrController.Instance.Model.Departments.Where(dep => dep.id == department.id).First() as Department;
 }