/// <summary> /// 考虑到存在指标类别、类型名称转代码的问题 /// 合并绩效目标实现情况数据,从预算明细表获取表格模板数据,从绩效明细表获取自评完成值和自评得分 /// </summary> /// <param name="budgetDtlPerformTarget">预算绩效目标实现集合</param> /// <param name="performanceDtlTarImpl">绩效目标实现情况集合</param> /// <returns></returns> public List <PerformanceDtlTarImplModel> ConvertSaveData(IList <BudgetDtlPerformTargetModel> budgetDtlPerformTarget, IList <PerformanceDtlTarImplModel> performanceDtlTarImpl) { List <PerformanceDtlTarImplModel> result = new List <PerformanceDtlTarImplModel>(); if (budgetDtlPerformTarget != null && budgetDtlPerformTarget.Count > 0) { if (performanceDtlTarImpl != null && performanceDtlTarImpl.Count > 0) { for (int i = 0; i < performanceDtlTarImpl.Count; i++) { PerformanceDtlTarImplModel performanceDtlTar = performanceDtlTarImpl[i]; BudgetDtlPerformTargetModel budgetDtlPerform = budgetDtlPerformTarget.First(t => t.FTargetName == performanceDtlTar.FTargetName); performanceDtlTarImpl[i].FTargetTypeCode = budgetDtlPerform.FTargetTypeCode; performanceDtlTarImpl[i].FTargetClassCode = budgetDtlPerform.FTargetClassCode; result.Add(performanceDtlTar); } } } return(result); }
/// <summary> /// BudgetDtlPerformTargetModel转换成PerformanceDtlTarImplModel /// </summary> /// <param name="list">预算绩效目标实现集合</param> /// <returns></returns> public IList <PerformanceDtlTarImplModel> ConvertData(IList <BudgetDtlPerformTargetModel> list) { IList <PerformanceDtlTarImplModel> result = new List <PerformanceDtlTarImplModel>(); if (list != null) { for (int i = 0; i < list.Count; i++) { BudgetDtlPerformTargetModel budgetModel = list[i]; PerformanceDtlTarImplModel performModel = new PerformanceDtlTarImplModel(); performModel.XmPhid = budgetModel.XmPhId; performModel.FTargetCode = budgetModel.FTargetCode; performModel.FTargetName = budgetModel.FTargetName; performModel.FTargetContent = budgetModel.FTargetContent; performModel.FTargetValue = budgetModel.FTargetValue; performModel.FTargetWeight = Convert.ToDecimal(budgetModel.FTargetWeight); performModel.FTargetDescribe = budgetModel.FTargetDescribe; //代码转名称 string typeCode = budgetModel.FTargetTypeCode; string classCode = budgetModel.FTargetClassCode; Dictionary <string, object> dicWhere1 = new Dictionary <string, object>(); Dictionary <string, object> dicWhere2 = new Dictionary <string, object>(); new CreateCriteria(dicWhere1).Add(ORMRestrictions <string> .Eq("FCode", typeCode)); FindedResults <PerformEvalTargetTypeModel> typeModel = PerformEvalTargetTypeFacade.Find(dicWhere1); new CreateCriteria(dicWhere2).Add(ORMRestrictions <string> .Eq("FCode", classCode)); FindedResults <PerformEvalTargetClassModel> classModel = PerformEvalTargetClassFacade.Find(dicWhere2); if (typeModel != null && typeModel.Data.Count > 0) { performModel.FTargetTypeCode = typeModel.Data[0].FName; } if (classModel != null && classModel.Data.Count > 0) { performModel.FTargetClassCode = classModel.Data[0].FName; } performModel.FIfCustom = budgetModel.FIfCustom; result.Add(performModel); } } return(result); }
/// <summary> /// 将预算表中的BudgetDtlPerformTargetModel集合组装成绩效的PerformanceDtlTarImplModel集合 /// </summary> /// <param name="list">预算绩效集合</param> /// <param name="performanceMst">绩效主对象</param> /// <returns></returns> public IList <PerformanceDtlTarImplModel> ConvertData2(IList <BudgetDtlPerformTargetModel> list, PerformanceMstModel performanceMst) { IList <PerformanceDtlTarImplModel> result = new List <PerformanceDtlTarImplModel>(); if (list != null && list.Count > 0) { //根据申报组织获取绩效基础数据,为后续数据准备 var allTypes = this.PerformEvalTargetTypeFacade.Find(t => t.Orgcode == performanceMst.FDeclarationUnit).Data; var allClasses = this.PerformEvalTargetClassFacade.Find(t => t.Orgcode == performanceMst.FDeclarationUnit).Data; for (int i = 0; i < list.Count; i++) { BudgetDtlPerformTargetModel budgetModel = list[i]; PerformanceDtlTarImplModel performModel = new PerformanceDtlTarImplModel(); performModel.XmPhid = budgetModel.XmPhId; performModel.FTargetCode = budgetModel.FTargetCode; performModel.FTargetName = budgetModel.FTargetName; performModel.FTargetContent = budgetModel.FTargetContent; performModel.FTargetValue = budgetModel.FTargetValue; performModel.FTargetWeight = Convert.ToDecimal(budgetModel.FTargetWeight); performModel.FTargetDescribe = budgetModel.FTargetDescribe; performModel.FTargetTypeCode = budgetModel.FTargetTypeCode; performModel.FTargetClassCode = budgetModel.FTargetClassCode; //代码转名称 string typeCode = budgetModel.FTargetTypeCode; string classCode = budgetModel.FTargetClassCode; if (allTypes != null && allTypes.Count > 0) { var typeModel = allTypes.ToList().FindAll(t => t.FCode == typeCode); if (typeModel != null && typeModel.Count > 0) { performModel.FTargetTypeName = typeModel[0].FName; } } if (allClasses != null && allClasses.Count > 0) { var classModel = allClasses.ToList().FindAll(t => t.FCode == classCode); if (classModel != null && classModel.Count > 0) { performModel.FTargetClassName = classModel[0].FName; } } //Dictionary<string, object> dicWhere1 = new Dictionary<string, object>(); //Dictionary<string, object> dicWhere2 = new Dictionary<string, object>(); //new CreateCriteria(dicWhere1).Add(ORMRestrictions<string>.Eq("FCode", typeCode)); //FindedResults<PerformEvalTargetTypeModel> typeModel = PerformEvalTargetTypeFacade.Find(dicWhere1); //new CreateCriteria(dicWhere2).Add(ORMRestrictions<string>.Eq("FCode", classCode)); //FindedResults<PerformEvalTargetClassModel> classModel = PerformEvalTargetClassFacade.Find(dicWhere2); //if (typeModel != null && typeModel.Data.Count > 0) //{ // performModel.FTargetTypeCode = typeModel.Data[0].FName; //} //if (classModel != null && classModel.Data.Count > 0) //{ // performModel.FTargetClassCode = classModel.Data[0].FName; //} performModel.FIfCustom = budgetModel.FIfCustom; result.Add(performModel); } } return(result); }