示例#1
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <returns></returns>
        public JsonResult SaveMethod(BizServiceMethodViewModel model)
        {
            return(ExecuteFunctionRun(() => {
                ActionResult result = new ActionResult(true, "");

                OThinker.H3.BizBus.BizService.BizService Service = GetService(model.ServiceCode);
                OThinker.H3.BizBus.BizService.BizServiceMethod Method = null;

                bool Creating = string.IsNullOrEmpty(model.ObjectID);
                // 更新属性
                if (Creating)
                {
                    Method = new OThinker.H3.BizBus.BizService.BizServiceMethod();
                }
                else
                {
                    Method = Service.GetMethod(model.MethodName);
                }
                Method.MethodName = model.MethodName;
                Method.DisplayName = model.DisplayName;
                Method.Description = model.Description;
                Method.ReturnType = (H3.BizBus.BizService.MethodReturnType)Enum.Parse(typeof(H3.BizBus.BizService.MethodReturnType), model.ReturnType);
                Method.MethodSetting = Server.UrlDecode(model.MethodSetting);//传递之前有编码,这里需要解码

                if (Creating)
                {
                    if (!Service.AddMethod(Method))
                    {
                        result.Success = false;
                        result.Message = "BizServiceMethod.SaveFailed1";//添加方法失败,可能是方法重名
                        return Json(result);
                    }
                }

                H3.ValidationResult r = this.Engine.BizBus.UpdateBizService(Service, true);
                string result2 = r.ToString();
                if (string.IsNullOrEmpty(result2))
                {
                    result.Success = true;
                    result.Message = "msgGlobalString.SaveSucced";
                }
                else
                {
                    result.Success = false;
                    result.Message = "msgGlobalString.SaveFailed";
                    result.Extend = result2;
                }
                return Json(result);
            }));
        }