⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logadmin.ascx.cs

📁 这是我编的一小软件。请等级等待指教。呵呵。ASP的
💻 CS
字号:
namespace Seaskyer.WebApp.skyNews.Pages.AdminMSC
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.IO;
	using Seaskyer.AdoProvider;
	using Seaskyer.FSO;
	using Seaskyer.Strings;
	using Seaskyer.WebApp.Utility;

	/// <summary>
	///		LogAdmin : 系统日志管理。
	/// </summary>
	public class LogAdmin : basePage
	{
		protected Panel LogFileList, LogInfoList, ViewLogInfo;
		protected DataGrid DataGrid1;
		protected Repeater Repeater1;
		protected Label pageLabel;
		protected DropDownList ListLogUrl;
		protected DataRow logInfo;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if( !user.IsAdmin )
			{
				base.strError.Add("您无权执行 “" + lang.AppName + "” 操作,详情请与管理员联系!");
				return;
			}


			initPage();

			string filePath		= log.logFolderPath;
			string fileName		= Request.QueryString["fileName"];

			if( !user.CheckValiable(fileName) )
			{
				this.DisplayLogFileList(filePath);
			}
			else
			{
				if( user.CheckValiable(Request.QueryString["ID"]) )
				{
					this.DisplayLogInfo(filePath + fileName, Request.QueryString["ID"]);
				}
				else
				{
					this.DisplayLogInfoList(filePath + fileName);
				}
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		void initPage()
		{
			LogFileList.Visible	= false;
			LogInfoList.Visible	= false;
			ViewLogInfo.Visible	= false;
		}

		void DisplayLogFileList(string filePath)
		{
			LogFileList.Visible = true;

			try
			{
				DataTable dt = DataProvider.ConvertDataTable(FObject.getDirectoryInfos(filePath, FsoMethod.File), "", "name DESC", 0);

				Repeater1.DataSource = dt.DefaultView;
				Repeater1.DataBind();

				dt.Clear();
				dt.Dispose();
			}
			catch
			{
				user.MessageShow("无任何日志文件!", Page);
			}
		}

		void DisplayLogInfoList(string file)
		{
			LogInfoList.Visible = true;

			try
			{
				user.xfilePath	= file;
				user.xPath		= "//logInfo/log";

				DataTable dt = user.ConvertXmlToDataTable();
				bind.totalRecord = dt.Rows.Count;

				bind.PageSize = 20;
				bind.BindInfo_SplitPageDataGrid(DataGrid1, dt, "");
				//DataGrid1.DataSource = dt.DefaultView;
				//DataGrid1.DataBind();

				pageLabel.Text		= base.GetSplitPageString("/skyNews/Admin/LogAdmin.aspx?fileName=" + Request.QueryString["fileName"] + "&");
				pageLabel.Visible	= true;
				//dt.Clear();
				//dt.Dispose();
			}
			catch
			{
				user.MessageShow("无任何日志信息!", Page);
			}


			// 加载日志文件导航
//			try
//			{
//				DataTable dt = DataProvider.ConvertDataTable(FObject.getDirectoryInfos(filePath, FsoMethod.File), "", "name DESC", 0);
//
//				Repeater1.DataSource = dt.DefaultView;
//				Repeater1.DataBind();
//
//				dt.Clear();
//				dt.Dispose();
//			}
//			catch
//			{
//				user.MessageShow("无任何日志文件!", Page);
//			}
		}

		void DisplayLogInfo(string file, string ID)
		{
			ViewLogInfo.Visible = true;

			try
			{
				user.xfilePath	= file;
				user.xPath		= "//logInfo/log[@ID='" + ID + "']";

				DataTable dt = user.ConvertXmlToDataTable();

				if( dt.Rows.Count == 1 )
				{
					logInfo = dt.Rows[0];
				}
				else
				{
					user.MessageShow("您查看的日志不存在!", Page);
				}
			}
			catch
			{
				user.MessageShow("您查看的日志不存在!", Page);
			}
		}

		protected string FormatNUM(string size)
		{
			return Function.Str.FormatNUM(long.Parse(size));
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -