/// <summary> /// 获取数据模型对象基础信息 /// </summary> /// <param name="parentId">父ID</param> /// <param name="IsBizObject">是否是数据模型</param> /// <returns>数据模型对象基础信息</returns> private BizObjectSchemaViewModel GetBizObjectSchema(string parentId, out bool IsBizObject) { var bizTreeNode = this.Engine.FunctionAclManager.GetFunctionNode(parentId); BizObjectSchema ownSchema = null; if (bizTreeNode.Code != this.Schema.SchemaCode) { ownSchema = this.Engine.BizObjectManager.GetDraftSchema(bizTreeNode.Code); } BizObjectSchemaViewModel model = new BizObjectSchemaViewModel() { Code = this.Schema.SchemaCode, Description = this.Schema.Description, DisplayName = this.Schema.DisplayName, Type = "WorkflowPackage." + this.Schema.StorageType.ToString(), ParentId = parentId, IsQuotePacket = ownSchema == null?false:ownSchema.IsQuotePacket //ObjectID=this.Schema.ObjectTypeId, }; IsBizObject = false; //是否可以删除 if (!string.IsNullOrEmpty(this.SchemaCode)) { FunctionNode node = this.Engine.FunctionAclManager.GetFunctionNodeByCode(this.SchemaCode); if (node != null) { model.SortKey = node.SortKey.ToString(); IsBizObject = (node.NodeType == FunctionNodeType.BizObject);//TODO 感觉这里永远为False? } } return(model); }
public JsonResult GetBizObjectSchemaPageData(string parentId, string schemaCode) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); this.SchemaCode = schemaCode; if (!this.ParseParam()) { result.Success = false; result.Message = "EditBizObjectSchema.Msg0"; return Json(result, JsonRequestBehavior.AllowGet); } bool IsBizObject; BizObjectSchemaViewModel model = GetBizObjectSchema(parentId, out IsBizObject); var propertySchemaList = GetPropertySchemaList(); Dictionary <string, string> constString = new Dictionary <string, string>(); constString.Add("SchemCodeStr", ConstantString.Param_SchemaCode); constString.Add("ParentProperty", ConstantString.Param_ParentProperty); constString.Add("ParamProperty", ConstantString.Param_Property); bool isImport = false; if (this.PublishedSchema == null || (this.PublishedSchema != null && this.PublishedSchema.StorageType != StorageType.DataList && isMaster)) { isImport = true; } int isLocked = 1; if (BizWorkflowPackageLockByID(this.SchemaCode) == 0 || model.IsQuotePacket) { isLocked = 0; } result.Extend = new { BizObjectSchema = model, IsBizObject = IsBizObject, IsMaster = isMaster, IsImport = isImport, IsLocked = isLocked, PropertySchemaList = propertySchemaList, ConstString = constString }; result.Success = true; return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult SaveBizObjectSchema(BizObjectSchemaViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); this.SchemaCode = model.Code; if (!this.ParseParam()) { result.Success = false; result.Message = "EditBizObjectSchema.Msg0"; return Json(result, JsonRequestBehavior.AllowGet); } if (string.IsNullOrEmpty(model.DisplayName)) { result.Success = false; result.Message = "EditBizObjectSchema.DisplayNameNotNull"; return Json(result, JsonRequestBehavior.AllowGet); } this.Schema.DisplayName = model.DisplayName; this.Schema.Description = model.Description; this.Engine.BizObjectManager.UpdateDraftSchema(this.Schema); // 状态 DataModel.BizObjectSchemaState state = DataModel.BizObjectSchemaState.Active; // 更新状态 this.Engine.BizObjectManager.SetPublishedSchemaState(this.Schema.SchemaCode, state); //更新FuntionNode FunctionNode funcNode = this.Engine.FunctionAclManager.GetFunctionNodeByCode(this.Schema.SchemaCode); if (funcNode.NodeType == FunctionNodeType.BizObject) { int sortKey; if (Int32.TryParse(model.SortKey, out sortKey)) { funcNode.SortKey = sortKey; } funcNode.DisplayName = model.DisplayName; this.Engine.FunctionAclManager.UpdateFunctionNode(funcNode); } result.Success = true; return Json(result, JsonRequestBehavior.AllowGet); })); }
public JsonResult ValidateBizObjectSchema(BizObjectSchemaViewModel model) { return(ExecuteFunctionRun(() => { ActionResult result = new ActionResult(); this.SchemaCode = model.Code; if (!this.ParseParam()) { result.Success = false; result.Message = "EditBizObjectSchema.Msg0"; return Json(result, JsonRequestBehavior.AllowGet); } H3.ValidationResult r = this.Engine.BizObjectManager.ValidateBizObjectSchema(this.Schema.SchemaCode); result.Success = r.Valid; result.Message = r.Valid ? "EditBizObjectSchema.Msg18" : r.ToString().Replace(System.Environment.NewLine, "<br>").Replace(";", "<br>"); return Json(result, JsonRequestBehavior.AllowGet); })); }