/// <summary> /// 构造操作管理中的操作编辑 数据源 /// </summary> /// <returns></returns> public Result GenerateResourceEditForOperation(string moduleID) { Result result = new Result(); var specifiedModule = moduleBll.GetModuleByID(moduleID); try { //初始化module 基本属性 var module_ViewModel = new Module_Readonly_Model(); module_ViewModel.Instance(specifiedModule); #region 构造与当前module关联的Operations. return operationList_ViewModel //Operation 模型列表 var operationList_ViewModel = new List <Operation_Readonly_Model>(); //Operation 实体列表 var operationList = operationBll.GetOperationByModuleID(moduleID); //使用 Operation 实体列表 初始化 Operation 模型列表 operationList.ForEach(o => { var operation_ViewModel = new Operation_Readonly_Model(); operation_ViewModel.Instance(o); operationList_ViewModel.Add(operation_ViewModel); }); #endregion #region 构造基础CRUD Operations. return operationBasedList_ViewModel(因数据库表结构暂时不变更,暂时取消基本操作列) ////Operation 模型列表 //var operationBasedList_ViewModel = new List<Operation_Readonly_Model>(); ////Operation 实体列表 //var operationBasedList = operationBll.GetAllOperation(o => o.IsBasedOp && o.IsEnable && !o.IsDelete); ////使用 Operation 实体列表 初始化 Operation 模型列表 //operationBasedList.ForEach(o => //{ // //基础 Operation中排除已选Operation中存在的 // if (operationList.FirstOrDefault(op => op.ID == o.ID) == null) // { // var operationBased_ViewModel = new Operation_Readonly_Model(); // operationBased_ViewModel.Instance(o); // operationBasedList_ViewModel.Add(operationBased_ViewModel); // } //}); #endregion //初始化Module 视图模型关联的OperationLst属性 module_ViewModel.OperationLst = operationList_ViewModel; //初始化Module 视图模型关联的OperationLst属性 //module_ViewModel.BaseOperationLst = operationBasedList_ViewModel; result.Message = ""; result.IsSucess = true; result.ResultCode = 0; result.Datas = JsonConvert.SerializeObject(module_ViewModel); } catch (Exception ex) { result.Message = ex.Message; result.IsSucess = false; result.ResultCode = 1; } return(result); }