/// <summary>
        /// 获取业务规则词汇
        /// </summary>
        /// <param name="ruleCode"></param>
        /// <param name="elementName"></param>
        /// <returns></returns>
        public JsonResult GetRuleElement(string ruleCode, string elementName)
        {
            return(ExecuteFunctionRun(() =>
            {
                OThinker.H3.BizBus.BizRule.BizRuleTable Rule = this.Engine.BizBus.GetBizRule(ruleCode);
                OThinker.H3.BizBus.BizRule.BizRuleDataElement Element;
                BizRuleGlossaryViewModel rElement = new BizRuleGlossaryViewModel();
                if (Rule != null)
                {
                    Element = Rule.GetDataElement(elementName);

                    rElement.ElementName = Element.ElementName;
                    rElement.RuleCode = ruleCode;
                    rElement.DisplayName = Element.DisplayName;
                    rElement.Description = Element.Description;
                    rElement.LogicType = Element.LogicType.ToString();
                    rElement.ParamType = Element.ParamType.ToString();
                    rElement.DefaultValue = Element.DefaultValue == null?"":Element.DefaultValue.ToString();
                    rElement.ObjectID = Element.GetHashCode().ToString();//判定是否为新增使用,不为空即可
                }

                return Json(rElement, JsonRequestBehavior.AllowGet);
            }));
        }
        /// <summary>
        /// 保存业务规则词汇
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult Save(BizRuleGlossaryViewModel model)
        {
            Data.DataLogicType logicType    = (Data.DataLogicType)Enum.Parse(typeof(Data.DataLogicType), model.LogicType);
            string             defaultValue = string.IsNullOrEmpty(model.DefaultValue)?"":model.DefaultValue;
            bool IsCreate = string.IsNullOrEmpty(model.ObjectID);

            ActionResult result = ValidateData(logicType, model);

            if (!result.Success)
            {
                return(Json(result));
            }
            OThinker.H3.BizBus.BizRule.BizRuleDataElement Element;
            OThinker.H3.BizBus.BizRule.BizRuleTable       Rule = this.Engine.BizBus.GetBizRule(model.RuleCode);


            if (IsCreate)
            {
                // 数据项必须以字母开始,不让创建到数据库表字段时报错
                // System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[A-Za-z][A-Za-z0-9_]*$");
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[a-zA-Z\\u4e00-\\u9fa5][0-9a-zA-Z\\u4e00-\\u9fa5_]*$");
                if (!regex.Match(model.ElementName).Success)
                {
                    result.Success = false;
                    result.Message = "EditBizObjectSchemaProperty.Msg4";
                    return(Json(result));
                }

                //检测是否重名
                if (Rule.GetDataElement(model.ElementName) != null)
                {
                    result.Success = false;
                    result.Message = "msgGlobalString.CodeDuplicate";
                    return(Json(result));
                }

                Element              = new OThinker.H3.BizBus.BizRule.BizRuleDataElement();
                Element.ElementName  = model.ElementName;
                Element.DisplayName  = model.DisplayName;
                Element.Description  = model.Description;
                Element.LogicType    = logicType;
                Element.ParamType    = (H3.BizBus.BizRule.InOutType)Enum.Parse(typeof(H3.BizBus.BizRule.InOutType), model.ParamType);
                Element.DefaultValue = defaultValue;

                if (!Rule.AddDataElement(Element))
                {
                    result.Success = false;
                    result.Message = "msgGlobalString.SaveFailed";
                    return(Json(result));
                }
            }
            else
            {
                Element              = Rule.GetDataElement(model.ElementName);
                Element.DisplayName  = model.DisplayName;
                Element.Description  = model.Description;
                Element.LogicType    = logicType;
                Element.ParamType    = (H3.BizBus.BizRule.InOutType)Enum.Parse(typeof(H3.BizBus.BizRule.InOutType), model.ParamType);
                Element.DefaultValue = defaultValue;
            }

            if (!Engine.BizBus.UpdateBizRule(Rule))
            {
                //ShowWarningMessage(PortalResource.GetString("EditBizRuleTableDataElement_SaveFailed"));
                result.Success = false;
                result.Message = "msgGlobalString.SaveFailed";
                return(Json(result));
            }

            result.Success = true;
            result.Message = "msgGlobalString.SaveSucced";
            return(Json(result));
        }