发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using Lc.Framework.BLL.Sysadmin;
using Lc.Framework.Entity;
using Lc.Framework.Common;
using System.IO;
namespace Lc.Framework.Webadmin.Sysadmin
{
public partial class sysinfo : Lc.Framework.Common.BasePage.BasePage
{
#region 页面加载
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ShowSystemInfo();
}
}
#endregion
#region 显示系统信息
protected void ShowSystemInfo()
{
#region 数据库版本判断
string DbType = ConfigurationManager.AppSettings["DBtype"].ToString();
this.LiteralDbType.Text = DbType;
string sInfo = "Data Source=192.168.0.198;Initial Catalog=LcFramework;User ID=sa;Password=sa";
if (DbType.ToLower() == "sqlserver")
{
sInfo = ConfigurationManager.ConnectionStrings["SqlServer"].ToString();
this.LiteralDbPort.Text = "1433";
string[] sZ = sInfo.Split(";".ToCharArray());
for (int i = 0; i < sZ.Length; i++)
{
string[] sShow = sZ[i].Split("=".ToCharArray());
switch (sShow[0].ToLower())
{
case "data source":
this.LiteralDbAddr.Text = sShow[1];
break;
case "initial catalog":
this.LiteralDbName.Text = sShow[1];
break;
case "user id":
this.LiteralDbUserName.Text = sShow[1];
break;
default:
break;
}
}
}
else
{
sInfo = ConfigurationManager.ConnectionStrings["Oracle"].ToString();
this.LiteralDbPort.Text = "1521";
string[] sZ = sInfo.Split(";".ToCharArray());
for (int i = 0; i < sZ.Length; i++)
{
string[] sShow = sZ[i].Split("=".ToCharArray());
switch (sShow[0].ToLower())
{
case "data source":
this.LiteralDbAddr.Text = sShow[1];
this.LiteralDbName.Text = sShow[1];
break;
case "user id":
this.LiteralDbUserName.Text = sShow[1];
break;
default:
break;
}
}
}
#endregion
#region 操作系统信息
this.LiteralSysNet.Text = string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision });
//this.LiteralSysVersion.Text = Request.Browser.Platform.ToString();
this.LiteralSysName.Text = Environment.OSVersion.ToString();
this.LiteralSysPath.Text = Environment.SystemDirectory.ToString();
this.LiteralSysNow.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
this.LiteralSysRunDate.Text = ((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟";
this.LiteralTimeOut.Text = (Server.ScriptTimeout / 1000).ToString() + "秒";
#endregion
#region 其他信息
string[] achDrives = Directory.GetLogicalDrives();
for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++)
{
this.LiteralLogicDriver.Text = LiteralLogicDriver.Text + achDrives[i].ToString();
}
this.LiteralCpuNum.Text = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString();
this.LiteralCpuType.Text = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString();
this.LiteralUser.Text = Environment.UserName;
#endregion
}
#endregion
}
}
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。