Beispiel #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();
            }
        }
        private void ValueItemInOneRow(int rowindex, DataTable dt, EmployeeWelfare welfare)
        {
            SocialSecurityTypeEnum socialSecurityType = welfare.SocialSecurity.Type;
            decimal? socialBase    = welfare.SocialSecurity.Base;
            decimal? yangLaoBase   = welfare.SocialSecurity.YangLaoBase;
            decimal? shiYeBase     = welfare.SocialSecurity.ShiYeBase;
            decimal? yiLiaoBase    = welfare.SocialSecurity.YiLiaoBase;
            DateTime?socialYM      = welfare.SocialSecurity.EffectiveYearMonth;
            string   fundAccount   = welfare.AccumulationFund.Account;
            DateTime?fundYM        = welfare.AccumulationFund.EffectiveYearMonth;
            decimal? fundBase      = welfare.AccumulationFund.Base;
            string   operationName = _Operator.Name;
            string   supplyAccount = welfare.AccumulationFund.SupplyAccount;
            decimal? supplyBase    = welfare.AccumulationFund.SupplyBase;

            string SsocialSecurityType = ImportUtility.GetItem(dt, rowindex, EmployeeWelfare.ConstParemeter.SocialType);

            if (SsocialSecurityType != ImportUtility.EmptyNull)
            {
                socialSecurityType = ConvertToSocialSecurityTypeEnum(SsocialSecurityType);
            }

            socialBase    = GetDecimal(dt, rowindex, socialBase, EmployeeWelfare.ConstParemeter.SocialBase);
            yangLaoBase   = GetDecimal(dt, rowindex, yangLaoBase, EmployeeWelfare.ConstParemeter.YangLaoBase);
            shiYeBase     = GetDecimal(dt, rowindex, shiYeBase, EmployeeWelfare.ConstParemeter.ShiYeBase);
            yiLiaoBase    = GetDecimal(dt, rowindex, yiLiaoBase, EmployeeWelfare.ConstParemeter.YiLiaoBase);
            socialYM      = GetYM(dt, rowindex, socialYM, EmployeeWelfare.ConstParemeter.SocialYM);
            fundAccount   = GetString(dt, rowindex, fundAccount, EmployeeWelfare.ConstParemeter.FundAccount);
            fundYM        = GetYM(dt, rowindex, fundYM, EmployeeWelfare.ConstParemeter.FundYM);
            fundBase      = GetDecimal(dt, rowindex, fundBase, EmployeeWelfare.ConstParemeter.FundBase);
            supplyAccount = GetString(dt, rowindex, supplyAccount, EmployeeWelfare.ConstParemeter.SupplyAccount);
            supplyBase    = GetDecimal(dt, rowindex, supplyBase, EmployeeWelfare.ConstParemeter.SupplyBase);

            SaveEmployeeWelfare saveEmployeeWelfare =
                new SaveEmployeeWelfare(welfare.Owner.Id, socialSecurityType, socialBase, socialYM, fundAccount,
                                        fundYM, fundBase, operationName,
                                        supplyAccount, supplyBase, yangLaoBase, shiYeBase, yiLiaoBase);

            saveEmployeeWelfare.Excute();
        }
        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();
            }
        }