/// <summary>
        /// 获取PropertyGrid显示数据
        /// </summary>
        /// <returns>PropertyGrid显示数据</returns>
        private List <Item> GetPropertyGrid()
        {
            List <Item> list = new List <Item>();

            // 属性名称列表
            if (this.Schema.Properties != null)
            {
                bool editable = false;
                bool visiable = false;
                foreach (OThinker.H3.DataModel.PropertySchema item in this.Schema.Properties)
                {
                    if (this.Schema.GetAssociation(item.Name) == null)
                    {
                        Item m = new Item();
                        m.Text = item.Name;
                        object v = this.BizObject.GetValue(item.Name);
                        if (this.Schema.PrimaryKey == item.Name && item.SourceType != SourceType.Metadata)//主键不赋值
                        {
                            v = string.Empty;
                        }
                        OThinker.H3.DataModel.FieldSchema field = this.BizObject.Schema.GetField(item.Name);
                        if (v == null)
                        {
                            m.Value = null;
                        }
                        else if (field.LogicType == Data.DataLogicType.BizObject ||
                                 field.LogicType == Data.DataLogicType.BizObjectArray ||
                                 field.RealType.IsSubclassOf(typeof(System.Array)))
                        {
                            m.Value = OThinker.Data.Convertor.ObjectToXml(v);
                        }
                        else
                        {
                            m.Value = v.ToString();
                        }
                        // 加载状态
                        editable = this.BizObject.GetPropertyEditable(item.Name);
                        visiable = this.BizObject.GetPropertyVisible(item.Name);
                        // 如果是加载模式的话,那么主键禁止修改
                        if (this.Mode == 1)
                        {
                            if (string.Compare(item.Name, BizObjectSchema.PropertyName_ObjectID, true) == 0)
                            {
                                editable = false;
                            }
                        }
                        m.Extend = new
                        {
                            Edit    = editable,
                            Visible = visiable
                        };
                        list.Add(m);
                    }
                }
            }
            return(list);
        }
        public JsonResult RunTestBizObject(string propertyGrid, TestObjectViewModel model)
        {
            return(ExecuteFunctionRun(() =>
            {
                ActionResult result = new ActionResult();
                result = ParseParam(model.SchemaCode, "");
                if (!result.Success)
                {
                    return Json(result, JsonRequestBehavior.AllowGet);
                }
                // 删除与组织结构对应的系统权限
                Dictionary <string, object> valueTableFromUI = new Dictionary <string, object>();
                List <Item> propertyGridList = JsonConvert.DeserializeObject <List <Item> >(propertyGrid);
                foreach (Item item in propertyGridList)
                {
                    string itemName = item.Text;

                    OThinker.H3.DataModel.FieldSchema field = this.Schema.GetField(itemName);

                    if (!string.IsNullOrEmpty(field.Formula))
                    {
                        continue;
                    }

                    string str = item.Value;
                    // 转换成相应的类型
                    object obj = null;
                    if (string.IsNullOrEmpty(str))
                    {
                        obj = OThinker.Data.Convertor.GetDefaultValue(this.Schema.GetField(itemName).RealType);
                    }
                    else if (field.LogicType == Data.DataLogicType.BizObject ||
                             field.LogicType == Data.DataLogicType.BizObjectArray ||
                             field.RealType.IsSubclassOf(typeof(System.Array)))
                    {
                        obj = OThinker.Data.Convertor.XmlToObject(this.Schema.GetField(itemName).RealType, str);
                    }
                    else if (!OThinker.Data.Convertor.Convert(
                                 str,
                                 field.RealType,
                                 ref obj))
                    {
                        //无法转换数据
                        result.Message = "TestBizObject.UnableConvert";
                        result.Success = false;
                        return Json(result, JsonRequestBehavior.AllowGet);
                    }
                    valueTableFromUI.Add(itemName, obj);
                }

                // 初始化业务对象
                foreach (string itemName in valueTableFromUI.Keys)
                {
                    //if (string.IsNullOrEmpty(this.Schema.GetField(itemName).OnChange))
                    //{
                    this.BizObject.SetValue(itemName, valueTableFromUI[itemName]);
                    //}
                }
                // 只设置哪些可以设置的属性
                // 初始化业务对象
                foreach (string itemName in valueTableFromUI.Keys)
                {
                    if (this.BizObject.GetPropertyEditable(itemName))//&& !string.IsNullOrEmpty(this.Schema.GetField(itemName).OnChange))
                    {
                        this.BizObject.SetValue(itemName, valueTableFromUI[itemName]);
                    }
                }

                // 检查是不是必填
                string[] itemNames = this.Schema.GetPropertyNames();
                if (itemNames != null)
                {
                    foreach (string itemName in itemNames)
                    {
                        if (this.BizObject.GetPropertyRequired(itemName) &&
                            (this.BizObject[itemName] == null || this.BizObject[itemName].ToString() == ""))
                        {
                            //数据{0}是必填字段
                            result.Message = "TestBizObject.FieldRequired";
                            result.Extend = itemName;
                            return Json(result, JsonRequestBehavior.AllowGet);
                        }
                    }
                }

                // 调用方法
                this.BizObject.Invoke(model.Method);
                bool editable = false;
                bool visiable = false;
                // 回写值
                // 删除与组织结构对应的系统权限
                foreach (Item item in propertyGridList)
                {
                    string itemName = item.Text;

                    // 转换成相应的类型
                    object obj = this.BizObject.GetValue(itemName);
                    OThinker.H3.DataModel.FieldSchema field = this.BizObject.Schema.GetField(itemName);
                    if (obj == null)
                    {
                        item.Value = null;
                    }
                    else if (field.LogicType == Data.DataLogicType.BizObject)
                    {
                        // text.Text = OThinker.Data.Convertor.ObjectToXml(obj);
                    }
                    else if (field.LogicType == Data.DataLogicType.BizObjectArray)
                    {
                        // text.Text = OThinker.Data.Convertor.ObjectToXml(obj);
                    }
                    else if (field.RealType.IsSubclassOf(typeof(System.Array)))
                    {
                        item.Value = OThinker.Data.Convertor.ObjectToXml(obj);
                    }
                    else
                    {
                        item.Value = obj.ToString();
                    }

                    // 加载状态
                    editable = this.BizObject.GetPropertyEditable(itemName);
                    visiable = this.BizObject.GetPropertyVisible(item.Text);
                    if (!this.BizObject.GetPropertyVisible(itemName))
                    {
                        visiable = false;
                    }
                    item.Extend = new
                    {
                        Edit = editable,
                        Visible = visiable
                    };
                }
                var associatedColunms = new List <AssociatedObjectRowViewModel>();
                if (this.Mode == 0)
                {
                    associatedColunms = GetAssociatedObjectGrid(model.AssociationName);
                }
                result.Extend = new
                {
                    PropertyGrid = propertyGridList,
                    AssociatedColunms = associatedColunms,
                    Mode = this.Mode
                };
                return Json(result, JsonRequestBehavior.AllowGet);
            }));
        }