private string BuildContent(IConfigBean config)
        {
            BaseAttributeConfigBean cp = config as BaseAttributeConfigBean;
            string host = ContextHelper.GetHostUrl();
            StringBuilder content = new StringBuilder();
            content.AppendLine("<div class=\"main-content-inner\">");
            content.AppendLine("<div class=\"breadcrumbs\" id=\"breadcrumbs\">");
            content.AppendLine(" <script type=\"text/javascript\">");
            content.AppendLine(" try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }");
            content.AppendLine("</script>");
            content.AppendLine("<ul class=\"breadcrumb\">");
            content.AppendLine("      <li>");
            content.AppendLine("<i class=\"ace-icon fa fa-home home-icon\"></i>");
            content.AppendLine("<a href=\"" + host + "configuration\">Configuration</a>");
            content.AppendLine("</li>");
            content.AppendFormat("<li class=\"active\" >{0}</li>", cp.GetID());

            content.AppendLine("<div style=\"position:absolute;top:10px;right:10px\"><a type=\"update\" id=\"updateallbtn\" href=\"javascript:void(0)\">修改</a></div>");
            content.AppendLine("    </ul>");
            content.AppendLine("    </div>");
            content.AppendLine("<div class=\"page-content\">");
            content.AppendLine("<table class=\"table table-striped table-bordered table-hover\">");
            content.AppendLine("<colgroup>");
            content.AppendLine("<col style=\"width: 120px; \">");
            content.AppendLine("<col style=\"width: 120px; \">");
            content.AppendLine("<col />");
            content.AppendLine("</colgroup>");
            IEnumerable<PropertyName> pNames = cp.GetPropertyNames();
            foreach (PropertyName p in pNames)
            {                    
                object value = cp.Get(p.Name);
                string detail = string.Empty;
                PropertyInfo py = cp.GetAttribute().GetPropertyInfo(p.Name);
                if (py != null)
                {
                    var attrs = py.GetCustomAttributes(typeof(ComponentAttributeBase), false);
                    foreach (var a in attrs)
                    {
                        if (a is FieldDocumentAttribute)
                        {
                            FieldDocumentAttribute att = a as FieldDocumentAttribute;
                            detail = att.Detail;
                        }
                    }
                }
                content.Append(CreateItem(p.Name, value, config.GetID(), p.CanWrite, detail, cp.GetUpdateLog()));
            }
            content.AppendLine("</table>");
            content.AppendLine("</div>");
            content.AppendLine("</div>");
            return content.ToString();
        }
Пример #2
0
 public void Register(IConfigBean config)
 {
     VenusContainerLoader.Container.Define(typeof(IConfigBean), config.GetType(), config.GetID());
 }