/// <summary>
        /// 加载表单字段
        /// </summary>
        /// <param name="ff"></param>
        /// <returns></returns>
        private Control LoadFormField(SysFormField ff, FormFieldPrivilege fp, ref Dictionary <long, IDrisionControl> controlDict)
        {
            HtmlGenericControl field = new HtmlGenericControl("div");

            field.Attributes["class"] = "formField";

            //表单字段前面的文字说明
            HtmlGenericControl fieldDisplayText = new HtmlGenericControl("span");

            fieldDisplayText.Attributes["class"] = "formFieldDisplayText";
            fieldDisplayText.InnerText           = GetFormFieldDisplayText(ff);
            field.Controls.Add(fieldDisplayText);

            //是否必输前面的星号
            HtmlGenericControl star = new HtmlGenericControl("span");

            star.Attributes["class"] = "left_star";
            if (!(ff.IsNullable ?? true))
            {
                star.InnerHtml = "*";
            }
            else
            {
                star.InnerHtml = "&nbsp;";
            }
            field.Controls.Add(star);

            //控件
            Control control;

            if (this.IsDetailPage) //详情页面的解析和其它不同
            {
                control = FormPreviewHelper.LoadControlForDetailPage(ff);
            }
            else
            {
                control = FormPreviewHelper.LoadControl(ff);
            }

            //权限处理
            if (fp == FormFieldPrivilege.Invisible)
            {
                control.Visible = false;
                field.Style[HtmlTextWriterStyle.Display] = "none";
            }
            else if (fp == FormFieldPrivilege.ReadOnly)
            {
                //(control as IReadOnlyControl).ReadOnly = true;
            }

            field.Controls.Add(control);
            controlDict[ff.FormFieldId] = (control as IDrisionControl); //记住所有的IDrisionControl,后面有可能要赋值

            return(field);
        }
        /// <summary>
        /// 加载表单实体对象
        /// </summary>
        private void LoadObjectData(Dictionary <long, IDrisionControl> controlDict)
        {
            List <SysFormField> ffList = this.DataHelper.Where <SysFormField>(p => p.FormId == this.FormId);
            SysEntity           entity = this.BasePage.EntityCache.FindById <SysEntity>(this.EntityId);

            if (entity != null) //元数据预置实体,利用EntitySchema查询,给控件赋值
            {
                #region 元数据预置实体

                var es = IEntitySchemaHelper.Get(this.EntityId);
                if (es == null)
                {
                    throw new Exception("元数据实体EntitySchema找不到");
                }

                object obj = this.DataHelper.FindById(es.EntityType, this.ObjectId);
                foreach (var ff in ffList)
                {
                    ff.Field = BasePage.GetField(ff.FieldId);
                    if (controlDict.ContainsKey(ff.FormFieldId))
                    {
                        IDrisionControl control = controlDict[ff.FormFieldId];
                        object          value   = obj.GetPropertyValue(control.FieldName);
                        if (this.IsDetailPage)
                        {
                            FormPreviewHelper.SetValueForDetailPage(ff, control, value);
                        }
                        else
                        {
                            FormPreviewHelper.SetValue(ff, control, value);
                        }
                    }
                    else
                    {
                        throw new Exception("表单字段找不到对应控件");
                    }
                }

                #endregion
            }
            else
            {
                #region 自定义实体

                entity = this.DataHelper.FindById <SysEntity>(this.EntityId);
                Dictionary <string, object> valueDict = this.DataHelper.DynamicFindById(entity, this.ObjectId);
                foreach (var ff in ffList)
                {
                    ff.Field = BasePage.GetField(ff.FieldId);
                    if (controlDict.ContainsKey(ff.FormFieldId))
                    {
                        IDrisionControl control = controlDict[ff.FormFieldId];
                        if (!valueDict.ContainsKey(control.FieldName.ToLower()))
                        {
                            throw new Exception(string.Format("字段{0}找不到", control.FieldName));
                        }
                        object value = valueDict[control.FieldName.ToLower()];
                        if (this.IsDetailPage)
                        {
                            FormPreviewHelper.SetValueForDetailPage(ff, control, value);
                        }
                        else
                        {
                            FormPreviewHelper.SetValue(ff, control, value);
                        }
                    }
                    else
                    {
                        throw new Exception("表单字段找不到对应控件");
                    }
                }

                #endregion
            }
        }