public JsonResult GetBizObjectSchemaMethod(string parentId, string schemaCode, string method, string ownSchemaCode) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); if (!ParseParam(parentId, schemaCode, method)) { result.Success = false; result.Message = "EditBizObjectSchemaMethod.Msg1"; return Json(result, JsonRequestBehavior.AllowGet); } BizObjectSchemaMethod model = new BizObjectSchemaMethod(); var methodTypes = GetMethodTypes(); if (this.Method != null) { model.MethodName = this.Method.MethodName; model.DisplayName = this.Method.DisplayName; model.Transaction = this.Method.TransactionalAsDefault; model.UpdateAfterInvoking = this.Method.UpdateAfterInvoking; model.ParentId = parentId; model.MethodType = this.Method.MethodType.ToString(); model.IsDefaultMethod = DataModel.BizObjectSchema.GetDefaultMethods().Contains(this.Method.MethodName); model.SchemaCode = schemaCode; model.MethodCode = method; } else { model.IsDefaultMethod = true; model.ParentId = parentId; model.SchemaCode = schemaCode; model.MethodType = methodTypes.FirstOrDefault().Value; } result.Success = true; result.Extend = new { MethodTypes = methodTypes, BizObjectSchemaMethod = model, ServiceMethodMapList = GetServiceMethodMapList(), IsLocked = BizWorkflowPackageLockByID(this.SchemaCode, ownSchemaCode), StorageType = this.Schema.StorageType }; return Json(result, JsonRequestBehavior.AllowGet); })); }
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); })); }