示例#1
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();
            }
        }
        public void Add(EmployeeHistory employeeHistory)
        {
            using (var context = new ElysiumContext())
            {
                context.EmployeeHistory.Add(employeeHistory);

                context.SaveChanges();
            }
        }
 public void Edit(EmployeeHistory employeeHistory)
 {
     using (var context = new ElysiumContext())
     {
         var dbEmployeeHistory = context.EmployeeHistory.Find(employeeHistory.Id);
         context.Entry(dbEmployeeHistory).CurrentValues.SetValues(employeeHistory);
         context.SaveChanges();
     }
 }
示例#4
0
        /// <summary>
        /// 通过员工历史表ID得到员工所有信息
        /// </summary>
        /// <param name="employeeHistoryID"></param>
        /// <returns></returns>
        public EmployeeHistory GetEmployeeHistoryByEmployeeHistoryID(int employeeHistoryID)
        {
            EmployeeHistory history = _dalEmployeeHistory.GetEmployeeHistoryByEmployeeHistoryID(employeeHistoryID);

            if (history != null)
            {
                history.Employee.Account.Position = _IPositionHistory.GetPositionByPositionIDAndDateTime(history.Employee.Account.Position.Id,
                                                                                                         history.OperationTime);
            }
            return(history);
        }
        private void BackUpEmployee()
        {
            List <Employee> employeelist =
                _GetEmployee.GetEmployeeByBasicCondition("", EmployeeTypeEnum.All, _Position.ParameterID, -1, false);

            foreach (Employee employee in employeelist)
            {
                EmployeeHistory employeeHistory =
                    new EmployeeHistory(employee, _DtNow, _OperatorAccount, "职位修改生成员工历史");
                _DalEmployeeHistory.CreateEmployeeHistory(employeeHistory);
            }
        }
示例#6
0
        /// <summary>
        /// 获得员工离职时刻的信息
        /// </summary>
        public Employee GetEmployeeAtLeaveDate(int accountID, bool onlyBasicInfo)
        {
            EmployeeHistory eh =
                onlyBasicInfo
                    ? _dalEmployeeHistory.GetEmployeeHistoryBasicInfoAtLeaveDate(accountID)
                    : _dalEmployeeHistory.GetEmployeeHistoryAtLeaveDate(accountID);

            if (eh != null)
            {
                return(eh.Employee);
            }
            return(null);
        }
示例#7
0
        /// <summary>
        /// 获得员工某一时刻的最新信息
        /// </summary>
        public Employee GetEmployeeByDate(int accountID, bool onlyBasicInfo, DateTime date)
        {
            EmployeeHistory eh =
                onlyBasicInfo
                    ? _dalEmployeeHistory.GetEmployeeHistoryBasicInfoByDateTime(accountID, date)
                    : _dalEmployeeHistory.GetEmployeeHistoryByDateTime(accountID, date);

            if (eh != null)
            {
                return(eh.Employee);
            }
            return(null);
        }
        public void Delete(Guid Id)
        {
            using (var context = new ElysiumContext())
            {
                var employeeHistory = new EmployeeHistory()
                {
                    Id = Id
                };
                context.EmployeeHistory.Remove(employeeHistory);

                context.SaveChanges();
            }
        }
        public ActionResult Edit(TeacherLogModel model)
        {
            EmployeeHistory teacherLog = new EmployeeHistory()
            {
                Description = model.Description,
                Date = model.ModifiedDate,
                EmployeeId = model.TeacherId,
                TraineeId = model.StudentId,
                IsDeleted = false
            };
            _serviceTeacherChange.Insert(teacherLog);

            var student = _serviceStudent.GetById(model.StudentId);
            student.EmployeeHistories.OrderByDescending(x=>x.Date).FirstOrDefault().EmployeeId = model.TeacherId;
            _serviceStudent.Update(student);

            return RedirectToAction("StudentInterviews","Interview");
        }
        //Delete an existing data entry
        public async Task <Employee> DeleteAsync(int?id)
        {
            try
            {
                var getEmpId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.EmpId).ToListAsync();

                var getMonthlyIncomeId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.MonthlyIncomeId).ToListAsync();

                var getHistoryId = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.EmpHistoryId).ToListAsync();

                var getUserEmail = await Employee.Where(f => f.EmployeeNumber == id).Select(f => f.Emp.Email).FirstAsync();

                var employee = await Employee.FindAsync(id);

                var employeedetails = await EmployeeDetails.FindAsync(getEmpId.ElementAt(0));

                var costtocompany = await CostToCompany.FindAsync(getMonthlyIncomeId.ElementAt(0));

                var employeehistory = await EmployeeHistory.FindAsync(getHistoryId.ElementAt(0));

                var getAllEmails = await AspNetUsers.Select(a => a.Email).ToListAsync();

                //Employee.Remove(employee);
                EmployeeDetails.Remove(employeedetails);
                CostToCompany.Remove(costtocompany);
                EmployeeHistory.Remove(employeehistory);

                if (getAllEmails.Contains(getUserEmail))
                {
                    var empRoleEmail = await AspNetUsers.Where(a => a.Email == getUserEmail).FirstAsync();

                    AspNetUsers.Remove(empRoleEmail);
                }

                await SaveChangesAsync();

                return(employee);
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }
        }
示例#11
0
 /// <summary>
 /// 변경 내역 남기기
 /// </summary>
 private async Task AddEmployeeHistory(Employee employee)
 {
     try
     {
         var history = new EmployeeHistory()
         {
             EmployeeId = employee.Id,
             FirstName  = employee.FirstName,
             LastName   = employee.LastName,
             Address    = employee.Address,
             CreatedAt  = DateTime.Now,
             Email      = employee.Email,
             Gender     = employee.Gender,
         };
         _employeeContext.Add(history);
         await _employeeContext.SaveChangesAsync();
     }
     catch (System.Exception)
     {
     }
 }
 public bool Update(EmployeeHistory entity)
 {
     _db.EmployeeHistories.Update(entity);
     return(Save());
 }
 public bool Delete(EmployeeHistory entity)
 {
     _db.EmployeeHistories.Remove(entity);
     return(Save());
 }
 public bool Create(EmployeeHistory entity)
 {
     _db.EmployeeHistories.Add(entity);
     return(Save());
 }
 public long InsertEmployeeHistory(EmployeeHistory employeeHistory)
 {
     return(this._employeeHistoryDAO.Insert(employeeHistory));
 }
 public void UpdateEmployeeHistory(int id, EmployeeHistory employeeHistory)
 {
     this._employeeHistoryDAO.Update <int>(id, employeeHistory);
 }
示例#17
0
 public void UpdateEmployeeHistory(EmployeeHistory theEmployeeHistory)
 {
     throw new Exception("The method or operation is not implemented.");
 }
示例#18
0
 public int CreateEmployeeHistory(EmployeeHistory aNewEmployeeHistory)
 {
     return(1);
 }