コード例 #1
0
 /// <summary>
 /// Adds an incident for monitoring.
 /// </summary>
 /// <param name="incident">The Incident to add.</param>
 public void addIncident(Incident incident)
 {
     incidents.Add(incident);
     if(IncidentAdded!=null)
     {
         IncidentAdded(this, new IncidentAddedEventArgs(incident));
     }
 }
コード例 #2
0
 /// <summary>
 /// Sets the leave time of an incident to the current time.
 /// </summary>
 /// <param name="i">The incident which leave time should be set.</param>
 /// <returns>Return a boolean true for successful, false for unsuccessful</returns>
 public static Boolean setLeaveTime(Incident i)
 {
     try
     {
         openconnection();
         int id = i.incident_ID;
         cmd = new OleDbCommand("UPDATE Incident SET LeaveTime = '" + DateTime.Now.ToString() + "' WHERE Incident_ID = " + id, connection);
         cmd.ExecuteNonQuery();
         closeconnection();
         return true;
     }
     catch
     {
         return false;
     }
 }
コード例 #3
0
 /// <summary>
 /// Gets an incident object by Incident_ID.
 /// </summary>
 /// <param name="incident_ID">The incident identifier.</param>
 /// <returns>Returns an incident object or null</returns>
 public static Incident getIncident(int incident_ID)
 {
     try
     {
         openconnection();
         cmd = new OleDbCommand("SELECT * FROM Incident WHERE Incident_ID = " + incident_ID, connection);
         dr = cmd.ExecuteReader();
         dr.Read();
         int ticket_ID = Convert.ToInt32(dr[1].ToString());
         int student_ID = Convert.ToInt32(dr[2].ToString());
         int teacher_ID = Convert.ToInt32(dr[3].ToString());
         DateTime arrival = Convert.ToDateTime(dr[4].ToString());
         String comment = dr[6].ToString();
         Incident i;
         if (dr[5].ToString() == "")
         {
             i = new Incident(incident_ID, ticket_ID, student_ID, teacher_ID, arrival, comment);
         }
         else
         {
             DateTime leaveTime = Convert.ToDateTime(dr[5].ToString());
             i = new Incident(incident_ID, ticket_ID, student_ID, teacher_ID, arrival, leaveTime, comment);
         }
         closeconnection();
         return i;
     }
     catch
     {
         return null;
     }
 }
コード例 #4
0
 public IncidentReadyForReleaseEventArgs(Incident incident)
 {
     this.incident = incident;
 }
コード例 #5
0
 public UpdateTimerEventArgs(Incident incident, TimeSpan time)
 {
     this.incident = incident;
     this.time = time;
 }
コード例 #6
0
 public IncidentReleasedEventArgs(Incident incident)
 {
     this.incident = incident;
 }
コード例 #7
0
 public IncidentAddedEventArgs(Incident incident)
 {
     this.incident = incident;
 }
コード例 #8
0
 /// <summary>
 /// Removes an incident from monitoring and writes the new leaveTime into the database.
 /// </summary>
 /// <param name="incident">The Incident to remove.</param>
 public void releaseIncident(Incident incident)
 {
     incidents.Remove(incident);
     UtilityDB.setLeaveTime(incident);
     if(IncidentReleased!=null)
     {
         IncidentReleased(this, new IncidentReleasedEventArgs(incident));
     }
 }