温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:BugNet0.7.881.0汉化免安装版源码
当前文件:
BugNet/BugNET_WAP/Administration/Host/LogViewer.aspx.cs[4K,2009-6-12 11:34:49],打开代码结构图
BugNet/BugNET_WAP/Administration/Host/LogViewer.aspx.cs[4K,2009-6-12 11:34:49],打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using BugNET.BusinessLogicLayer; 12
//中文官方网站 www.bugnet.org.cn 13
//由liudao汉化 14
//download from 51aspx.com 15
public partial class Administration_Host_LogViewer : System.Web.UI.Page 16
{ 17
/// <summary> 18
/// Handles the Load event of the Page control. 19
/// </summary> 20
/// <param name="sender">The source of the event.</param> 21
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> 22
protected void Page_Load(object sender, EventArgs e) 23
{ 24
if (!UserIT.IsInRole(Globals.SuperUserRole)) 25
Response.Redirect("~/AccessDenied.aspx"); 26
} 27
28
/// <summary> 29
/// Grids the view sort images. 30
/// </summary> 31
/// <param name="sender">The sender.</param> 32
/// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param> 33
protected void GridViewSortImages(object sender, GridViewRowEventArgs e) 34
{ 35
GridView senderGridView = (GridView)sender; 36
Literal space = new Literal(); 37
space.Text = " "; 38
39
if (e.Row != null && e.Row.RowType == DataControlRowType.Header) 40
{ 41
foreach (TableCell cell in e.Row.Cells) 42
{ 43
if (cell.HasControls()) 44
{ 45
LinkButton button = cell.Controls[0] as LinkButton; 46
if (button != null) 47
{ 48
49
Image image = new Image(); 50
image.ImageUrl = "default.gif"; 51
image.CssClass = "icon"; 52
if (senderGridView.SortExpression == button.CommandArgument) 53
{ 54
image.ImageUrl = "~/images/" + (senderGridView.SortDirection == SortDirection.Ascending ? "bullet_arrow_up" : "bullet_arrow_down") + ".gif"; 55
cell.Controls.Add(image); 56
} 57
} 58
} 59
} 60
} 61
} 62
63
/// <summary> 64
/// Handles the RowDataBound event of the gvLog control. 65
/// </summary> 66
/// <param name="sender">The source of the event.</param> 67
/// <param name="e">The <see cref="T:System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param> 68
protected void gvLog_RowDataBound(object sender, GridViewRowEventArgs e) 69
{ 70
if (e.Row.RowType == DataControlRowType.DataRow) 71
{ 72
DataRowView drv = (DataRowView)e.Row.DataItem; 73
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Row.FindControl("imgLevel"); 74
img.ImageUrl = GetLogImageUrl((string)drv["Level"]); 75
img.AlternateText = (string)drv["Level"]; 76
77
Label MessageLabel = (Label)e.Row.FindControl("MessageLabel"); 78
MessageLabel.Text = (string)drv["Message"]; 79
Label ExceptionLabel = (Label)e.Row.FindControl("ExceptionLabel"); 80
ExceptionLabel.Text = (string)drv["Exception"]; 81
Label LoggerLabel = (Label)e.Row.FindControl("LoggerLabel"); 82
LoggerLabel.Text = (string)drv["Logger"]; 83
} 84
} 85
86
/// <summary> 87
/// Gets the log image URL. 88
/// </summary> 89
/// <param name="type">The type.</param> 90
/// <returns></returns> 91
private string GetLogImageUrl(string type) 92
{ 93
switch (type) 94
{ 95
case "FATAL": 96
return "~\\images\\exclamation.gif"; 97
case "ERROR": 98
return "~\\images\\error.gif"; 99
case "WARNING": 100
return "~\\images\\Critical.gif"; 101
case "INFO": 102
return "~\\images\\information.gif"; 103
104
} 105
return string.Empty; 106
} 107
108
/// <summary> 109
/// Handles the Click event of the cmdClearLog control. 110
/// </summary> 111
/// <param name="sender">The source of the event.</param> 112
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> 113
protected void cmdClearLog_Click(object sender, EventArgs e) 114
{ 115
ApplicationLog.ClearLog(); 116
ObjectDataSource1.Select(); 117
gvLog.DataBind(); 118
} 119
} 120






}