private static void RechieveItsPaper(AssessActivity assessActivity) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AssessActivityID, SqlDbType.Int).Value = assessActivity.AssessActivityID; using ( SqlDataReader sdr = SqlHelper.ExecuteReader("GetAssessActivityPaperById", cmd)) { while (sdr.Read()) { SubmitInfo submitInfo = new SubmitInfo(); submitInfo.Choose = sdr[_DbChoseIntention].ToString(); submitInfo.Comment = sdr[_DbContent].ToString(); submitInfo.FillPerson = sdr[_DbFillPerson].ToString(); submitInfo.StepIndex = Convert.ToInt32(sdr[_DbStepIndex]); submitInfo.SubmitTime = Convert.ToDateTime(sdr[_DbSubmitTime]); submitInfo.SalaryNow = EmployeeWelfare.ConvertToDecimal(sdr[_DbSalaryNow]); submitInfo.SalaryChange = EmployeeWelfare.ConvertToDecimal(sdr[_DbSalaryChange]); submitInfo.SubmitInfoType = SubmitInfoType.RechieveSubmitInfoTypeByID(Convert.ToInt32(sdr[_DbType])); assessActivity.ItsAssessActivityPaper.SubmitInfoes.Add(submitInfo); int paperID = Convert.ToInt32(sdr[_DbPKID]); submitInfo.SubmitInfoID = paperID; RechieveItsSubmitInfo(paperID, submitInfo); } } }
/// <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); }
private void Import(DataTable dt) { List <EmployeeWelfare> employeeWelfarelist = new List <EmployeeWelfare>(); List <Employee> employeeList = new GetEmployee().GetEmployeeBasicInfoByBasicCondition("", EmployeeTypeEnum.All, -1, -1, true, -1); employeeList = HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Operator, HrmisPowers.A605); if (employeeList != null) { foreach (Employee employee in employeeList) { EmployeeWelfare welfare = _DalEmployeeWelfare.GetEmployeeWelfareByAccountID(employee.Account.Id); if (welfare == null) { welfare = EmployeeWelfare.EmptyWelfare(); } welfare.Owner = employee.Account; employeeWelfarelist.Add(welfare); } } ValueItemsAndSave(employeeWelfarelist, dt); }
protected override void ExcuteSelf() { EmployeeWelfare employeeWelfareDatabase = _EmployeeWelfareDal.GetEmployeeWelfareByAccountID(_EmployeeID); if (!_EmployeeWelfare.Equals(employeeWelfareDatabase)) { try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { if (employeeWelfareDatabase == null) { _EmployeeWelfareID = _EmployeeWelfareDal.InsertEmployeeWelfareByAccountID(_EmployeeWelfare, _EmployeeID); } else { _EmployeeWelfareDal.UpdateEmployeeWelfareByAccountID(_EmployeeWelfare, _EmployeeID); } new CreateEmployeeWelfareHistoryByAccountID(_EmployeeWelfare, _EmployeeID, _OperationName, DateTime.Now, _EmployeeWelfareHistoryDal).Excute(); ts.Complete(); } } catch { BllUtility.ThrowException(BllExceptionConst._DbError); } } }
/// <summary> /// /// </summary> /// <param name="employeeWelfare"></param> /// <param name="accountID"></param> /// <returns></returns> public int UpdateEmployeeWelfareByAccountID(EmployeeWelfare employeeWelfare, int accountID) { SqlCommand cmd = new SqlCommand(); EditParameters(cmd, employeeWelfare, accountID); return(SqlHelper.ExecuteNonQuery("UpdateEmployeeWelfareByAccountID", cmd)); }
/// <summary> /// /// </summary> /// <param name="employeeWelfare"></param> /// <param name="accountID"></param> /// <returns></returns> public int InsertEmployeeWelfareByAccountID(EmployeeWelfare employeeWelfare, int accountID) { int pkid; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Direction = ParameterDirection.Output; EditParameters(cmd, employeeWelfare, accountID); SqlHelper.ExecuteNonQueryReturnPKID("InsertEmployeeWelfareByAccountID", cmd, out pkid); return(pkid); }
private static decimal?ConvertToDecimal(string s) { if (!string.IsNullOrEmpty(s)) { decimal temp; if (!decimal.TryParse(s, out temp)) { throw new ApplicationException(string.Format("数据:{0} 格式错误", s)); } } return(EmployeeWelfare.ConvertToDecimal(s)); }
private static DateTime?ConvertToDateTime(string s) { if (!string.IsNullOrEmpty(s)) { DateTime temp; if (!DateTime.TryParse(s, out temp)) { throw new ApplicationException(string.Format("数据:{0} 格式错误", s)); } } return(EmployeeWelfare.ConvertToDateTime(s)); }
/// <summary> /// 补充公积金基数 /// </summary> private static decimal GetAccumulationFundSupplyBase(EmployeeWelfare employeeWelfare) { if (employeeWelfare != null) { if (employeeWelfare.AccumulationFund != null) { if (employeeWelfare.AccumulationFund.SupplyBase != null) { return(Convert.ToDecimal(employeeWelfare.AccumulationFund.SupplyBase)); } } } return(0); }
/// <summary> /// /// </summary> /// <param name="cmd"></param> /// <param name="employeeWelfare"></param> /// <param name="accountID"></param> public static void EditParameters(SqlCommand cmd, EmployeeWelfare employeeWelfare, int accountID) { cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_SocialSecurityType, SqlDbType.Int).Value = employeeWelfare.SocialSecurity.Type != null ? (object) employeeWelfare.SocialSecurity.Type.Id : DBNull.Value; cmd.Parameters.Add(_SocialSecurityBase, SqlDbType.Decimal).Value = employeeWelfare.SocialSecurity.Base.HasValue ? (object)employeeWelfare.SocialSecurity.Base : DBNull.Value; cmd.Parameters.Add(_YangLaoBase, SqlDbType.Decimal).Value = employeeWelfare.SocialSecurity.YangLaoBase.HasValue ? (object)employeeWelfare.SocialSecurity.YangLaoBase : DBNull.Value; cmd.Parameters.Add(_YiLiaoBase, SqlDbType.Decimal).Value = employeeWelfare.SocialSecurity.YiLiaoBase.HasValue ? (object)employeeWelfare.SocialSecurity.YiLiaoBase : DBNull.Value; cmd.Parameters.Add(_ShiYeBase, SqlDbType.Decimal).Value = employeeWelfare.SocialSecurity.ShiYeBase.HasValue ? (object)employeeWelfare.SocialSecurity.ShiYeBase : DBNull.Value; cmd.Parameters.Add(_SocialSecurityEffectiveYearMonth, SqlDbType.DateTime).Value = employeeWelfare.SocialSecurity.EffectiveYearMonth.HasValue ? (object)employeeWelfare.SocialSecurity.EffectiveYearMonth : DBNull.Value; cmd.Parameters.Add(_AccumulationFundAccount, SqlDbType.NVarChar, 255).Value = employeeWelfare.AccumulationFund.Account != null ? (object)employeeWelfare.AccumulationFund.Account : DBNull.Value; cmd.Parameters.Add(_AccumulationFundSupplyAccount, SqlDbType.NVarChar, 255).Value = employeeWelfare.AccumulationFund.SupplyAccount != null ? (object)employeeWelfare.AccumulationFund.SupplyAccount : DBNull.Value; cmd.Parameters.Add(_AccumulationFundSupplyBase, SqlDbType.Decimal).Value = employeeWelfare.AccumulationFund.SupplyBase.HasValue ? (object)employeeWelfare.AccumulationFund.SupplyBase : DBNull.Value; cmd.Parameters.Add(_AccumulationFundBase, SqlDbType.Decimal).Value = employeeWelfare.AccumulationFund.Base.HasValue ? (object)employeeWelfare.AccumulationFund.Base : DBNull.Value; cmd.Parameters.Add(_AccumulationFundEffectiveMonthYear, SqlDbType.DateTime).Value = employeeWelfare.AccumulationFund.EffectiveYearMonth.HasValue ? (object)employeeWelfare.AccumulationFund.EffectiveYearMonth : DBNull.Value; }
public static SubmitInfo Convert(AssessActivityPaperEntity entity) { return(new SubmitInfo { Choose = entity.ChoseIntention, Comment = entity.Content, FillPerson = entity.FillPerson, StepIndex = entity.StepIndex.GetValueOrDefault(), SubmitTime = entity.SubmitTime, SalaryNow = EmployeeWelfare.ConvertToDecimal(entity.SalaryNow), SalaryChange = EmployeeWelfare.ConvertToDecimal(entity.SalaryChange), SubmitInfoType = SubmitInfoType.RechieveSubmitInfoTypeByID(entity.Type), SubmitInfoID = entity.PKID, AssessActivityID = entity.AssessActivityID }); }
private void TemplateBuildStringWriter(Application excel) { excel.Cells[1, 1] = EmployeeWelfare.ConstParemeter.Name; excel.Cells[1, 2] = EmployeeWelfare.ConstParemeter.SocialType; excel.Cells[1, 3] = EmployeeWelfare.ConstParemeter.SocialBase; excel.Cells[1, 4] = EmployeeWelfare.ConstParemeter.SocialYM; excel.Cells[1, 5] = EmployeeWelfare.ConstParemeter.FundAccount; excel.Cells[1, 6] = EmployeeWelfare.ConstParemeter.FundBase; excel.Cells[1, 7] = EmployeeWelfare.ConstParemeter.FundYM; excel.Cells[1, 8] = EmployeeWelfare.ConstParemeter.SupplyAccount; excel.Cells[1, 9] = EmployeeWelfare.ConstParemeter.SupplyBase; excel.Cells[1, 10] = EmployeeWelfare.ConstParemeter.YangLaoBase; excel.Cells[1, 11] = EmployeeWelfare.ConstParemeter.ShiYeBase; excel.Cells[1, 12] = EmployeeWelfare.ConstParemeter.YiLiaoBase; for (int i = 0; i < EmployeeWelfareListViewState.Count; i++) { int j = i + 2; excel.Cells[j, 1] = EmployeeWelfareListViewState[i].Owner.Name; excel.Cells[j, 2] = EmployeeWelfareListViewState[i].SocialSecurity.Type.Name; excel.Cells[j, 3] = EmployeeWelfareListViewState[i].SocialSecurity.Base; if (EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth != null) { List <string> SocialSecurityYearMonth = EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth); excel.Cells[j, 4] = string.Format("{0}年{1}月", SocialSecurityYearMonth[0], SocialSecurityYearMonth[1]); } excel.Cells[j, 5] = "'" + EmployeeWelfareListViewState[i].AccumulationFund.Account; excel.Cells[j, 6] = EmployeeWelfareListViewState[i].AccumulationFund.Base; if (EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth != null) { List <string> AccumulationFundYearMonth = EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth); excel.Cells[j, 7] = string.Format("{0}年{1}月", AccumulationFundYearMonth[0], AccumulationFundYearMonth[1]); } excel.Cells[j, 8] = "'" + EmployeeWelfareListViewState[i].AccumulationFund.SupplyAccount; excel.Cells[j, 9] = EmployeeWelfareListViewState[i].AccumulationFund.SupplyBase; excel.Cells[j, 10] = EmployeeWelfareListViewState[i].SocialSecurity.YangLaoBase; excel.Cells[j, 11] = EmployeeWelfareListViewState[i].SocialSecurity.ShiYeBase; excel.Cells[j, 12] = EmployeeWelfareListViewState[i].SocialSecurity.YiLiaoBase; } }
/// <summary> /// 城镇保险基数、城市保险基数、综合保险基数 /// </summary> /// <param name="employeeWelfare"></param> /// <param name="type"></param> /// <returns></returns> private static decimal GetSocialSecurityBaseByType(EmployeeWelfare employeeWelfare, ParameterBase type) { if (employeeWelfare != null) { if (employeeWelfare.SocialSecurity != null) { if (employeeWelfare.SocialSecurity.Base != null) { if (employeeWelfare.SocialSecurity.Type.Name == type.Name) { return(Convert.ToDecimal(employeeWelfare.SocialSecurity.Base)); } } } } return(0); }
/// <summary> /// 保存员工福利信息构造函数 /// </summary> public SaveEmployeeWelfare(int employeeID, SocialSecurityTypeEnum socialSecurityType, decimal?socialSecurityBase, DateTime?socialSecurityEffectiveYearMonth, string accumulationFundAccount, DateTime?accumulationFundEffectiveYearMonth, decimal?accumulationFundBase, string operationName, string accumulationFundSupplyAccount, decimal?accumulationFundSupplyBase, decimal?yangLaoBase, decimal?shiYeBase, decimal?yiLiaoBase) { _EmployeeID = employeeID; EmployeeSocialSecurity employeeSocialSecurity = new EmployeeSocialSecurity(socialSecurityType, socialSecurityBase, socialSecurityEffectiveYearMonth, yangLaoBase, shiYeBase, yiLiaoBase); EmployeeAccumulationFund employeeAccumulationFund = new EmployeeAccumulationFund(accumulationFundAccount, accumulationFundBase, accumulationFundEffectiveYearMonth, accumulationFundSupplyAccount, accumulationFundSupplyBase); _EmployeeWelfare = new EmployeeWelfare(employeeSocialSecurity, employeeAccumulationFund); _OperationName = operationName; }
private void CollectWelfareInfo() { EmployeeSocialSecurity employeeSocialSecurity = new EmployeeSocialSecurity(_ItsView.SocialSecurityType, EmployeeWelfare.ConvertToDecimal(_ItsView.SocialSecurityBase), EmployeeWelfare.ConvertToDateTime(_ItsView.SocialSecurityYearMonth), EmployeeWelfare.ConvertToDecimal(_ItsView.YangLaoBase), EmployeeWelfare.ConvertToDecimal(_ItsView.ShiYeBase), EmployeeWelfare.ConvertToDecimal(_ItsView.YiLiaoBase)); EmployeeAccumulationFund employeeAccumulationFund = new EmployeeAccumulationFund(_ItsView.AccumulationFundAccount, EmployeeWelfare.ConvertToDecimal(_ItsView.AccumulationFundBase), EmployeeWelfare.ConvertToDateTime(_ItsView.AccumulationFundYearMonth), _ItsView.AccumulationFundSupplyAccount, EmployeeWelfare.ConvertToDecimal(_ItsView.AccumulationFundSupplyBase)); _TheEmployeeToComplete.EmployeeWelfare = new EmployeeWelfare(employeeSocialSecurity, employeeAccumulationFund); }
private bool HandleWelfare() { if (_TheDataToBind.EmployeeWelfare != null) { _ItsView.AccumulationFundBase = _TheDataToBind.EmployeeWelfare.AccumulationFund.Base.ToString(); _ItsView.AccumulationFundAccount = _TheDataToBind.EmployeeWelfare.AccumulationFund.Account; _ItsView.AccumulationFundSupplyAccount = _TheDataToBind.EmployeeWelfare.AccumulationFund.SupplyAccount; _ItsView.AccumulationFundSupplyBase = _TheDataToBind.EmployeeWelfare.AccumulationFund.SupplyBase.ToString(); _ItsView.AccumulationFundYearMonth = EmployeeWelfare.YearAndMonth(_TheDataToBind.EmployeeWelfare.AccumulationFund.EffectiveYearMonth); _ItsView.SocialSecurityBase = _TheDataToBind.EmployeeWelfare.SocialSecurity.Base.ToString(); _ItsView.YangLaoBase = _TheDataToBind.EmployeeWelfare.SocialSecurity.YangLaoBase.ToString(); _ItsView.ShiYeBase = _TheDataToBind.EmployeeWelfare.SocialSecurity.ShiYeBase.ToString(); _ItsView.YiLiaoBase = _TheDataToBind.EmployeeWelfare.SocialSecurity.YiLiaoBase.ToString(); _ItsView.SocialSecurityType = _TheDataToBind.EmployeeWelfare.SocialSecurity.Type; _ItsView.SocialSecurityYearMonth = EmployeeWelfare.YearAndMonth(_TheDataToBind.EmployeeWelfare.SocialSecurity.EffectiveYearMonth); } _ItsView.EmployeeWelfareHistory = _TheDataToBind.EmployeeWelfareHistory; return(true); }
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(); }
/// <summary> /// 城镇保险基数、城市保险基数、综合保险基数、公积金基数、补充公积金基数 /// </summary> /// <param name="accountID"></param> public void GetEmployeeWelfareforBase(int accountID) { EmployeeWelfare employeeWelfare = _GetEmployeeWelfare.GetEmployeeWelfareByAccountID(accountID); if (employeeWelfare != null) { _BindItemValueCollection.SetBindItemValue(BindItemEnum.TownInsuranceBase, GetSocialSecurityBaseByType(employeeWelfare, SocialSecurityTypeEnum. TownInsurance)); _BindItemValueCollection.SetBindItemValue(BindItemEnum.BlanketInsuranceBase, GetSocialSecurityBaseByType(employeeWelfare, SocialSecurityTypeEnum. ComprehensiveInsurance)); _BindItemValueCollection.SetBindItemValue(BindItemEnum.CityInsuranceBase, GetSocialSecurityBaseByType(employeeWelfare, SocialSecurityTypeEnum. CityInsurance)); _BindItemValueCollection.SetBindItemValue(BindItemEnum.AccumulationFundBase, GetAccumulationFundBase(employeeWelfare)); _BindItemValueCollection.SetBindItemValue(BindItemEnum.AccumulationFundSupplyBase, GetAccumulationFundSupplyBase(employeeWelfare)); _BindItemValueCollection.SetBindItemValue(BindItemEnum.YangLaoBase, employeeWelfare.SocialSecurity.YangLaoBase.HasValue ? Convert.ToDecimal( employeeWelfare.SocialSecurity.YangLaoBase) : 0); _BindItemValueCollection.SetBindItemValue(BindItemEnum.ShiYeBase, employeeWelfare.SocialSecurity.ShiYeBase.HasValue ? Convert.ToDecimal( employeeWelfare.SocialSecurity.ShiYeBase) : 0); _BindItemValueCollection.SetBindItemValue(BindItemEnum.YiLiaoBase, employeeWelfare.SocialSecurity.YiLiaoBase.HasValue ? Convert.ToDecimal( employeeWelfare.SocialSecurity.YiLiaoBase) : 0); } }
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); }
private void SearchEmployeeWelfare() { try { List <EmployeeWelfare> employeeWelfarelist = new List <EmployeeWelfare>(); //List<Employee> employeeList = // _IEmployeeFacade.GetEmployeeBasicInfoByBasicCondition(_View.EmployeeName, _View.EmployeeType, // _View.PositionId, _View.DepartmentId, // _View.RecursionDepartment, // Convert.ToInt32(_View.EmployeeStatusId), // _View.CompanyId); //employeeList = // HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Operator, HrmisPowers.A605); List <Employee> employeeList = EmployeeLogic.GetEmployeeBasicInfoByBasicConditionRetModel(_View.EmployeeName, _View.EmployeeType, _View.PositionId, null, _View.DepartmentId, _View.CompanyId, _View.RecursionDepartment, HrmisPowers.A605, _Operator.Id, Convert.ToInt32(_View.EmployeeStatusId), null); if (employeeList != null) { foreach (Employee employee in employeeList) { EmployeeWelfare welfare = _IEmployeeWelfareFacade.GetEmployeeWelfareByAccountID(employee.Account.Id); if (welfare == null) { welfare = EmployeeWelfare.EmptyWelfare(); } welfare.AccumulationFund.BaseTemp = welfare.AccumulationFund.Base == null ? "" : welfare.AccumulationFund.Base.ToString(); welfare.AccumulationFund.SupplyBaseTemp = welfare.AccumulationFund.SupplyBase == null ? "" : welfare.AccumulationFund.SupplyBase.ToString(); welfare.SocialSecurity.BaseTemp = welfare.SocialSecurity.Base == null ? "" : welfare.SocialSecurity.Base.ToString(); welfare.SocialSecurity.YangLaoBaseTemp = welfare.SocialSecurity.YangLaoBase == null ? "" : welfare.SocialSecurity.YangLaoBase.ToString(); welfare.SocialSecurity.ShiYeBaseTemp = welfare.SocialSecurity.ShiYeBase == null ? "" : welfare.SocialSecurity.ShiYeBase.ToString(); welfare.SocialSecurity.YiLiaoBaseTemp = welfare.SocialSecurity.YiLiaoBase == null ? "" : welfare.SocialSecurity.YiLiaoBase.ToString(); welfare.AccumulationFund.EffectiveYearMonthTemp = EmployeeWelfare.YearAndMonth(welfare.AccumulationFund.EffectiveYearMonth); welfare.SocialSecurity.EffectiveYearMonthTemp = EmployeeWelfare.YearAndMonth(welfare.SocialSecurity.EffectiveYearMonth); welfare.Owner = employee.Account; employeeWelfarelist.Add(welfare); } } _View.EmployeeWelfareList = employeeWelfarelist; _View.Message = string.Format( "<span class='font14b'>共查到 </span><span class='fontred'>{0}</span><span class='font14b'> 条信息</span>", employeeList == null ? 0 : employeeList.Count); } catch (Exception ex) { _View.Message = string.Format("<span class='fontred'>{0}</span>", ex.Message); } }
protected void btnExport_Click(object sender, EventArgs e) { var workbook = new HSSFWorkbook(); MemoryStream ms = new MemoryStream(); HSSFSheet sheet = workbook.CreateSheet() as HSSFSheet; HSSFRow headerRow = sheet.CreateRow(0) as HSSFRow; headerRow.CreateCell(0).SetCellValue(EmployeeWelfare.ConstParemeter.Name); headerRow.CreateCell(1).SetCellValue(EmployeeWelfare.ConstParemeter.SocialType); headerRow.CreateCell(2).SetCellValue(EmployeeWelfare.ConstParemeter.SocialBase); headerRow.CreateCell(3).SetCellValue(EmployeeWelfare.ConstParemeter.SocialYM); headerRow.CreateCell(4).SetCellValue(EmployeeWelfare.ConstParemeter.FundAccount); headerRow.CreateCell(5).SetCellValue(EmployeeWelfare.ConstParemeter.FundBase); headerRow.CreateCell(6).SetCellValue(EmployeeWelfare.ConstParemeter.FundYM); headerRow.CreateCell(7).SetCellValue(EmployeeWelfare.ConstParemeter.SupplyAccount); headerRow.CreateCell(8).SetCellValue(EmployeeWelfare.ConstParemeter.SupplyBase); headerRow.CreateCell(9).SetCellValue(EmployeeWelfare.ConstParemeter.YangLaoBase); headerRow.CreateCell(10).SetCellValue(EmployeeWelfare.ConstParemeter.ShiYeBase); headerRow.CreateCell(11).SetCellValue(EmployeeWelfare.ConstParemeter.YiLiaoBase); // handling value. int rowIndex = 1; for (int i = 0; i < EmployeeWelfareListViewState.Count; i++) { HSSFRow dataRow = sheet.CreateRow(rowIndex) as HSSFRow; dataRow.CreateCell(0).SetCellValue(EmployeeWelfareListViewState[i].Owner.Name); dataRow.CreateCell(1).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.Type.Name); dataRow.CreateCell(2).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.Base.ToString()); if (EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth != null) { List <string> SocialSecurityYearMonth = EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth); dataRow.CreateCell(3).SetCellValue(string.Format("{0}年{1}月", SocialSecurityYearMonth[0], SocialSecurityYearMonth[1])); } dataRow.CreateCell(4).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.Account); dataRow.CreateCell(5).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.Base.ToString()); if (EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth != null) { List <string> AccumulationFundYearMonth = EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth); dataRow.CreateCell(6).SetCellValue(string.Format("{0}年{1}月", AccumulationFundYearMonth[0], AccumulationFundYearMonth[1])); } dataRow.CreateCell(7).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.SupplyAccount); dataRow.CreateCell(8).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.SupplyBase.ToString()); dataRow.CreateCell(9).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.YangLaoBase.ToString()); dataRow.CreateCell(10).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.ShiYeBase.ToString()); dataRow.CreateCell(11).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.YiLiaoBase.ToString()); rowIndex++; } workbook.Write(ms); ms.Flush(); ms.Position = 0; sheet = null; headerRow = null; workbook = null; ExcelExportUtility.OutputExcel(Server, Response, "员工福利表", ms); // Export("员工福利表.xls"); }
private bool Vaildate(EmployeeWelfare welfare) { bool valid = true; decimal dctemp; if (!string.IsNullOrEmpty(welfare.AccumulationFund.BaseTemp) && !decimal.TryParse(welfare.AccumulationFund.BaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.AccumulationFund.BaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.AccumulationFund.BaseTemp)) { welfare.AccumulationFund.Base = null; } else { welfare.AccumulationFund.Base = Convert.ToDecimal(welfare.AccumulationFund.BaseTemp); } } if (!string.IsNullOrEmpty(welfare.AccumulationFund.SupplyBaseTemp) && !decimal.TryParse(welfare.AccumulationFund.SupplyBaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.AccumulationFund.SupplyBaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.AccumulationFund.SupplyBaseTemp)) { welfare.AccumulationFund.SupplyBase = null; } else { welfare.AccumulationFund.SupplyBase = Convert.ToDecimal(welfare.AccumulationFund.SupplyBaseTemp); } } if (!string.IsNullOrEmpty(welfare.SocialSecurity.BaseTemp) && !decimal.TryParse(welfare.SocialSecurity.BaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.SocialSecurity.BaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.SocialSecurity.BaseTemp)) { welfare.SocialSecurity.Base = null; } else { welfare.SocialSecurity.Base = Convert.ToDecimal(welfare.SocialSecurity.BaseTemp); } } if (!string.IsNullOrEmpty(welfare.SocialSecurity.YangLaoBaseTemp) && !decimal.TryParse(welfare.SocialSecurity.YangLaoBaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.SocialSecurity.YangLaoBaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.SocialSecurity.YangLaoBaseTemp)) { welfare.SocialSecurity.YangLaoBase = null; } else { welfare.SocialSecurity.YangLaoBase = Convert.ToDecimal(welfare.SocialSecurity.YangLaoBaseTemp); } } if (!string.IsNullOrEmpty(welfare.SocialSecurity.ShiYeBaseTemp) && !decimal.TryParse(welfare.SocialSecurity.ShiYeBaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.SocialSecurity.ShiYeBaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.SocialSecurity.ShiYeBaseTemp)) { welfare.SocialSecurity.ShiYeBase = null; } else { welfare.SocialSecurity.ShiYeBase = Convert.ToDecimal(welfare.SocialSecurity.ShiYeBaseTemp); } } if (!string.IsNullOrEmpty(welfare.SocialSecurity.YiLiaoBaseTemp) && !decimal.TryParse(welfare.SocialSecurity.YiLiaoBaseTemp, out dctemp)) { _ValideMessage = string.Format("{0}{1};", _ValideMessage, welfare.SocialSecurity.YiLiaoBaseTemp); valid = false; } else { if (string.IsNullOrEmpty(welfare.SocialSecurity.YiLiaoBaseTemp)) { welfare.SocialSecurity.YiLiaoBase = null; } else { welfare.SocialSecurity.YiLiaoBase = Convert.ToDecimal(welfare.SocialSecurity.YiLiaoBaseTemp); } } if (!WelfareInfoVaildater.YearMonthOK(welfare.AccumulationFund.EffectiveYearMonthTemp)) { _ValideMessage = string.Format("{0}{1}年-{2}月;", _ValideMessage, welfare.AccumulationFund.EffectiveYearMonthTemp[0], welfare.AccumulationFund.EffectiveYearMonthTemp[1]); valid = false; } else { welfare.AccumulationFund.EffectiveYearMonth = EmployeeWelfare.ConvertToDateTime(welfare.AccumulationFund.EffectiveYearMonthTemp); } if (!WelfareInfoVaildater.YearMonthOK(welfare.SocialSecurity.EffectiveYearMonthTemp)) { _ValideMessage = string.Format("{0}{1}年-{2}月;", _ValideMessage, welfare.SocialSecurity.EffectiveYearMonthTemp[0], welfare.SocialSecurity.EffectiveYearMonthTemp[1]); valid = false; } else { welfare.SocialSecurity.EffectiveYearMonth = EmployeeWelfare.ConvertToDateTime(welfare.SocialSecurity.EffectiveYearMonthTemp); } return(valid); }