/// <summary> /// 根据员工ID获取员工薪资档案信息(为了根据岗位级别和薪资级别排序) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pe_GetSalaryArchiveByEmployeeIDsCompleted(object sender, Saas.Tools.SalaryWS.GetSalaryArchiveByEmployeeIDsCompletedEventArgs e) { try { if (e.Result == null || e.Result.Count == 0 || e.Error != null) { CommonFunction.ShowErrorMessage("调用HR服务返回异常信息(为空表示没有数据):" + e.Error); return; } var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name); List<SMT.Saas.Tools.SalaryWS.T_HR_SALARYARCHIVE> listSalay = e.Result.ToList(); List<T_FB_PERSONMONEYASSIGNDETAIL> perLIst = new List<T_FB_PERSONMONEYASSIGNDETAIL>(); foreach (var item in details) { var itemFBEntity = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL; listSalay.ForEach(it => { if (itemFBEntity.OWNERID == it.OWNERID) { itemFBEntity.CREATEUSERNAME = Convert.ToString(it.POSTLEVEL);//目前把岗位级别存为创建人字段 itemFBEntity.UPDATEUSERNAME = Convert.ToString(it.SALARYLEVEL);//把薪资级别存在更新热字段,目前表里面没有相应字段 } }); // 写这蛋疼的代码,为了填这个坑:为了下面orderby...ThenBy不报错。 itemFBEntity.CREATEUSERNAME = "******";//目前把岗位级别存为创建人字段 itemFBEntity.UPDATEUSERNAME = "******";//把薪资级别存在更新热字段,目前表里面没有相应字段 var find = listSalay.FirstOrDefault(it => it.OWNERID == itemFBEntity.OWNERID); if (find != null) { itemFBEntity.CREATEUSERNAME = Convert.ToString(find.POSTLEVEL);//目前把岗位级别存为创建人字段 itemFBEntity.UPDATEUSERNAME = Convert.ToString(find.SALARYLEVEL);//把薪资级别存在更新热字段,目前表里面没有相应字段 } perLIst.Add(itemFBEntity); } System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine(""); perLIst = perLIst.OrderBy(t => t.OWNERCOMPANYNAME).ThenBy(t => t.OWNERDEPARTMENTNAME).ThenBy(t => Convert.ToDecimal(t.CREATEUSERNAME)).ToList();//先公司部门排序 //perLIst = perLIst.OrderBy(t => Convert.ToDecimal(t.CREATEUSERNAME)).ThenBy(t => Convert.ToDecimal(t.UPDATEUSERNAME)).ToList();//再岗位薪资级别排序 var fbEntity = perLIst.ToFBEntityList(); DetailGrid dgrid = this.EditForm.FindControl("OrderGrid") as DetailGrid; if (dgrid != null) { dgrid.ClearValue(DetailGrid.ItemsSourceProperty); dgrid.ItemsSource = fbEntity; } this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name).Clear(); fbEntity.ForEach(item => { item.FBEntityState = FBEntityState.Modified;//因为清除了数据,所以得要加上状态 T_FB_PERSONMONEYASSIGNDETAIL perDetail = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL; perDetail.T_FB_PERSONMONEYASSIGNMASTER = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;//设置主表关联 }); this.OrderEntity.FBEntity.AddFBEntities<T_FB_PERSONMONEYASSIGNDETAIL>(fbEntity);//加载数据 var detailss = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);//获取数据 for (int i = 0; i < details.Count; i++) { (details[i].Entity as T_FB_PERSONMONEYASSIGNDETAIL).RowIndex = i + 1;//序号 } } catch (Exception ex) { CommonFunction.ShowErrorMessage("调用HR服务返回异常信息:" + ex.ToString()); } finally { this.CloseProcess(); } }