public JsonResult SaveBizObjectSchemaMethod(BizObjectSchemaMethod model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); if (!ParseParam(model.ParentId, model.SchemaCode, model.MethodCode)) { result.Success = false; result.Message = "EditBizObjectSchema.Msg0"; return Json(result, JsonRequestBehavior.AllowGet); } if (this.Method == null) { string methodName = model.MethodName; if (string.IsNullOrWhiteSpace(methodName)) { result.Success = false; result.Message = "EditBizObjectSchema.Msg1"; return Json(result, JsonRequestBehavior.AllowGet); } this.Method = this.Schema.CreateMethod(methodName, (H3.DataModel.MethodType)Enum.Parse(typeof(H3.DataModel.MethodType), model.MethodType)); } if (this.Method == null) { result.Success = false; result.Message = "EditBizObjectSchema.Msg2"; return Json(result, JsonRequestBehavior.AllowGet); } this.Method.DisplayName = model.DisplayName; this.Method.TransactionalAsDefault = model.Transaction; this.Method.UpdateAfterInvoking = model.UpdateAfterInvoking; 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.SaveFailed"; return Json(result, JsonRequestBehavior.AllowGet); })); }
/// <summary> /// 解析参数 /// </summary> /// <param name="parentId">所属数据模型ID</param> /// <param name="schemaCode">主数据编码</param> /// <param name="method">方法名称</param> /// <returns></returns> private bool ParseParam(string parentId, string schemaCode, string method) { this.ParentID = parentId; this.SchemaCode = schemaCode; this.SelectedMethod = method; if (!string.IsNullOrEmpty(SchemaCode)) { this.Schema = this.Engine.BizObjectManager.GetDraftSchema(SchemaCode); } if (this.Schema == null) { return(false); } if (!string.IsNullOrWhiteSpace(this.SelectedMethod)) { this.Method = this.Schema.GetMethod(SelectedMethod); } return(true); }