public static void SychSalaryStep() { foreach (SalStep ss in SalStep.GetAll()) { SalaryStep salStep = AddSalaryStep(ss.集合, ss.薪酬体系, ss.薪等编号, ss.薪级编号, ss.生效日期); if (salStep == null) { continue; } salStep.薪级名称 = ss.薪级名称; salStep.次同步时间 = DateTime.Now; salStep.Save(); } //冲突处理:有VS无 / 有VS变 / 无VS有 foreach (SalaryStep step in GetAll()) { SalStep found = SalStep.GetAll().Find(a => a.集合 == step.集合 && a.薪酬体系 == step.薪酬体系 && a.薪等编号 == step.薪等编号 && a.生效日期 == step.生效日期); if (found == null) { step.Delete(); } } }
//获取值列表 public static List <SalStep> GetAll() { List <SalStep> list = new List <SalStep>(); OleDbConnection conn = new OleDbConnection(MyHelper.GetPsConnectionString()); using (conn) { OleDbDataReader rs = null; try { conn.Open(); using (OleDbCommand cmd = conn.CreateCommand()) { cmd.CommandText = "select SETID, SAL_ADMIN_PLAN, GRADE, EFFDT, STEP, STEP_DESCR from SYSADM.ps_SAL_STEP_TBL"; rs = cmd.ExecuteReader(); while (rs.Read()) { SalStep salStep = new SalStep(); salStep.集合 = (string)rs["setid"]; salStep.薪酬体系 = (string)rs["sal_admin_plan"]; salStep.薪等编号 = (string)rs["grade"]; salStep.生效日期 = Convert.ToDateTime(rs["effdt"]); salStep.薪级编号 = Convert.ToInt32(rs["STEP"]); salStep.薪级名称 = ((string)rs["STEP_DESCR"]).Trim(); list.Add(salStep); } } } finally { if (rs != null) { rs.Close(); } conn.Close(); } } return(list); }