Beispiel #1
0
        internal static IPRDEV Connect2SQL(string connectionString, ProgressChangedEventHandler progressChanged)
        {
            progressChanged(null, new ProgressChangedEventArgs(1, String.Format("Attempt to connect to SQL at: {0}", connectionString)));
            System.Data.IDbConnection _connection = new SqlConnection(connectionString);
            IPRDEV _entities = new IPRDEV(_connection);

            if (_entities.DatabaseExists())
            {
                progressChanged(null, new ProgressChangedEventArgs(1, "The specified database can be opened."));
            }
            else
            {
                progressChanged(null, new ProgressChangedEventArgs(1, "The specified database cannot be opened."));
            }
            return(_entities);
        }
Beispiel #2
0
 /// <summary>
 /// Performs Archive Content Task.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="progressChanged">The progress changed.</param>
 public static void Go(ArchiveSettings settings, ProgressChangedEventHandler progressChanged)
 {
     using (NSLinq2SQL.IPRDEV _sqledc = NSLinq2SQL.IPRDEV.Connect2SQL(settings.ConnectionString, progressChanged))
     {
         if (String.IsNullOrEmpty(settings.ConnectionString))
         {
             throw new ArgumentNullException("Database connection string cannot be null or empty.");
         }
         if (!_sqledc.DatabaseExists())
         {
             throw new ArgumentOutOfRangeException(String.Format("The database at {0} does nor exist.", settings.ConnectionString));
         }
         GoIPR(_sqledc, settings, progressChanged);
         GoReports(_sqledc, settings, progressChanged);
         GoBatch(_sqledc, settings, progressChanged);
         Linq2SQL.ArchivingOperationLogs.UpdateActivitiesLogs(_sqledc, Linq2SQL.ArchivingOperationLogs.OperationName.Archiving, progressChanged);
     }
     progressChanged(null, new ProgressChangedEventArgs(1, "Finished archiving all lists"));
 }