/// <summary>
 /// 记录员工福利历史构造函数
 /// </summary>
 /// <param name="employeeWelfare"></param>
 /// <param name="employeeID"></param>
 /// <param name="operationName"></param>
 /// <param name="dt"></param>
 /// <param name="MockEmployeeWelfareHistory"></param>
 public CreateEmployeeWelfareHistoryByAccountID(EmployeeWelfare employeeWelfare, int employeeID, string operationName,
                                                DateTime dt, IEmployeeWelfareHistory MockEmployeeWelfareHistory)
 {
     _EmployeeWelfareHistoryDal = MockEmployeeWelfareHistory;
     _EmployeeID             = employeeID;
     _EmployeeWelfareHistory = new EmployeeWelfareHistory(employeeWelfare, dt, operationName);
 }
        public int CreateEmployeeWelfareHistoryByAccountID(EmployeeWelfareHistory employeeWelfareHistory, int employeeID)
        {
            int        pkid;
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_PKID, SqlDbType.Int).Direction = ParameterDirection.Output;
            EmployeeWelfareDal.EditParameters(cmd, employeeWelfareHistory.EmployeeWelfare, employeeID);
            cmd.Parameters.Add(_OperationTime, SqlDbType.DateTime).Value         = employeeWelfareHistory.OperationTime;
            cmd.Parameters.Add(_AccountsBackName, SqlDbType.NVarChar, 255).Value =
                employeeWelfareHistory.AccountsBackName;
            SqlHelper.ExecuteNonQueryReturnPKID("CreateEmployeeWelfareHistoryByAccountID", cmd, out pkid);
            return(pkid);
        }
        public List <EmployeeWelfareHistory> GetEmployeeWelfareHistoryByAccountID(int employeeID)
        {
            List <EmployeeWelfareHistory> employeeWelfareHistoryList = new List <EmployeeWelfareHistory>();
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = employeeID;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetEmployeeWelfareHistoryByAccountID", cmd))
            {
                while (sdr.Read())
                {
                    EmployeeSocialSecurity employeeSocialSecurity =
                        new EmployeeSocialSecurity(
                            SocialSecurityTypeEnum.GetById(Convert.ToInt32(sdr[_DbSocialSecurityType] ?? 0)),
                            EmployeeWelfare.ConvertToDecimal(sdr[_DbSocialSecurityBase]),
                            EmployeeWelfare.ConvertToDateTime(sdr[_DbSocialSecurityEffectiveYearMonth]),
                            EmployeeWelfare.ConvertToDecimal(sdr[_DbYangLaoBase]),
                            EmployeeWelfare.ConvertToDecimal(sdr[_DbShiYeBase]),
                            EmployeeWelfare.ConvertToDecimal(sdr[_DbYiLiaoBase]));
                    EmployeeAccumulationFund employeeAccumulationFund =
                        new EmployeeAccumulationFund(EmployeeWelfare.ConvertToString(sdr[_DbAccumulationFundAccount]),
                                                     EmployeeWelfare.ConvertToDecimal(sdr[_DbAccumulationFundBase]),
                                                     EmployeeWelfare.ConvertToDateTime(
                                                         sdr[_DbAccumulationFundEffectiveMonthYear]),
                                                     EmployeeWelfare.ConvertToString(
                                                         sdr[_DbAccumulationFundSupplyAccount]),
                                                     EmployeeWelfare.ConvertToDecimal(
                                                         sdr[_DbAccumulationFundSupplyBase]));

                    EmployeeWelfare employeeWelfare =
                        new EmployeeWelfare(employeeSocialSecurity, employeeAccumulationFund);
                    EmployeeWelfareHistory employeeWelfareHistory =
                        new EmployeeWelfareHistory(Convert.ToInt32(sdr[_DbPKID]), employeeWelfare,
                                                   Convert.ToDateTime(sdr[_DbOperationTime]),
                                                   sdr[_DbAccountsBackName].ToString());
                    employeeWelfareHistoryList.Add(employeeWelfareHistory);
                }
            }
            return(employeeWelfareHistoryList);
        }