Пример #1
0
 public void Execute()
 {
     try
     {
         var networkStatus = ConnectionChecker.CheckInternet();
         if (networkStatus != ConnectionChecker.ConnectionStatus.Connected)
         {
             throw new Exception("No internet connection");
         }
         var data = PrepareData();
         Loader.LoadDataInDb(data);
         Logger.Debug(String.Format("Load {0} records in DataBase", data.Count()));
         Keeper.UpdateList.Clear();
     }
     catch (SqlException ex)
     {
         Logger.Error(ex.Message);
         EmailSender.Send(new[] { "*****@*****.**" }, String.Format("Connection error to database on {0}", ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Fatal(ex.Message);
         EmailSender.Send(new[] { "*****@*****.**" }, String.Format("Unexpected exception: {0} <!--{1}-->", ex.Message, ex.StackTrace));
     }
 }