/// <summary> /// 创建个人绩效单列表 /// </summary> /// <param name="dt">明细表生产的内存数据</param> /// <param name="persons">统计表中的所有员工</param> /// <param name="department">部门</param> /// <param name="month">月分</param> /// <returns>个人绩效单列表</returns> public static List <PersonalPerformance> CreatePersonalPerformance(DataTable dt, List <Person> persons, string department, int month) { string name = ""; string number = ""; int index = 0; PersonalPerformance pp = null; List <PersonalPerformance> pps = new List <PersonalPerformance>(); int rowCount = dt.Rows.Count; try { for (int i = 0; i < rowCount; i++) { //归属条线 if (dt.Rows[i][0] != null && !string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { continue; } //个人绩效 if (dt.Rows[i][1] != null && !string.IsNullOrEmpty(dt.Rows[i][1].ToString())) { name = dt.Rows[i][1].ToString(); //index = name.IndexOf(":"); //name = name.Substring(index + 1).Trim(); //number = dt.Rows[i + 1]["工号"].ToString(); Person person = GetPerson(persons, name, number); if (person == null) { LogHelper.WriteWarnInfo(string.Format("在统计表中没有获取到{0}({1})的信息,已取消为其生成个人绩效单!", name, number)); continue; } pp = new PersonalPerformance(department, month, person); pps.Add(pp); continue; } else { //添加任务信息 string taskName = ""; if (dt.Rows[i]["任务说明"] != null) { taskName = dt.Rows[i]["任务说明"].ToString(); } int taskScore = 0; if (dt.Rows[i]["任务得分"] != null) { int.TryParse(dt.Rows[i]["任务得分"].ToString(), out taskScore); } CTask task = new CTask(taskName, taskScore); pp.Tasks.Add(task); } } return(pps); } catch (Exception) { throw new Exception("创建个人绩效内存数据出错!"); } }
/// <summary> /// 创建个人绩效单列表 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static List <PersonalPerformance> CreatePersonalPerformance(DataTable dt, string department, int month) { string name = ""; string number = ""; int index = 0; PersonalPerformance pp = null; List <PersonalPerformance> pps = new List <PersonalPerformance>(); int rowCount = dt.Rows.Count; try { for (int i = 0; i < rowCount; i++) { //归属条线 if (dt.Rows[i][0] != null && !string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { continue; } //个人绩效 if (dt.Rows[i][1] != null && !string.IsNullOrEmpty(dt.Rows[i][1].ToString())) { name = dt.Rows[i][1].ToString(); index = name.IndexOf(":"); name = name.Substring(index + 1).Trim(); number = dt.Rows[i + 1]["工号"].ToString(); pp = new PersonalPerformance(department, month, new Person(name, number)); pps.Add(pp); continue; } else { //添加任务信息 string taskName = ""; if (dt.Rows[i]["任务说明"] != null) { taskName = dt.Rows[i]["任务说明"].ToString(); } int taskScore = 0; if (dt.Rows[i]["任务得分"] != null) { taskScore = int.Parse(dt.Rows[i]["任务得分"].ToString()); } CTask task = new CTask(taskName, taskScore); pp.Tasks.Add(task); } } return(pps); } catch (Exception) { throw new Exception("创建个人绩效内存数据出错!"); } }
/// <summary> /// 创建个人绩效单列表 /// </summary> /// <param name="dt">明细表生产的内存数据</param> /// <param name="persons">统计表中的所有员工</param> /// <param name="department">部门</param> /// <param name="month">月分</param> /// <returns>个人绩效单列表</returns> public static List<PersonalPerformance> CreatePersonalPerformanceNew(DataTable dt, List<Person> persons, string department, int month) { string name = ""; string number = ""; //int index = 0; PersonalPerformance pp = null; List<PersonalPerformance> pps = new List<PersonalPerformance>(); int rowCount = dt.Rows.Count; try { for (int i = 0; i < rowCount; i++) { //姓名 if (dt.Rows[i]["姓名"] != null && !string.IsNullOrEmpty(dt.Rows[i]["姓名"].ToString())) { if (name != dt.Rows[i]["姓名"].ToString()) { name = dt.Rows[i]["姓名"].ToString(); Person person = GetPerson(persons, name, number); if (person == null) { LogHelper.WriteWarnInfo(string.Format("在统计表中没有获取到{0}({1})的信息,已取消为其生成个人绩效单!", name, number)); continue; } //添加个人绩效 pp = new PersonalPerformance(department, month, person); pps.Add(pp); } //添加任务列表 string taskName = ""; if (dt.Rows[i]["任务名称"] != null) { taskName = dt.Rows[i]["任务名称"].ToString(); } int taskScore = 0; if (dt.Rows[i]["评分"] != null) { int.TryParse(dt.Rows[i]["评分"].ToString(), out taskScore); } CTask task = new CTask(taskName, taskScore); pp.Tasks.Add(task); } } return pps; } catch (Exception) { throw new Exception("创建个人绩效内存数据出错!"); } }
/// <summary> /// 创建个人绩效单列表 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static List<PersonalPerformance> CreatePersonalPerformance(DataTable dt, string department, int month) { string name = ""; string number = ""; int index = 0; PersonalPerformance pp = null; List<PersonalPerformance> pps = new List<PersonalPerformance>(); int rowCount = dt.Rows.Count; try { for (int i = 0; i < rowCount; i++) { //归属条线 if (dt.Rows[i][0] != null && !string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { continue; } //个人绩效 if (dt.Rows[i][1] != null && !string.IsNullOrEmpty(dt.Rows[i][1].ToString())) { name = dt.Rows[i][1].ToString(); index = name.IndexOf(":"); name = name.Substring(index + 1).Trim(); number = dt.Rows[i + 1]["工号"].ToString(); pp = new PersonalPerformance(department, month, new Person(name, number)); pps.Add(pp); continue; } else { //添加任务信息 string taskName = ""; if (dt.Rows[i]["任务说明"] != null) { taskName = dt.Rows[i]["任务说明"].ToString(); } int taskScore = 0; if (dt.Rows[i]["任务得分"] != null) { taskScore = int.Parse(dt.Rows[i]["任务得分"].ToString()); } CTask task = new CTask(taskName, taskScore); pp.Tasks.Add(task); } } return pps; } catch (Exception) { throw new Exception("创建个人绩效内存数据出错!"); } }