Beispiel #1
0
 public CentricityModule()
 {
     if (DesktopApplication.Librarian != null)
     {
         retriever = DesktopApplication.Librarian.DataRetriever;
     }
     GetLogEntriesCommand = new RelayCommand(GetLogEntries);
     LogStartDate         = DateTime.Today;
     LogEndDate           = LogStartDate.AddDays(1);
 }
Beispiel #2
0
 private void GetLogEntries()
 {
     LogEntries.Clear();
     if (LogEndDate <= LogStartDate)
     {
         DesktopApplication.ShowDialog("Error", "Start date must be earlier than end date");
         return;
     }
     using (SqlConnection tmpCon = new SqlConnection(Properties.Settings.Default.InterfaceConnString))
     {
         tmpCon.Open();
         SqlCommand command = new SqlCommand("SELECT * FROM system_logging WHERE entered_date > '" + LogStartDate.ToString("yyyy-MM-dd HH:mm:ss") + "' AND log_date < '" + LogEndDate.ToString("yyyy-MM-dd HH:mm:ss") + "'", tmpCon);
         //command.Parameters.AddWithValue("@StartDate", LogStartDate);
         //SqlParameter startDateParam = new SqlParameter("@StartDate", SqlDbType.DateTime);
         //startDateParam.Value = LogStartDate;
         // SqlParameter endDateParam = new SqlParameter("@EndDate", SqlDbType.DateTime);
         //endDateParam.Value = endDateParam;
         //command.Parameters.Add(startDateParam);
         //command.Parameters.Add(endDateParam);
         //command.Parameters.AddWithValue("@EndDate", LogEndDate);
         SqlDataReader reader = command.ExecuteReader();
         while (reader.Read())
         {
             //reader.Read();
             LogEntry entry = new LogEntry();
             entry.LogCallSite = reader["log_call_site"].ToString();
             entry.LogDate     = reader["log_date"].ToString();
             //entry.LogDate= reader.GetDateTime(reader.GetOrdinal("log_date"));
             entry.LogException  = reader["log_exception"].ToString();
             entry.LogLevel      = reader["log_level"].ToString();
             entry.LogLogger     = reader["log_logger"].ToString();
             entry.LogMessage    = reader["log_message"].ToString();
             entry.LogStackTrace = reader["log_stacktrace"].ToString();
             LogEntries.Add(entry);
         }
     }
 }