本文整理汇总了C#中Generator.DisplayEventAndLogInformation方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.DisplayEventAndLogInformation方法的具体用法?C# Generator.DisplayEventAndLogInformation怎么用?C# Generator.DisplayEventAndLogInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator.DisplayEventAndLogInformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DatePicker1_DateChanged
protected void DatePicker1_DateChanged(object sender, EventArgs e)
{
EmployeeProfile emp = (EmployeeProfile)Session["EmployeeProfile"];
SecureString pw = (SecureString)Session["SecureString"];
DatePicker dp = (DatePicker)sender;
DateTime now = DateTime.Now;
DateTime endDate = now;
DateTime startDate = dp.SelectedDate;
string queryString = String.Format(AppConfig.EventQuery,
startDate.ToUniversalTime().ToString("o"),
endDate.ToUniversalTime().ToString("o"));
// Query the Application log on the remote computer.
EventLogQuery query = new EventLogQuery("System", PathType.LogName, queryString);
if (AppConfig.RemoteQuery) {
string passwd = emp.Password;
query.Session = new EventLogSession(
emp.Machine, // Remote Computer
emp.Domain, // Domain
emp.Name, // Username
pw,
SessionAuthentication.Default);
}
EventLogReader logReader = new EventLogReader(query);
Session["EventLogQuery"] = queryString;
Generator testClass = new Generator(logReader);
List<TimeEntry> table = testClass.DisplayEventAndLogInformation(logReader);
Attendance1.Text = String.Format("Query: {0}", Session["EventLogQuery"]);
GridView1.DataSource = table;
GridView1.DataBind();
TotalOT.Text = "Total Overtime: " + testClass.TotalOvertime;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
EventLogReader logReader = (EventLogReader)Session["EventLogReader"];
EmployeeProfile emp = (EmployeeProfile)Session["EmployeeProfile"];
LoginStatus1.Visible = (null == Session["autologin"]);
if (null == emp
|| !this.Page.User.Identity.IsAuthenticated
|| string.IsNullOrEmpty(emp.Name)) {
FormsAuthentication.RedirectToLoginPage();
}
else if (logReader != null) try {
Generator testClass = new Generator(logReader);
List<TimeEntry> table = testClass.DisplayEventAndLogInformation(logReader);
Attendance1.Text = String.Format("Query: {0}", Session["EventLogQuery"]);
GridView1.DataSource = table;
GridView1.DataBind();
Session["EventLogReader"] = null;
TotalOT.Text = "Total Overtime: " + testClass.TotalOvertime;
this.StartDate.Culture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
this.StartDate.SelectedDate = (DateTime)Session["DateTime"];
//this.StartDate.SelectedDateChanged += new EventHandler(DatePicker1_DateChanged);
}
catch (EventLogException err) {
Console.WriteLine("Could not query the remote computer! " + err.Message);
FormsAuthentication.RedirectToLoginPage();
}
}