/// <summary>The entry point for the application.</summary>
  /// <param name="argv">A list of command line arguments</param>
  public static void Main
  (
    String[] argv
  )
  {
   Boolean                         booleanParseCommandLineArguments  =  false;
   String                          exceptionMessage                  =  null;

   UtilityBCPArgument  utilityBCPArgument    =  null;
   
   utilityBCPArgument = new UtilityBCPArgument();
   
   booleanParseCommandLineArguments =  UtilityParseCommandLineArgument.ParseCommandLineArguments
   ( 
    argv, 
    utilityBCPArgument
   );
   
   if ( booleanParseCommandLineArguments  == false )
   {
    // error encountered in arguments. Display usage message
    UtilityDebug.Write
    (
     UtilityParseCommandLineArgument.CommandLineArgumentsUsage( typeof ( UtilityBCPArgument ) )    
    );  
    return;
   }//if ( booleanParseCommandLineArguments  == false )

   BCP
   (
    ref utilityBCPArgument,
    ref exceptionMessage
   );
  
  }//public static void Main()
  }//public static void Main()

  /// <summary>BCP.</summary>
  public static void BCP
  (
   ref UtilityBCPArgument utilityBCPArgument,
   ref String             exceptionMessage
  )
  {
   XmlNodeList         xmlNodeListDatabase  =  null;
   ArrayList           arrayListTableName   =  null;

   BCP
   (
    ref FilenameConfigurationXml,
    ref xmlNodeListDatabase,
    ref utilityBCPArgument,
    ref arrayListTableName,
    ref exceptionMessage
   );
   
  }//public static void BCP()
  }//public static void BCP()
  
  /// <summary>BCP.</summary>
  public static void BCP
  (
   ref String              filenameConfigurationXml,
   ref XmlNodeList         xmlNodeListDatabase,
   ref UtilityBCPArgument  utilityBCPArgument,
   ref ArrayList           arrayListTableName,
   ref String              exceptionMessage
  )
  {

   Boolean                redirectStandardOutputError = true;
   
   String                 BCPCommandOut;
   String                 BCPDataFile;
   String                 BCPDirectory;
   String                 BCPErrorFile;   
   String[]               databaseOwnerTableName;
   String                 dateTimeNow                 =  DateTime.Now.ToString(FormatDate);
   
   String                 redirectStandardOutput      = null;
   String                 redirectStandardError       = null;
   String                 verb                        = null;
   
   StringBuilder          capitalLetters;
   
   HttpContext            httpContext                 = HttpContext.Current;
   
   arrayListTableName = new ArrayList();
   
   if ( utilityBCPArgument.DatabaseName == null || utilityBCPArgument.DatabaseName.Length == 0 )
   {
   	utilityBCPArgument.DatabaseName  =  DatabaseName.Split( DelimiterCharArrayComma );
   }//if ( utilityBCPArgument.DatabaseName == null || utilityBCPArgument.DatabaseName.Length == 0 )	

   if ( utilityBCPArgument.TableName == null || utilityBCPArgument.TableName.Length == 0 )
   {
   	utilityBCPArgument.TableName = UtilityBCP.TableName.Split( UtilityBCP.DelimiterCharArrayComma );
   }//if ( utilityBCPArgument.TableName == null || utilityBCPArgument.TableName.Length == 0 )	

   if ( utilityBCPArgument.TableName != null && utilityBCPArgument.TableName.Length != 0 )
   {
    foreach ( String tableNameCurrent in utilityBCPArgument.TableName )
    {
   	 if ( tableNameCurrent.Trim() == String.Empty )
   	 {
      continue;   	 	
     }//if ( tableNameCurrent.Trim() == String.Empty )   	 	
   	 arrayListTableName.Add( tableNameCurrent );
    }//foreach ( String tableNameCurrent in utilityBCPArgument.tableName )   	
   }//if ( utilityBCPArgument.TableName != null && utilityBCPArgument.TableName.Length != 0 )
      
   UtilityDatabase.PopulateDatabaseTable
   (
    ref filenameConfigurationXml,
    ref xmlNodeListDatabase,
    ref utilityBCPArgument.databaseName,
    ref arrayListTableName,
    ref exceptionMessage
   ); 

   capitalLetters = utilityBCPArgument.CapitalLetters();
   
   foreach (object databaseOwnerTableNameCurrent in arrayListTableName)
   {
    databaseOwnerTableName = ((String) (databaseOwnerTableNameCurrent)).Split( DelimiterCharArrayFullStop );

    BCPDirectory           = String.Format
    (
     FormatBCPDirectory,
     utilityBCPArgument.DirectoryDataFile.ToString(),
     databaseOwnerTableName[RankDatabaseNamingConventionDatabaseName],
     databaseOwnerTableName[RankDatabaseNamingConventionTableName]
    ); 

    BCPDataFile            = String.Format
    (
     FormatBCPDataFile,
     BCPDirectory,
     databaseOwnerTableName[RankDatabaseNamingConventionTableName],
     dateTimeNow
    ); 

    BCPErrorFile            = String.Format
    (
     FormatBCPErrorFile,
     BCPDirectory,
     databaseOwnerTableName[RankDatabaseNamingConventionTableName],
     dateTimeNow
    ); 
    
    BCPCommandOut = String.Format
    (
     FormatBCPCommandOut,
     databaseOwnerTableNameCurrent,
     BCPDataFile,
     BCPErrorFile,
     capitalLetters
    ); 

    UtilityDebug.Write
    (
     String.Format
     (
      "BCP Directory: {0} | BCPDataFile: {1} | BCPErrorFile: {2} | BCPCommandOut: {3}",
      BCPDirectory,
      BCPDataFile,
      BCPErrorFile,
      BCPCommandOut
     )
    );

    UtilityDirectory.CreateDirectory
    (
     ref BCPDirectory,
     ref exceptionMessage
    );

    UtilityProcess.FileStart
    (
     ref CommandBCP,
     ref BCPCommandOut,
     ref verb,
     ref redirectStandardOutputError,
     ref redirectStandardOutput,
     ref redirectStandardError
    );
    
   }//foreach (object databaseOwnerTableNameCurrent in arrayListTableName)
  }//public static void BCP()