public JsonResult CreateProperty(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrWhiteSpace(model.ServiceCode)) { result.Success = false; result.Message = "EditBizObjectSchemaMethodMap.SelectBiz"; return Json(result, JsonRequestBehavior.AllowGet); } GetServiceMethodMapViewModel(model.MapIndex); H3.DataModel.BizObjectSchemaUtility.CreateProperty(this.Engine.BizBus, this.Schema, this.SelectedMethod, this.SelectedMap.ServiceCode, this.SelectedMap.MethodName, this.SelectedMap); result.Success = this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); if (result.Success) { result.Extend = GetBuldMapGridData(model.ServiceCode, model.MethodName); } return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult MethodNameChange(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } DataModel.ServiceMethodMap buldMap = BuldMap(model.ServiceCode, model.MethodName); if (buldMap == null) { result.Success = false; } else { result.Extend = new { ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return"), }; result.Success = true; } return Json(result, JsonRequestBehavior.AllowGet); })); }
/// <summary> /// 获取业务服务与业务方法映射模型 /// </summary> /// <param name="mapIndex">输入参数</param> /// <returns>业务服务与业务方法映射模型</returns> private ServiceMethodMapViewModel GetServiceMethodMapViewModel(string mapIndex) { ServiceMethodMapViewModel model = new ServiceMethodMapViewModel(); if (string.IsNullOrEmpty(mapIndex)) { mapIndex = "-1"; } string strIndex = mapIndex; if (string.IsNullOrEmpty(strIndex) || strIndex == "-1") { this.SelectedMapIndex = FindSelectedMapIndex("", ""); } else { this.SelectedMapIndex = int.Parse(strIndex); } if (this.SelectedMapIndex > -1 && this.Method.MethodMaps.Length > 0) { this.SelectedMap = this.Method.MethodMaps[this.SelectedMapIndex]; } else { this.SelectedMap = null; } //根据当前业务服务是否绑定映射,控制界面按钮显示 if (this.SelectedMap == null)//新增 { model.IsSelectMap = false; model.ExeCondition = string.Empty; model.ServiceCode = ""; } else//编辑 { model.ServiceCode = this.SelectedMap.ServiceCode; model.MethodName = this.SelectedMap.MethodName; model.ExeCondition = this.SelectedMap.ExeCondition; model.IsSelectMap = true; model.MapIndex = mapIndex; } model.MethodType = this.MethodType; model.SchemaCode = this.SchemaCode; model.Method = this.SelectedMethod; return(model); }
public JsonResult DelServiceMethodMap(string schemaCode, string method, string methodType, string mapIndex) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(schemaCode, method, methodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } ServiceMethodMapViewModel model = GetServiceMethodMapViewModel(mapIndex); this.Schema.GetMethod(this.SelectedMethod).RemoveMethodMap(this.SelectedMapIndex); result.Success = this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); result.Extend = GetServiceMethodMapList(); return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult SaveServiceMethodMap(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrWhiteSpace(model.ServiceCode)) { result.Success = false; result.Message = "EditBizObjectSchemaMethodMap.SelectBiz"; return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrWhiteSpace(model.MethodName)) { result.Success = false; result.Message = "EditBizObjectSchemaMethodMap.SelectMethodName"; return Json(result, JsonRequestBehavior.AllowGet); } GetServiceMethodMapViewModel(model.MapIndex);//初始化this.SelectedMap if (this.SelectedMap == null) { this.Schema.GetMethod(this.SelectedMethod).AddMethodMap(BuldMap(model.ServiceCode, model.MethodName)); } this.SelectedMap = this.Schema.GetMethod(this.SelectedMethod).MethodMaps.FirstOrDefault(p => p.ServiceCode == model.ServiceCode && p.MethodName == model.MethodName); this.SelectedMap.ExeCondition = model.ExeCondition; // 保存 if (!this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema)) { result.Success = false; result.Message = "msgGlobalString.SaveFailed"; return Json(result, JsonRequestBehavior.AllowGet); } result.Success = true; result.Message = "msgGlobalString.SaveSuccess"; this.SelectedMapIndex = this.Schema.GetMethod(this.SelectedMethod).MethodMaps.Length - 1; model = GetServiceMethodMapViewModel(this.SelectedMapIndex.ToString()); result.Extend = model; return Json(result, JsonRequestBehavior.AllowGet); })); }
/// <summary> /// 获取业务服务与业务方法映射模型列表 /// </summary> /// <returns>业务服务与业务方法映射模型列表</returns> private object GetServiceMethodMapList() { var griddata = new object { }; if (string.IsNullOrWhiteSpace(this.SelectedMethod)) { return(griddata); } List <ServiceMethodMapViewModel> list = new List <ServiceMethodMapViewModel>(); foreach (DataModel.ServiceMethodMap map in Method.MethodMaps) { ServiceMethodMapViewModel model = new ServiceMethodMapViewModel(); model.ServiceCode = map.ServiceCode; model.MethodName = map.MethodName; model.MethodType = this.Engine.BizBus.GetBizRule(map.ServiceCode) == null ? "ServiceMethod" : "RuleMethod"; list.Add(model); } griddata = new { Rows = list, total = list.Count }; return(griddata); }
public JsonResult GetServiceMethodMap(string mapIndex, string schemaCode, string method, string methodType) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(schemaCode, method, methodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } int isLocked = BizWorkflowPackageLockByID(this.SchemaCode); ServiceMethodMapViewModel model = GetServiceMethodMapViewModel(mapIndex); List <Item> serviceCodes = GetServiceCodesList(); List <Item> methodNames = null; if (methodType.Equals("RuleMethod", StringComparison.OrdinalIgnoreCase)) {// 业务规则 methodNames = GetBizRuleMethodNamesList(model.ServiceCode); } else { methodNames = GetMethodNamesList(model.ServiceCode); } DataModel.ServiceMethodMap buldMap = BuldMap(model.ServiceCode, model.MethodName); result.Extend = new { ServiceMethodMap = model, ServiceCodes = serviceCodes, MethodNames = methodNames, ParamGridData = GetGridData(buldMap, "param"), ReturnGridData = GetGridData(buldMap, "return"), IsLocked = isLocked }; return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult UpgradeServiceMethodMap(ServiceMethodMapViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); result = ParseParam(model.SchemaCode, model.Method, model.MethodType); if (!result.Success) { return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrWhiteSpace(model.ServiceCode)) { result.Success = false; result.Message = "EditBizObjectSchemaMethodMap.SelectBiz"; return Json(result, JsonRequestBehavior.AllowGet); } GetServiceMethodMapViewModel(model.MapIndex); H3.DataModel.MethodGroupSchema methodGroup = this.Schema.GetMethod(this.SelectedMethod); H3.DataModel.ServiceMethodMap map = null; if (methodGroup.MethodType == H3.DataModel.MethodType.Normal || methodGroup.MethodType == H3.DataModel.MethodType.Static) { // 获得最新的方法 H3.BizBus.BizService.MethodSchema methodSchema = this.Engine.BizBus.GetMethod(this.SelectedMap.ServiceCode, this.SelectedMap.MethodName); if (methodSchema == null) { result.Success = false; return Json(result, JsonRequestBehavior.AllowGet); } map = new DataModel.ServiceMethodMap( this.SelectedMap.ServiceCode, methodSchema); } else if (methodGroup.MethodType == H3.DataModel.MethodType.Filter) { // 获得最新的搜索方法 H3.BizBus.Filter.FilterSchema filterSchema = this.Engine.BizBus.GetFilterSchema(this.SelectedMap.ServiceCode, this.SelectedMap.MethodName); if (filterSchema == null) { result.Success = false; return Json(result, JsonRequestBehavior.AllowGet); } map = new DataModel.ServiceMethodMap( this.SelectedMap.ServiceCode, filterSchema); } else { throw new NotImplementedException(); } map.ExeCondition = model.ExeCondition; // 更新方法的参数映射 if (map.ParamMaps != null) { H3.DataModel.DataMap[] dataMaps = map.ParamMaps.ToArray(); if (dataMaps != null) { foreach (H3.DataModel.DataMap dataMap in dataMaps) { dataMap.MapTo = this.SelectedMap.ParamMaps.GetMappingPropertyName(dataMap.ItemName); } } } // 更新方法的返回值映射 if (map.ReturnMaps != null) { H3.DataModel.DataMap[] dataMaps = map.ReturnMaps.ToArray(); if (dataMaps != null) { foreach (H3.DataModel.DataMap dataMap in dataMaps) { dataMap.MapTo = this.SelectedMap.ReturnMaps.GetMappingPropertyName(dataMap.ItemName); } } } // 更新的方法集合中 this.Schema.GetMethod(this.SelectedMethod).RemoveMethodMap(this.SelectedMapIndex); this.Schema.GetMethod(this.SelectedMethod).InsertMethodMap(this.SelectedMapIndex, map); result.Success = this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); if (result.Success) { result.Extend = new { ParamGridData = GetGridData(map, "param"), ReturnGridData = GetGridData(map, "return") }; } return Json(result, JsonRequestBehavior.AllowGet); })); }