示例#1
0
        public override string CreateHtml(AppObject appobj, ConnectionPack connpack, IDictionary <string, object> outnames)
        {
            HtmlGenerator       gen   = new HtmlGenerator();
            IPhysicalConnection pconn = appobj.FindPhysicalConnection(connpack);
            string dbversion          = null;

            if (pconn != null && pconn.SystemConnection != null)
            {
                try
                {
                    dbversion = pconn.SystemConnection.ServerVersion;
                }
                catch
                {
                    dbversion = null;
                }
            }
            IStoredConnection scon = pconn.StoredConnection;

            gen.BeginHtml(VersionInfo.ProgramTitle, HtmlGenerator.HtmlObjectViewStyle);
            gen.Heading(Texts.Get("s_properties"), 2);
            gen.PropsTableBegin();
            if (scon != null)
            {
                gen.PropTableRow("s_path", scon.FileName);
            }
            var attr = XmlTool.GetRegisterAttr(scon);

            if (attr != null)
            {
                gen.PropTableRow("s_database_engine", attr.Title ?? attr.Name);
            }
            if (scon != null)
            {
                gen.PropTableRow("s_host", scon.GetDataSource());
                gen.PropTableRow("s_database", scon.ExplicitDatabaseName);
                gen.PropTableRow("s_login", scon.GetLogin());
            }
            else
            {
                gen.PropTableRow("s_path", pconn.PhysicalFactory.GetDataSource());
            }
            if (dbversion != null)
            {
                gen.PropTableRow("s_version", dbversion);
            }
            gen.PropsTableEnd();
            gen.EndHtml();
            return(gen.HtmlText);
        }