public JsonResult GetServiceMethodParamMap(string mapIndex, string schemaCode, string method, string methodType, string paramName, bool isParam)
 {
     return(ExecuteFunctionRun(() =>
     {
         ActionResult result = new ActionResult();
         result = ParseParam(mapIndex, schemaCode, method, methodType, paramName, isParam);
         if (!result.Success)
         {
             return Json(result, JsonRequestBehavior.AllowGet);
         }
         PropertyTreeHandler proTreeHandler = new PropertyTreeHandler(this);
         SchemaMethodParamMapViewModel model = GetSchemaMethodParamMapViewModel();
         model.MapIndex = mapIndex;
         model.SchemaCode = schemaCode;
         model.Method = method;
         result.Extend = new
         {
             PropertyTree = proTreeHandler.GetPropertyTree(schemaCode),
             ParamMap = model,
             MapTypes = new List <Item>()
             {
                 new Item("Property", "0"),
                 new Item("Const", "1")
             }
         };
         return Json(result, JsonRequestBehavior.AllowGet);
     }));
 }
        public JsonResult SaveSErviceMethodParamMap(SchemaMethodParamMapViewModel model)
        {
            return(ExecuteFunctionRun(() =>
            {
                ActionResult result = new ActionResult();
                result = ParseParam(model.MapIndex, model.SchemaCode, model.Method, model.MethodType, model.ParamName, model.IsParam);
                if (!result.Success)
                {
                    return Json(result, JsonRequestBehavior.AllowGet);
                }
                H3.DataModel.DataMapType mapType = (H3.DataModel.DataMapType) int.Parse(model.MapType);
                string mapTo = null;
                switch (mapType)
                {
                case H3.DataModel.DataMapType.Property:
                    if (model.PropertyName != null)
                    {
                        mapTo = model.PropertyName;    // this.lstProperty.SelectedValue;
                        if (mapTo.IndexOf("[") > -1)
                        {
                            mapTo = mapTo.Substring(mapTo.IndexOf("[") + 1);
                        }
                        if (mapTo.IndexOf("]") > -1)
                        {
                            mapTo = mapTo.Substring(0, mapTo.IndexOf("]"));
                        }
                    }
                    break;

                case H3.DataModel.DataMapType.Const:
                    mapTo = model.ConstValue;
                    break;

                default:
                    throw new NotImplementedException();
                }
                if (this.IsParam)
                {
                    this.SelectedMap.ParamMaps.SetMap(this.ParamName, mapType, mapTo);
                }
                else
                {
                    this.SelectedMap.ReturnMaps.SetMap(this.ParamName, mapType, mapTo);
                }

                // 保存
                if (!this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema))
                {
                    result.Success = false;
                    result.Message = "msgGlobalString.SaveFailed";
                    // 保存失败
                    return Json(result, JsonRequestBehavior.AllowGet);
                }
                result.Success = true;
                return Json(result, JsonRequestBehavior.AllowGet);
            }));
        }
        /// <summary>
        /// 获取参数映射信息
        /// </summary>
        /// <returns>参数映射信息</returns>
        private SchemaMethodParamMapViewModel GetSchemaMethodParamMapViewModel()
        {
            SchemaMethodParamMapViewModel model = new SchemaMethodParamMapViewModel();

            // 参数
            OThinker.H3.DataModel.DataMap map = null;
            if (this.IsParam)
            {
                map = this.SelectedMap.ParamMaps.GetMap(this.ParamName);
            }
            else
            {
                map = this.SelectedMap.ReturnMaps.GetMap(this.ParamName);
            }
            if (map == null)
            {
                return(model);
            }

            model.ParamName = this.ParamName;
            model.IsParam   = this.IsParam;
            model.MapType   = ((int)map.MapType).ToString();
            switch (map.MapType)
            {
            case H3.DataModel.DataMapType.Property:
                model.PropertyName = map.MapTo;
                model.ConstValue   = "";
                break;

            case H3.DataModel.DataMapType.Const:
                model.ConstValue = map.MapTo;
                break;

            case H3.DataModel.DataMapType.None:
                model.ConstValue = "";
                break;

            default:
                throw new NotImplementedException();
            }

            return(model);
        }