/// <summary>
        /// 根据员工帐号ID获取所有员工信息,加载所属公司信息
        /// </summary>
        /// <param name="accountID"></param>
        /// <returns></returns>
        public Employee GetEmployeeByAccountID(int accountID)
        {
            Employee employee = _dalEmployee.GetEmployeeByAccountID(accountID);

            if (employee == null)
            {
                return(null);
            }
            if (employee.EmployeeDetails != null &&
                employee.EmployeeDetails.Work != null)
            {
                if (employee.EmployeeDetails.Work.Company != null)
                {
                    employee.EmployeeDetails.Work.Company =
                        _IDepartmentBll.GetDepartmentById(employee.EmployeeDetails.Work.Company.Id, null);
                }
                if (employee.EmployeeDetails.Work.Company == null)
                {
                    employee.EmployeeDetails.Work.Company = new Department(0, "");
                }
            }
            Employee employeeskill = _dalEmployeeSkill.GetEmployeeSkillByAccountID(accountID, "", -1, SkillLevelEnum.All);

            if (employeeskill != null)
            {
                employee.EmployeeSkills = employeeskill.EmployeeSkills;
            }
            employee.AdjustRule = _EmployeeAdjustRuleDal.GetAdjustRuleByAccountID(employee.Account.Id);
            return(LoadSEPInfo.SetEmployeeAccountInfo(accountID, employee, _IAccountBll, _IDepartmentBll, _IPositionBll));
        }
        // add necessary data reservationviewmodel
        private void UpdateRvm(ReservationViewModel rvm)
        {
            if (rvm.Start == null)
            {
                rvm.Start = DateTime.Today;
                rvm.End   = DateTime.Today;
            }
            if (rvm.User.Department == null)
            {
                rvm.User.Department = departmentBll.ShowAllDepartments().FirstOrDefault(d => d.DepartmentId == rvm.User.DepartmentId);
            }
            rvm.Building = buildingBll.GetBuildingById(floorBll.GetFloorById(departmentBll.GetDepartmentById(rvm.User.DepartmentId).FloorId).BuildingId);

            rvm.Floors = floorBll.ShowAllFloors().Where(floor => floor.BuildingId == rvm.Building.BuildingId).ToList();
            foreach (var floor in rvm.Floors)
            {
                floor.Department = departmentBll.ShowAllDepartments().Where(d => d.FloorId == floor.FloorId).ToList();
                foreach (var d in floor.Department)
                {
                    d.FlexDesk = flexDeskBll.ShowAllFlexdesks().Where(fd => fd.DepartmentId == d.DepartmentId).ToList();
                }
                rvm.AddDeskIds(floor);
            }
            rvm.Reservations = new ReservationFE().GetReservations(flexDeskBll, reservationBll.ShowAllReservations().Where(r => ((r.StartDate >= rvm.Start && r.StartDate <= rvm.End) || (r.EndDate >= rvm.Start && r.EndDate <= rvm.End)) || ((rvm.Start >= r.StartDate && rvm.Start <= r.EndDate) || (rvm.End >= r.StartDate && rvm.End <= r.EndDate))));

            rvm.DefaultDesks = DefaultDesks((DateTime)rvm.Start, (DateTime)rvm.End);
        }
Exemple #3
0
 /// <summary>
 /// 初始界面查询所有的员工信息
 /// </summary>
 public void InitLetter()
 {
     if (!ValidateFrom() || !ValidateTo())
     {
     }
     else
     {
         try
         {
             _View.ErrorMessage = string.Empty;
             //20090112 修改默认查询条件中的员工类型为“正式” by yyb
             EmployeeTypeEnum employeetype =
                 EmployeeTypeUtility.GetEmployeeTypeByID(Convert.ToInt32(_View.EmployeeType));
             //_EmployeeList = _IEmployeeFacade.GetEmployeeByBasicCondition(string.Empty,
             //                                                             EmployeeTypeEnum.NormalEmployee,
             //                                                             -1, -1, _View.RecursionDepartment);
             //20090807  修改查询条件  by liudan
             _EmployeeList = _IEmployeeFacade.GetEmployeeBasicInfoByBasicConditionWithCompanyAge(_View.EmployeeName, employeetype, _View.PositionId, _View.GradesId, _View.DepartmentId, AgeFrom, AgeTo, _View.RecursionDepartment, Convert.ToInt32(_View.EmployeeStatusId));
             _EmployeeList =
                 HrmisUtility.RemoteUnAuthEmployee(_EmployeeList, AuthType.HRMIS, _Operator, HrmisPowers.A401);
             List <Employee> emplyees = new List <Employee>();
             foreach (Employee emplyee in _EmployeeList)
             {
                 //根据所属公司id,得到所属公司名称
                 Employee temp = emplyee;
                 if (temp.EmployeeDetails == null || temp.EmployeeDetails.Work == null ||
                     temp.EmployeeDetails.Work.Company == null)
                 {
                 }
                 else
                 {
                     //todo noted by wsl transfer waiting for modify
                     temp.EmployeeDetails.Work.Company =
                         _IDepartmentBll.GetDepartmentById(
                             temp.EmployeeDetails.Work.Company.Id, new Account());
                 }
                 temp.EmployeeDetails              = temp.EmployeeDetails ?? new EmployeeDetails();
                 temp.EmployeeDetails.Work         = temp.EmployeeDetails.Work ?? new Work();
                 temp.EmployeeDetails.Work.Company = temp.EmployeeDetails.Work.Company ??
                                                     new Department();
                 emplyees.Add(temp);
             }
             _CardView.Employees = _EmployeeList;
             _View.ErrorMessage  = "<span class='font14b'>共查到 </span>"
                                   + "<span class='fontred'>" + _EmployeeList.Count + "</span>"
                                   + "<span class='font14b'> 条信息</span>";
         }
         catch (Exception ex)
         {
             _View.ErrorMessage = "<span class='fontred'>" + ex.Message + "</span>";
         }
     }
 }
Exemple #4
0
        protected override void ExcuteSelf()
        {
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
            {
                _Employee.Account = _IAccountBll.GetAccountById(_Employee.Account.Id);
                if (_Employee.Account != null &&
                    _Employee.Account.Position != null &&
                    _Employee.Account.Position.Description != null)
                {
                    _Employee.EmployeeDetails      = _Employee.EmployeeDetails ?? new EmployeeDetails();
                    _Employee.EmployeeDetails.Work = _Employee.EmployeeDetails.Work ?? new Work();
                    _Employee.EmployeeDetails.Work.Responsibility = _Employee.Account.Position.Description;
                }

                //得到后台帐号
                Account accountOperator = _IAccountBll.GetAccountById(_Operatoraccount.Id);
                _DalEmployee.CreateEmployee(_Employee);
                //新增员工技能
                _DalEmployeeSkill.InsertEmployeeSkill(_Employee);
                //员工福利包括历史的新增
                if (_Employee.EmployeeWelfare != null)
                {
                    SaveEmployeeWelfare SaveEmployeeWelfare =
                        new SaveEmployeeWelfare(_Employee.Account.Id, _Employee.EmployeeWelfare.SocialSecurity.Type,
                                                _Employee.EmployeeWelfare.SocialSecurity.Base,
                                                _Employee.EmployeeWelfare.SocialSecurity.EffectiveYearMonth,
                                                _Employee.EmployeeWelfare.AccumulationFund.Account,
                                                _Employee.EmployeeWelfare.AccumulationFund.EffectiveYearMonth,
                                                _Employee.EmployeeWelfare.AccumulationFund.Base,
                                                accountOperator.Name,
                                                _Employee.EmployeeWelfare.AccumulationFund.SupplyAccount,
                                                _Employee.EmployeeWelfare.AccumulationFund.SupplyBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.YangLaoBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.ShiYeBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.YiLiaoBase,
                                                _DalEmployeeWelfare, _DalEmployeeWelfareHistory);
                    SaveEmployeeWelfare.Excute();
                }

                //员工自定义流程
                if (_Employee.DiyProcessList != null)
                {
                    SaveEmployeeDiyProcess saveProcess =
                        new SaveEmployeeDiyProcess(_Employee.Account.Id, _Employee.DiyProcessList);
                    saveProcess.Excute();
                }
                //员工调休规则
                if (_Employee.AdjustRule != null)
                {
                    new EditEmployeeAdjustRule(_Employee.Account.Id, _Employee.AdjustRule).Excute();
                }
                //记录员工的历史,再次加载信息,为了拍下当时的部门信息(部门名字,部门主管)
                _Employee.Account.Dept = _IDepartmentBll.GetDepartmentById(_Employee.Account.Dept.Id, null);
                //记录员工的历史
                EmployeeHistory employeeHistory =
                    new EmployeeHistory(_Employee, DateTime.Now, accountOperator, "");
                _DalEmployeeHistory.CreateEmployeeHistory(employeeHistory);
                ts.Complete();
            }
        }
Exemple #5
0
        protected override void ExcuteSelf()
        {
            List <Department> departmentList = _IDepartmentBll.GetAllDepartment();

            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
            {
                List <DepartmentHistory> departmentHistoryList = new List <DepartmentHistory>();
                foreach (Department department in departmentList)
                {
                    DepartmentHistory departmentHistory = new DepartmentHistory();
                    departmentHistory.Department = _IDepartmentBll.GetDepartmentById(department.Id, null);
                    departmentHistory.Department.ParentDepartment = _IDepartmentBll.GetParentDept(department.Id, null);
                    if (departmentHistory.Department.ParentDepartment == null)
                    {
                        departmentHistory.Department.ParentDepartment =
                            new Department(0, new Account(0, "", ""), "", null);
                    }
                    departmentHistory.OperationTime = _DtNow;
                    departmentHistory.Operator      = _OperatorAccount;
                    departmentHistoryList.Add(departmentHistory);
                }
                _DalDepartmentHistory.InsertDepartmentHistory(departmentHistoryList);
                ts.Complete();
            }
        }
Exemple #6
0
 private void PrepareData()
 {
     _AssessActivity = _DalAssessActivity.GetAssessActivityById(_AssessActivityId);
     _AssessActivity.ItsEmployee.Account =
         BllInstance.AccountBllInstance.GetAccountById(_AssessActivity.ItsEmployee.Account.Id);
     _AssessActivity.ItsEmployee.Account.Dept =
         _IDepartmentBll.GetDepartmentById(_AssessActivity.ItsEmployee.Account.Dept.Id, null);
 }
        private string GetLeaderNameByDepartmentId(string id)
        {
            string retVal = null;
            int    theId;

            if (!int.TryParse(id, out theId))
            {
                return(retVal);
            }
            return(_IDepartmentBll.GetDepartmentById(theId, null).DepartmentLeader.Name);
        }
 public void BindMonthAttendanceList(object source, EventArgs e)
 {
     if (CheckValid())
     {
         try
         {
             List <Employee> employeeMonthAttendanceList =
                 _IEmployeeAttendanceStatisticsFacade.GetMonthAttendanceStatisticsFacade(
                     _IMonthAttendanceView.EmployeeName,
                     _IMonthAttendanceView.SelectedDepartment, _IMonthAttendanceView.GradesId,
                     dtFromDate, dtToDate, _Operator, HrmisPowers.A507);
             //列表中没有查出当前员工的信息时,满足一下两个条件的任何一个,再次加载当前员工的信息
             //1.所选部门是当前员工的部门
             //2.所选部门包含当前员工的部门
             //如现实数据中王莎莉登录,无任何权限,只可看自己的信息
             if (_Operator.Name.Contains(_IMonthAttendanceView.EmployeeName) &&
                 !HrmisUtility.IsEmployeeListContainEmployee(employeeMonthAttendanceList, _Operator.Id))
             {
                 bool getnow = true;
                 if (_IMonthAttendanceView.SelectedDepartment != _Operator.Dept.Id)
                 {
                     Department selectedDept =
                         _IDepartmentBll.GetDepartmentById(_IMonthAttendanceView.SelectedDepartment, null);
                     if (!selectedDept.IsExistDept(_Operator.Dept.Id))
                     {
                         getnow = false;
                     }
                 }
                 if (_IMonthAttendanceView.GradesId != null && _Operator.GradesID != _IMonthAttendanceView.GradesId)
                 {
                     getnow = false;
                 }
                 if (getnow)
                 {
                     GetCurrEmployeeMonthAttendance(employeeMonthAttendanceList);
                 }
             }
             _IMonthAttendanceView.EmployeeMonthAttendanceList = employeeMonthAttendanceList;
             _IMonthAttendanceView.ScopeDateFrom = _IMonthAttendanceView.FromDate;
             _IMonthAttendanceView.ScopeDateTo   = _IMonthAttendanceView.ToDate;
             _IMonthAttendanceView.Message       =
                 "<span class='font14b'>共有 </span>"
                 + "<span class='fontred'>" + _IMonthAttendanceView.EmployeeMonthAttendanceList.Count + "</span>"
                 + "<span class='font14b'> 条统计记录</span>";
         }
         catch (ApplicationException ex)
         {
             _IMonthAttendanceView.Message = "<span class='fontred'>" + ex.Message + "</span>";
         }
     }
 }
        private void PrepareData()
        {
            _AssessActivity = _DalAssessActivity.GetAssessActivityById(_AssessActivityId);
            _AssessActivity.ItsEmployee.Account =
                BllInstance.AccountBllInstance.GetAccountById(_AssessActivity.ItsEmployee.Account.Id);
            List <AssessActivityItem> assessActivityItems =
                _AssessActivity.ItsAssessActivityPaper.FindManagerAssessActivityItems();

            //todo yyb
            _AssessActivity.ItsAssessActivityPaper.ItsAssessActivityItems.Clear();
            _AssessActivity.ItsAssessActivityPaper.ItsAssessActivityItems = assessActivityItems;
            _AssessActivity.ItsEmployee.Account.Dept =
                _IDepartmentBll.GetDepartmentById(_AssessActivity.ItsEmployee.Account.Dept.Id, null);
        }
Exemple #10
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 private void PrepareData()
 {
     foreach (Model.AssessActivity activity in _AssessActivityList)
     {
         activity.ItsEmployee = new GetEmployee().GetEmployeeByAccountID(activity.ItsEmployee.Account.Id);
         activity.ItsEmployee.Account.Dept =
             _IDepartmentBll.GetDepartmentById(activity.ItsEmployee.Account.Dept.Id, null);
         if (activity.ItsEmployee.Account.Position.Grade != null)
         {
             activity.ItsEmployee.Account.Position.Grade =
                 _IPositionBll.GetPositionGradeById(activity.ItsEmployee.Account.Position.Grade.Id, null);
         }
     }
 }
Exemple #11
0
        /// <summary>
        /// 获得系统中所有公司
        /// </summary>
        /// <returns></returns>
        public List <Department> GetAllCompanyHaveEmployee()
        {
            List <Department> deptRet        = new List <Department>();
            List <Department> departmentList = _dalEmployee.GetAllCompanyHaveEmployee();

            for (int i = 0; i < departmentList.Count; i++)
            {
                Department dept = _IDepartmentBll.GetDepartmentById(departmentList[i].Id, null);
                if (dept != null)
                {
                    deptRet.Add(dept);
                }
            }
            return(deptRet);
        }
Exemple #12
0
        public void UpdateEvent()
        {
            //数据验证过程
            if (!new DepartmentVaildater(_ItsView).Vaildate())
            {
                return;
            }
            //数据收集过程
            Department theObject = new Department(Convert.ToInt32(_ItsView.DepartmentID), _ItsView.DepartmentName);

            new DepartmentDataCollector(_ItsView).CompleteTheObject(theObject);
            //执行事务过程
            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    Department theOldObject =
                        _DepartmentBll.GetDepartmentById(Convert.ToInt32(_ItsView.DepartmentID), null);
                    _DepartmentBll.UpdateDept(theObject, _LoginUser);
                    if (CompanyConfig.HasHrmisSystem)
                    {
                        if (theOldObject.Name != theObject.Name ||
                            theOldObject.Leader.Id != theObject.Leader.Id || theOldObject.Address != theObject.Address || theOldObject.Phone != theObject.Phone || theOldObject.Fax != theObject.Fax || theOldObject.FoundationTime != theObject.FoundationTime || theOldObject.Others != theObject.Others || theOldObject.Description != theObject.Description
                            )
                        {
                            IDepartmentHistoryFacade hrmisDepartmentHistoryFacade =
                                new DepartmentHistoryFacade();
                            hrmisDepartmentHistoryFacade.AddDepartmentHistory(_LoginUser);
                        }
                        if (theOldObject.Name != theObject.Name || theOldObject.Address != theObject.Address || theOldObject.Phone != theObject.Phone || theOldObject.Fax != theObject.Fax || theOldObject.FoundationTime != theObject.FoundationTime || theOldObject.Others != theObject.Others)
                        {
                            IEmployeeHistoryFacade hrmisEmployeeHistoryFacade =
                                new EmployeeHistoryFacade();
                            hrmisEmployeeHistoryFacade.AddEmployeeHistoryByDepartment(theObject, _LoginUser);
                        }
                    }
                    ts.Complete();
                }
                _ItsView.ActionSuccess = true;
            }
            catch (ApplicationException ae)
            {
                _ItsView.Message = ae.Message;
            }
        }
Exemple #13
0
        /// <summary>
        /// 为employee填充account的信息,其中包括account中的dept
        /// </summary>
        /// <param name="accountID"></param>
        /// <param name="employee"></param>
        /// <param name="_IAccountBll"></param>
        /// <returns></returns>
        /// <param name="_IDepartmentBll"></param>
        public static Employee SetEmployeeAccountInfo(int accountID, Employee employee, IAccountBll _IAccountBll,
                                                      IDepartmentBll _IDepartmentBll)
        {
            PositionGrade grade = null;

            if (employee.Account != null && employee.Account.Position != null &&
                employee.Account.Position.Grade != null)
            {
                grade = employee.Account.Position.Grade;
            }
            employee.Account = _IAccountBll.GetAccountById(accountID);
            if (grade != null)
            {
                employee.Account.Position.Grade = grade;
            }
            employee.Account.Dept = _IDepartmentBll.GetDepartmentById(employee.Account.Dept.Id, null);

            return(employee);
        }
Exemple #14
0
        ///<summary>
        ///</summary>
        ///<param name="accountID"></param>
        ///<param name="employee"></param>
        ///<param name="_IAccountBll"></param>
        ///<param name="_IDepartmentBll"></param>
        ///<param name="_IPositionBll"></param>
        ///<returns></returns>
        public static Employee SetEmployeeAccountInfo(int accountID, Employee employee, IAccountBll _IAccountBll,
                                                      IDepartmentBll _IDepartmentBll, IPositionBll _IPositionBll)
        {
            int gradeID = -1;

            if (employee.Account.Position != null && employee.Account.Position.Grade != null)
            {
                gradeID = employee.Account.Position.Grade.Id;
            }

            employee.Account = _IAccountBll.GetAccountById(accountID);
            if (employee.Account.Position != null)
            {
                employee.Account.Position = _IPositionBll.GetPositionById(employee.Account.Position.Id, null);

                employee.Account.Position.Grade =
                    _IPositionBll.GetPositionGradeById(gradeID, null);
            }
            employee.Account.Dept = _IDepartmentBll.GetDepartmentById(employee.Account.Dept.Id, null);

            return(employee);
        }
        public PositionApplication GetPositionApplicationByPKID(int pkid)
        {
            PositionApplication positionApplication = _PositionApplicationDal.GetPositionApplicationByPKID(pkid);

            positionApplication.Account = _IAccountBll.GetAccountById(positionApplication.Account.Id);
            if (positionApplication != null &&
                positionApplication.Position != null &&
                positionApplication.Position.Grade != null)
            {
                positionApplication.Position.Grade =
                    BllInstance.PositionBllInstance.GetPositionGradeById(positionApplication.Position.Grade.Id, null);
            }

            if (positionApplication != null &&
                positionApplication.Position != null &&
                positionApplication.Position.Nature != null)
            {
                for (int i = 0; i < positionApplication.Position.Nature.Count; i++)
                {
                    positionApplication.Position.Nature[i] =
                        BllInstance.PositionBllInstance.GetPositionNatureById(
                            positionApplication.Position.Nature[i].Pkid);
                }
            }

            for (int i = 0; i < positionApplication.Position.Members.Count; i++)
            {
                positionApplication.Position.Members[i] =
                    _IAccountBll.GetAccountById(positionApplication.Position.Members[i].Id);
            }
            for (int i = 0; i < positionApplication.Position.Departments.Count; i++)
            {
                positionApplication.Position.Departments[i] =
                    _IDepartmentBll.GetDepartmentById(positionApplication.Position.Departments[i].Id, null);
            }
            return(positionApplication);
        }
 public Department Get(long id)
 {
     return(departmentBll.GetDepartmentById(id));
 }
Exemple #17
0
        private List <Employee> LoadAndCompareAllEmployeeInfo(List <Employee> employeeList,
                                                              List <SearchField> otherSearchFieldList, bool isSearched, string partConst)
        {
            if ((otherSearchFieldList.Count > 0 && !isSearched) ||
                (otherSearchFieldList.Count == 0 && isSearched))
            {
                switch (partConst)
                {
                //加载员工基本信息,帐号信息
                case EmployeeFieldPara.EmployeeBasicInfoPart:
                    foreach (Employee employee in employeeList)
                    {
                        if (employee.EmployeeDetails != null)
                        {
                            employee.EmployeeDetails.Photo = null;
                        }
                        LoadSEPInfo.SetEmployeeAccountInfo(employee.Account.Id, employee, _IAccountBll,
                                                           _IDepartmentBll, _IPositionBll);
                        if (employee.EmployeeDetails != null &&
                            employee.EmployeeDetails.Work != null &&
                            employee.EmployeeDetails.Work.Company != null &&
                            employee.EmployeeDetails.Work.Company.Name != null &&
                            employee.EmployeeDetails.Work.Company.Name == "")
                        {
                            employee.EmployeeDetails.Work.Company =
                                _IDepartmentBll.GetDepartmentById(employee.EmployeeDetails.Work.Company.Id, null);
                        }
                    }
                    employeeList =
                        HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _OperationAccount,
                                                          HrmisPowers.A401);
                    break;

                //加载员工福利信息
                case EmployeeFieldPara.EmployeeWelfarePart:
                    foreach (Employee employee in employeeList)
                    {
                        employee.EmployeeWelfare =
                            new GetEmployeeWelfare(_IEmployeeWelfareHistory, _IEmployeeWelfare).
                            GetEmployeeWelfareByAccountID(
                                employee.Account.Id);
                    }
                    break;

                //加载员工国籍信息
                case EmployeeFieldPara.CountryNationalityPart:
                    foreach (Employee employee in employeeList)
                    {
                        if (employee.EmployeeDetails != null && employee.EmployeeDetails.CountryNationality != null)
                        {
                            employee.EmployeeDetails.CountryNationality =
                                new GetNationality().GetNationalityByPkid(
                                    employee.EmployeeDetails.CountryNationality.ParameterID);
                        }
                    }
                    break;

                //加载员工自定义流程信息
                case EmployeeFieldPara.DiyProcessPart:
                    foreach (Employee employee in employeeList)
                    {
                        employee.DiyProcessList =
                            new GetDiyProcess(_IDiyProcessDal, _IEmployeeDiyProcessDal, _IAccountBll, _IDepartmentBll).
                            GetEmployeeDiyProcesses(employee.Account.Id);
                    }
                    break;

                //加载员工年假信息
                case EmployeeFieldPara.VacationPart:
                    foreach (Employee employee in employeeList)
                    {
                        employee.EmployeeAttendance          = employee.EmployeeAttendance ?? new EmployeeAttendance();
                        employee.EmployeeAttendance.Vacation =
                            new GetVacation().GetLastVacationByAccountID(employee.Account.Id);
                    }
                    break;

                //加载员工调休信息
                case EmployeeFieldPara.AdjustPart:
                    foreach (Employee employee in employeeList)
                    {
                        employee.EmployeeAttendance = employee.EmployeeAttendance ?? new EmployeeAttendance();
                        employee.EmployeeAttendance.MonthAttendance = employee.EmployeeAttendance.MonthAttendance ?? new MonthAttendance();
                        employee.EmployeeAttendance.MonthAttendance.HoursofAdjustRestRemained =
                            new GetAdjustRest().GetNowAdjustRestByAccountID(employee.Account.Id).SurplusHours;
                    }
                    break;

                //加载员工技能信息
                case EmployeeFieldPara.SkillPart:
                    foreach (Employee employee in employeeList)
                    {
                        try
                        {
                            employee.EmployeeSkills =
                                _dalEmployeeSkill.GetEmployeeSkillByAccountID(employee.Account.Id
                                                                              , "", -1,
                                                                              SkillLevelEnum.All).EmployeeSkills;
                        }
                        catch
                        {
                        }
                    }
                    break;

                default:
                    break;
                }
                if (!isSearched)
                {
                    _EmployeeDoSearch = new EmployeeDoSearch(employeeList, otherSearchFieldList);
                    _EmployeeDoSearch.DoSearchExecute();
                    employeeList = _EmployeeDoSearch.EmployeeList;
                }
            }
            return(employeeList);
        }
 public Department Get(long id)
 {
     //return departmentProvider.GetById(id);
     return(departmentBll.GetDepartmentById(id));
 }
        private void Search(NameValueCollection parameters)
        {
            List <ControlError>  errors            = new List <ControlError>();
            List <EmployeeModel> EmployeeModelList = new List <EmployeeModel>();
            string EmployeeName = parameters["EmployeeName"];
            int    employeeType = Convert.ToInt32(parameters["employeeType"]);
            int    positionID   = Convert.ToInt32(parameters["positionID"]);
            int    departmentID = Convert.ToInt32(parameters["departmentID"]);
            int?   gradesID     = Convert.ToInt32(parameters["gradesID"]);

            if (gradesID < 0)
            {
                gradesID = null;
            }
            int    EmployeeStatusId    = Convert.ToInt32(parameters["EmployeeStatusId"]);
            string recursionDepartment = parameters["recursionDepartment"];
            string ageFrom             = parameters["ageFrom"];
            string ageTo = parameters["ageTo"];

            try
            {
                ValidateAge(ageFrom, ageTo);
                EmployeeTypeEnum _employeeType =
                    EmployeeTypeUtility.GetEmployeeTypeByID(employeeType);
                List <Employee> _EmployeeList = _IEmployeeFacade.GetEmployeeBasicInfoByBasicConditionWithCompanyAge(
                    EmployeeName,
                    _employeeType, positionID, gradesID, departmentID, intAgeFrom, intAgeTo, recursionDepartment == "true",
                    EmployeeStatusId);
                _EmployeeList =
                    HrmisUtility.RemoteUnAuthEmployee(_EmployeeList, AuthType.HRMIS, _Operator, HrmisPowers.A401);
                List <Employee> employees = new List <Employee>();
                foreach (Employee emplyee in _EmployeeList)
                {
                    //根据所属公司id,得到所属公司名称
                    var temp = emplyee;
                    if (temp.EmployeeDetails == null || temp.EmployeeDetails.Work == null ||
                        temp.EmployeeDetails.Work.Company == null)
                    {
                    }
                    else
                    {
                        //todo noted by wsl transfer waiting for modify
                        temp.EmployeeDetails.Work.Company =
                            _IDepartmentBll.GetDepartmentById(
                                temp.EmployeeDetails.Work.Company.Id, new Account());
                    }
                    temp.EmployeeDetails              = temp.EmployeeDetails ?? new EmployeeDetails();
                    temp.EmployeeDetails.Work         = temp.EmployeeDetails.Work ?? new Work();
                    temp.EmployeeDetails.Work.Company = temp.EmployeeDetails.Work.Company ??
                                                        new Department();
                    employees.Add(temp);
                }
                //列表中没有查出当前员工的信息时,满足一下两个条件的任何一个,再次加载当前员工的信息
                //1.所选部门是当前员工的部门
                //2.所选部门包含当前员工的部门
                //如现实数据中王莎莉登录,无任何权限,只可看自己的信息
                if (_Operator.Name.Contains(EmployeeName) &&
                    !HrmisUtility.IsEmployeeListContainEmployee(employees, _Operator.Id))
                {
                    if (departmentID == -1)
                    {
                        GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID);
                    }
                    else if (departmentID != _Operator.Dept.Id)
                    {
                        Department selectedDept =
                            _IDepartmentBll.GetDepartmentById(departmentID, null);
                        if (selectedDept.IsExistDept(_Operator.Dept.Id))
                        {
                            GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID);
                        }
                    }
                    else
                    {
                        GetCurrEmployee(employees, employeeType, positionID, gradesID, departmentID);
                    }
                }
                EmployeeModelList = employees.Select(x => new EmployeeModel
                {
                    PKID         = x.Account.Id,
                    EmployeeName = "<div class='info' pkid='" + SecurityUtil.DECEncrypt(x.Account.Id.ToString()) + "'>" + x.Account.Name + "</div>",
                    EmployeeType = EmployeeTypeUtility.EmployeeTypeDisplay(x.EmployeeType),
                    Department   = x.Account.Dept.Name,
                    Company      = x.EmployeeDetails.Work.Company.Name,
                    Position     = x.Account.Position.Name,
                    WorkTime     =
                        x.EmployeeDetails.Work.ComeDate.ToString("yyyy-MM-dd")
                }).ToList();
            }
            catch (Exception ex)
            {
                errors.Add(new ControlError("lblMessage", ex.Message));
            }
            _ResponseString = PageUtility.FomartSearchString(EmployeeModelList, errors);
        }
        protected override void ExcuteSelf()
        {
            Employee oldemployee = _DalEmployee.GetEmployeeBasicInfoByAccountID(_Employee.Account.Id);

            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
            {
                //保存层级信息
                PositionGrade grade = _Employee.Account.Position.Grade;
                _Employee.Account = _IAccountBll.GetAccountById(_Employee.Account.Id);
                _Employee.Account.Position.Grade = grade;
                //得到后台帐号
                Account accountOperator = _IAccountBll.GetAccountById(_Operatoraccount.Id);
                //更新员工基本信息
                _DalEmployee.UpdateEmployee(_Employee);
                //员工的技能
                _DalEmployeeSkill.UpdateEmployeeSkill(_Employee);
                //员工福利包括历史的新增
                if (_Employee.EmployeeWelfare != null)
                {
                    SaveEmployeeWelfare SaveEmployeeWelfare =
                        new SaveEmployeeWelfare(_Employee.Account.Id, _Employee.EmployeeWelfare.SocialSecurity.Type,
                                                _Employee.EmployeeWelfare.SocialSecurity.Base,
                                                _Employee.EmployeeWelfare.SocialSecurity.EffectiveYearMonth,
                                                _Employee.EmployeeWelfare.AccumulationFund.Account,
                                                _Employee.EmployeeWelfare.AccumulationFund.EffectiveYearMonth,
                                                _Employee.EmployeeWelfare.AccumulationFund.Base,
                                                accountOperator.Name,
                                                _Employee.EmployeeWelfare.AccumulationFund.SupplyAccount,
                                                _Employee.EmployeeWelfare.AccumulationFund.SupplyBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.YangLaoBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.ShiYeBase,
                                                _Employee.EmployeeWelfare.SocialSecurity.YiLiaoBase,
                                                _DalEmployeeWelfare, _DalEmployeeWelfareHistory);
                    SaveEmployeeWelfare.Excute();
                }

                //员工自定义流程
                if (_Employee.DiyProcessList != null)
                {
                    SaveEmployeeDiyProcess saveProcess = new SaveEmployeeDiyProcess(_Employee.Account.Id, _Employee.DiyProcessList);
                    saveProcess.Excute();
                }
                //员工调休规则
                if (_Employee.AdjustRule != null)
                {
                    new EditEmployeeAdjustRule(_Employee.Account.Id, _Employee.AdjustRule).Excute();
                }
                //记录员工的历史,再次加载信息,为了拍下当时的部门信息(部门名字,部门主管)
                _Employee.Account.Dept = _IDepartmentBll.GetDepartmentById(_Employee.Account.Dept.Id, null);
                EmployeeHistory employeeHistory =
                    new EmployeeHistory(_Employee, DateTime.Now, accountOperator, "");
                _DalEmployeeHistory.CreateEmployeeHistory(employeeHistory);

                #region SEP相关

                //修改为离职后,要更新SEP信息
                if (_Employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee &&
                    oldemployee.EmployeeType != EmployeeTypeEnum.DimissionEmployee)
                {
                    _IAccountBll.SetAccountType(_Employee.Account.Id, VisibleType.None, accountOperator);
                }

                #endregion

                ts.Complete();
            }
        }
 // GET: Department/Details/5
 public ActionResult Details(long id)
 {
     ViewData["sessionData"] = new int?[] { HttpContext.Session.GetInt32("admin"), HttpContext.Session.GetInt32("language") };
     return(View(departmentBll.GetDepartmentById(id)));
 }