Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
 public EmployeeDecorator(Employee employee)
 {
     this.employee = employee;
 }
 partial void DeleteEmployee(Employee instance);
        public IEnumerable<Bonus> GetAllEmployeeBonus(Employee employee)
        {
            IEnumerable<Bonus> bonus = null;

            bonus = (KadrController.Instance.Model.Bonus.Where(bon => bon.BonusFactStaff != null).Where(bon
                => ((bon.BonusFactStaff.FactStaff.Employee == employee))) as IEnumerable<Bonus>).Concat(KadrController.Instance.Model.FactStaffs.Where(factStf
                    => (factStf.Employee == employee) ).SelectMany(factStf
                        => factStf.PlanStaff.BonusPlanStaffs).Where(bonPlSt => bonPlSt.ForEmployee).Select(bonPlSt => bonPlSt.Bonus) as IEnumerable<Bonus>).Concat(KadrController.Instance.Model.FactStaffs.Where(factStf
                    => (factStf.Employee == employee) ).SelectMany(factStf
                        => factStf.PlanStaff.Post.BonusPosts).Select(bonPost => bonPost.Bonus) as IEnumerable<Bonus>).Distinct();

            return bonus.OrderBy(bon => bon.BonusType.BonusTypeName).ThenBy(bon => bon.DateEnd).ThenBy(bon => bon.DateBegin);
        }
 partial void UpdateEmployee(Employee instance);
 partial void InsertEmployee(Employee instance);
		private void detach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.SemPol = null;
		}
		private void attach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.SemPol = this;
		}
Beispiel #8
0
        /// <summary>
        /// Поиск и выбор сотрудника в дереве
        /// </summary>
        /// <param name="employee"></param>
        public bool FindAndSelectEmployee(Employee employee)
        {
            //поиск соответствующей записи в штатном
            IEnumerable<FactStaff> emplFactStaff = employee.FactStaffs;
            if (emplFactStaff.Count() == 0)
                return false;
            FactStaff seachFactStaff = null;
            //по возможности выбираем ту запись штатного, которая в текущем состоянии и с основным видом работы
            if (emplFactStaff.Where(fcSt => (fcSt as IObjectState).State() == ObjectState.Current).Count() > 0)
            {
                if (emplFactStaff.Where(fcSt => (fcSt as IObjectState).State() == ObjectState.Current).Where(fcSt => fcSt.WorkType.IsMain).Count() > 0)
                    seachFactStaff = emplFactStaff.Where(fcSt =>
                        (fcSt as IObjectState).State() == ObjectState.Current).Where(fcSt => fcSt.WorkType.IsMain).First();
                else
                    seachFactStaff = emplFactStaff.Where(fcSt =>
                        (fcSt as IObjectState).State() == ObjectState.Current).First();
            }
            //seachFactStaff = emplFactStaff.Where(fcSt => fcSt.WorkType.IsMain).FirstOrDefault();
            if (seachFactStaff == null)
                seachFactStaff = emplFactStaff.Where(fcSt => fcSt.WorkType.IsMain).FirstOrDefault();
            if (seachFactStaff == null)
                seachFactStaff = emplFactStaff.OrderByDescending(fcSt => fcSt.DateEnd).FirstOrDefault();

            Kadr.KadrTreeView.RootNodeObject depObj = FindAndSelectDepartment(KadrController.Instance.Model.Departments.Where(dep => dep.id == seachFactStaff.Department.id).FirstOrDefault());
            if (depObj == null)
                return false;

            if (!depObj.ObjectFilters.Contains((seachFactStaff as IObjectState).State()))
            {
                depObj.ObjectFilters.Add((seachFactStaff as IObjectState).State());
            }

            IsSeaching = true;
            try
            {
                depObj.AddChildNodes();
                KadrEmployeeObject emplObj = depObj.Where(dObj => dObj is Kadr.KadrTreeView.KadrEmployeeObject).Where(dObj
                    => (dObj as Kadr.KadrTreeView.KadrEmployeeObject).Employee == employee).FirstOrDefault() as KadrEmployeeObject;

                if (emplObj != null)
                {
                    TreeNode node = emplObj.Node as TreeNode;
                    this.SelectedNode = node;
                    return true;
                }

            }
            finally
            {
                IsSeaching = false;

            }
            return false;
        }