예제 #1
0
 /// <summary>
 /// Returns all Alarms on the database.
 /// </summary>
 /// <returns></returns>
 public IEnumerable<DOM.Alarm> RetrieveAlarms()
 {
     try
     {
         //Use unique context as always required live data.
         using (var context = new DAL.SCIPAEntities())
         {
             var alarms = context.Alarms.ToList();
             return alarms.Select(alarm => _mapper.Map(alarm, new DOM.Alarm())).ToList();
         }
     }
     catch
     {
         DebugOutput.Print("Failed to update alarm data.");
         return null;
     }
 }
예제 #2
0
 /// <summary>
 /// Executes the ResetDatabaseScript - deleting all data from the database!
 /// </summary>
 public static void ClearSql()
 {
     //Use unique context as always required live data.
     using (var context = new DAL.SCIPAEntities())
     {
         context.Database.Delete();
         context.Database.Create();
        // context.Database.ExecuteSqlCommand(@Resources.ResetDatabaseScript);
     }
 }