您目前尚未登陆,请选择【登陆】或【注册
首页->新闻文章->破竹CMS4.0免安装版源码>>admin/Log/EventLogs.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:破竹CMS4.0免安装版源码
当前文件:文件类型 PozhuCMS/admin/Log/EventLogs.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using Pozhu.Services.Log.EventLog; 12using Pozhu.UI.WebControls; 13using Pozhu.Sites; 14using Pozhu.Services.Exceptions; 15using System.Xml; 16using Pozhu.Services.Personalization; 17using System.Text; 18using Pozhu.CMS.Web; 19 20public partial class admin_Log_EventLogs : AdminPageBase 21{ 22 private ArrayList arrLogTypeInfo; 23 private Hashtable htLogTypeInfo; 24 private bool ColorCodingOn = false; 25 private bool ColorCodingLegendOn = true; 26 private int PageIndex; 27 private int intPortalID = -1; 28 private string strLogTypeKey; 29 30 private void BindData() 31 { 32 if (ColorCodingOn) 33 { 34 chkColorCoding.Checked = true; 35 } 36 else 37 { 38 chkColorCoding.Checked = false; 39 } 40 41 if (ColorCodingLegendOn) 42 { 43 pnlLegend.Visible = true; 44 } 45 else 46 { 47 pnlLegend.Visible = false; 48 } 49 50 51 btnClear.Visible = true; 52 btnDelete.Visible = true; 53 if (!Page.IsPostBack && Request.QueryString["PortalID"] != null) 54 { 55 ddlPortalid.Items.FindByValue(Request.QueryString["PortalID"]).Selected = true; 56 } 57 intPortalID = int.Parse(ddlPortalid.SelectedItem.Value); 58 59 60 int TotalRecords = 0; 61 int PageSize = Convert.ToInt32(ddlRecordsPerPage.SelectedValue); 62 if (!Page.IsPostBack && Request.QueryString["LogTypeKey"] != null) 63 { 64 ddlLogType.Items.FindByValue(Request.QueryString["LogTypeKey"]).Selected = true; 65 } 66 67 strLogTypeKey = ddlLogType.SelectedItem.Value; 68 69 LogInfoArray objLog; 70 int CurrentPage = PageIndex; 71 if (CurrentPage > 0) 72 { 73 CurrentPage--; 74 } 75 LogController objLogController = new LogController(); 76 if (intPortalID == -1 && strLogTypeKey == "*") 77 { 78 objLog = objLogController.GetLog(PageSize, CurrentPage, ref TotalRecords); 79 } 80 else if (intPortalID == -1 && strLogTypeKey != "*") 81 { 82 objLog = objLogController.GetLog(strLogTypeKey, PageSize, CurrentPage, ref TotalRecords); 83 } 84 else if (intPortalID != -1 && strLogTypeKey == "*") 85 { 86 objLog = objLogController.GetLog(intPortalID, PageSize, CurrentPage, ref TotalRecords); 87 } 88 else if (intPortalID != -1 && strLogTypeKey != "*") 89 { 90 objLog = objLogController.GetLog(intPortalID, strLogTypeKey, PageSize, CurrentPage, ref TotalRecords); 91 } 92 else 93 { 94 objLog = objLogController.GetLog(strLogTypeKey, PageSize, CurrentPage, ref TotalRecords); 95 } 96 97 if (objLog.Count > 0) 98 { 99 btnDelete.Enabled = true; 100 btnClear.Enabled = true; 101 plNoItems.Visible = false; 102 dlLog.Visible = true; 103 pnlOptions.Visible = true; 104 dlLog.DataSource = objLog; 105 dlLog.DataBind(); 106 107 InitializePaging(ctlPagingControlBottom, TotalRecords, PageSize); 108 } 109 else 110 { 111 dlLog.Visible = false; 112 btnDelete.Enabled = false; 113 btnClear.Enabled = false; 114 pnlLegend.Visible = false; 115 plNoItems.Visible = true; 116 } 117 } 118 119 private void InitializePaging(NumberLinkPager ctlPagingControl, int TotalRecords, int PageSize) 120 { 121 ctlPagingControl.TotalRecords = TotalRecords; 122 ctlPagingControl.PageSize = PageSize; 123 ctlPagingControl.CurrentPage = PageIndex; 124 string strQuerystring = ""; 125 if (ddlRecordsPerPage.SelectedIndex != 0) 126 { 127 strQuerystring += "&PageRecords=" + ddlRecordsPerPage.SelectedValue; 128 } 129 if (intPortalID >= 0) 130 { 131 strQuerystring += "&PortalID=" + intPortalID.ToString(); 132 } 133 if (strLogTypeKey != "*" && !String.IsNullOrEmpty(strLogTypeKey)) 134 { 135 strQuerystring += "&LogTypeKey=" + strLogTypeKey; 136 } 137 ctlPagingControl.UrlFormat = Request.Path + "?currentPage={0}" + strQuerystring; 138 } 139 140 private void BindLogTypeDropDown() 141 { 142 LogController objLogController = new LogController(); 143 ArrayList arrLogTypes = objLogController.GetLogTypeInfo(); 144 arrLogTypes.Sort(new LogTypeSortFriendlyName()); 145 ddlLogType.DataTextField = "LogTypeFriendlyName"; 146 ddlLogType.DataValueField = "LogTypeKey"; 147 ddlLogType.DataSource = arrLogTypes; 148 ddlLogType.DataBind(); 149 ListItem ddlAllPortals = new ListItem("ALL", "*"); 150 ddlLogType.Items.Insert(0, ddlAllPortals); 151 } 152 153 private void BindPortalDropDown() 154 { 155 156 int i; 157 158 SiteController objPortalController = new SiteController(); 159 ArrayList arrPortals = objPortalController.GetSites(); 160 ddlPortalid.DataTextField = "SiteName"; 161 ddlPortalid.DataValueField = "SiteID"; 162 ddlPortalid.DataSource = arrPortals; 163 ddlPortalid.DataBind(); 164 ListItem ddlAllPortals = new ListItem("All", "-1"); 165 ddlPortalid.Items.Insert(0, ddlAllPortals); 166 //check to see if any portalname is empty, otherwise set it to portalid 167 for (i = 0; i <= ddlPortalid.Items.Count - 1; i++) 168 { 169 if (ddlPortalid.Items[i].Text.Length == 0) 170 { 171 ddlPortalid.Items[i].Text = "Portal: " + ddlPortalid.Items[i].Value; 172 } 173 } 174 175 } 176 177 private void DeleteSelectedExceptions() 178 { 179 try 180 { 181 182 string s = Request.Form["Exception"]; 183 if (s != null) 184 { 185 string[] arrExcPositions = new string[0]; 186 if (s.LastIndexOf(",") > 0) 187 { 188 arrExcPositions = s.Split(Convert.ToChar(",")); 189 } 190 else if (s.Length > 0) 191 { 192 arrExcPositions = new string[1]; 193 arrExcPositions[0] = s; 194 } 195 196 LogController objLoggingController = new LogController(); 197 198 int i; 199 int j = arrExcPositions.Length; 200 for (i = 1; i <= arrExcPositions.Length; i++) 201 { 202 j--; 203 string[] excKey; 204 excKey = arrExcPositions[j].Split(Convert.ToChar("|")); 205 LogInfo objLogInfo = new LogInfo(); 206 objLogInfo.LogGUID = excKey[0]; 207 objLogInfo.LogFileID = excKey[1]; 208 objLoggingController.DeleteLog(objLogInfo); 209 } 210 211 } 212 BindPortalDropDown(); 213 BindData(); 214 } 215 catch (Exception exc) 216 { 217 Exceptions.LogException( exc); 218 } 219 } 220 221 private XmlDocument GetSelectedExceptions() 222 { 223 XmlDocument objXML = new XmlDocument(); 224 try 225 { 226 227 string s = Request.Form["Exception"]; 228 if (s != null) 229 { 230 string[] arrExcPositions = new string[0]; 231 if (s.LastIndexOf(",") > 0) 232 { 233 arrExcPositions = s.Split(Convert.ToChar(",")); 234 } 235 else if (s.Length > 0) 236 { 237 arrExcPositions = new string[1]; 238 arrExcPositions[0] = s; 239 } 240 241 LogController objLoggingController = new LogController(); 242 243 objXML.LoadXml("<LogEntries></LogEntries>"); 244 245 int i; 246 int j = arrExcPositions.Length; 247 for (i = 1; i <= arrExcPositions.Length; i++) 248 { 249 j--; 250 string[] excKey; 251 excKey = arrExcPositions[j].Split(Convert.ToChar("|")); 252 LogInfo objLogInfo = new LogInfo(); 253 objLogInfo.LogGUID = excKey[0]; 254 objLogInfo.LogFileID = excKey[1]; 255 XmlNode objNode; 256 objNode = objXML.ImportNode(((XmlNode)objLoggingController.GetSingleLog(objLogInfo, LoggingProvider.ReturnType.XML)), true); 257 objXML.DocumentElement.AppendChild(objNode); 258 } 259 } 260 } 261 catch (Exception exc) 262 { 263 Exceptions.LogException(exc); 264 } 265 return objXML; 266 } 267 268 269 protected LogTypeInfo GetMyLogType(string LogTypeKey) 270 { 271 LogTypeInfo objLogTypeInfo; 272 if (htLogTypeInfo[LogTypeKey] != null) 273 { 274 objLogTypeInfo = (LogTypeInfo)htLogTypeInfo[LogTypeKey]; 275 if (!ColorCodingOn) 276 { 277 objLogTypeInfo.LogTypeCSSClass = "Normal"; 278 } 279 return objLogTypeInfo; 280 } 281 else 282 { 283 return new LogTypeInfo(); 284 } 285 } 286 287 public string GetPropertiesText(object obj) 288 { 289 LogInfo objLogInfo = (LogInfo)obj; 290 291 LogProperties objLogProperties = objLogInfo.LogProperties; 292 StringBuilder str = new StringBuilder(); 293 294 int i; 295 for (i = 0; i <= objLogProperties.Count - 1; i++) 296