/// <summary>
 /// Gets the list of users from Class Server database and checks
 /// if users belong to Active Directory. This is necessary as
 /// SLK sites base their permissions and membership on AD authentication
 /// </summary>
 /// <param name="ActiveDirectoryPath">LDAP path of the Active Directory</param>
 /// <param name="LogFileName">file name of the log file (will be created in the working directory)</param>
 /// <param name="worker">BackgroundWorker object, used to report progress</param>
 /// <param name="e">not used</param>
 /// <returns>"Completed" if successful, or exception message if there was an error.</returns>
 public string VerifyAgainstActiveDirectory(string activeDirectoryPath, string logFileName,
                                            BackgroundWorker worker, DoWorkEventArgs e)
 {
     try
     {
         CS4Database database   = new CS4Database(SiteBuilder.Default.ClassServerDBConnectionString);
         DataTable   usersTable = null;
         m_totalUsers = database.GetUsersList(ref usersTable);
         LogFile log = new LogFile(logFileName);
         log.WriteToLogFile("Verifying Class Server users against Active Directory at " + activeDirectoryPath);
         ADHelper helper = new ADHelper();
         helper.DoADBinding(activeDirectoryPath);
         for (int userIndex = 0; userIndex < m_totalUsers; userIndex++)
         {
             CS4User user = new CS4User(usersTable.Rows[userIndex][0].ToString(), usersTable.Rows[userIndex][1].ToString(), System.String.Empty, System.String.Empty);
             if (!helper.UserExistsInActiveDirectory(user.UserDomain, user.UserLogin))
             {
                 log.WriteToLogFile(user.UserLoginWithDomain + " NOT FOUND");
                 m_usersNotInAD++;
             }
             else
             {
                 log.WriteToLogFile(user.UserLoginWithDomain + " found");
             }
             m_usersProcessed++;
             worker.ReportProgress(0, "Verified " + m_usersProcessed.ToString() + " of " + m_totalUsers.ToString() + " users.");
         }
         log.FinishLogging();
         string sReport = "Completed.";
         return(sReport);
     }
     catch (System.Exception ex)
     {
         //catching any exception here as this will be executed in a separate thread
         return(ex.Message);
     }
 }