예제 #1
0
        /// <summary>
        /// Creates DataTable containing the custom values specified in the RandomCustomValuesDataRequest definition.
        /// </summary>
        /// <param name="numRows">Number of output rows to generate.</param>
        /// <param name="rdr">RandomCustomValuesDataRequest object contains the definition for the custom values.</param>
        /// <param name="summaryDataTable">DataTable that will contain the summary values (i.e. how many times each value appears in the result table).</param>
        /// <param name="showInstalledDatabaseProvidersOnly">Instructs custom values routines to only allow connections from the list installed database providers.</param>
        /// <param name="defaultOutputDatabaseType">Default database type to show if user is prompted for connection information.</param>
        /// <param name="defaultOutputDatabaseConnectionString">Default connection string to use if user is prompted for connection information.</param>
        /// <param name="defaultDataGridExportFolder">Default folder for storing any output requested by user from the result grids that are displayed.</param>
        /// <returns>ADO.NET DataTable containing the custom values.</returns>
        /// <remarks>New set of values are generated and stored by this routine.</remarks>
        public DataTable CreateRandomCustomValuesDataTable(int numRows,
                                                           RandomCustomValuesDataRequest rdr,
                                                           out DataTable summaryDataTable,
                                                           bool showInstalledDatabaseProvidersOnly,
                                                           string defaultOutputDatabaseType,
                                                           string defaultOutputDatabaseConnectionString,
                                                           string defaultDataGridExportFolder)
        {
            DataTable         summaryTable  = new DataTable();
            DataListProcessor _appProcessor = new DataListProcessor();
            DataTable         listTable     = null;

            try
            {
                _appProcessor.ShowInstalledDatabaseProvidersOnly    = showInstalledDatabaseProvidersOnly;
                _appProcessor.DefaultOutputDatabaseType             = defaultOutputDatabaseType;
                _appProcessor.DefaultOutputDatabaseConnectionString = defaultOutputDatabaseConnectionString;
                _appProcessor.GridExportFolder = defaultDataGridExportFolder;

                summaryTable = _appProcessor.GetCustomRandomDataFile(rdr, numRows, false, false);
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append("Error in CreateRandomCustomValuesDataTable routine.\r\n");
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                throw new System.Exception(_msg.ToString());
            }
            finally
            {
                ;
            }

            summaryDataTable = summaryTable;
            listTable        = CreateCustomValuesListTable(summaryTable);

            return(listTable);
        }
예제 #2
0
        /// <summary>
        /// Generates set of random names and associated locations. This routine allows the randomizer routines to display a grid with the output before returning with the result.
        /// </summary>
        /// <param name="numRows">Number of names to generate.</param>
        /// <param name="rdr">RandomNamesAndLocationsDataRequest object containing the definition to use for the name and location generation.</param>
        /// <param name="showInstalledDatabaseProvidersOnly">Show list of installed data providers only if the user is shown an output grid and wants to manually export the list to external storage.</param>
        /// <param name="defaultOutputDatabaseType">Default database to show if user is prompted for connection information.</param>
        /// <param name="defaultOutputDatabaseConnectionString">Default connection string to show if user is prompted for connection information.</param>
        /// <param name="defaultDataGridExportFolder">Default export file folder to use if user is exporting data from a grid displaying the random names/locations output.</param>
        /// <returns>ADO.NET DataTable containing the set of random names and locations.</returns>
        public DataTable CreateRandomNamesAndLocationsDataTable(int numRows,
                                                                RandomNamesAndLocationsDataRequest rdr,
                                                                bool showInstalledDatabaseProvidersOnly,
                                                                string defaultOutputDatabaseType,
                                                                string defaultOutputDatabaseConnectionString,
                                                                string defaultDataGridExportFolder)
        {
            DataTable         dt            = new DataTable();
            DataListProcessor _appProcessor = new DataListProcessor();

            try
            {
                _appProcessor.ShowInstalledDatabaseProvidersOnly    = showInstalledDatabaseProvidersOnly;
                _appProcessor.DefaultOutputDatabaseType             = defaultOutputDatabaseType;
                _appProcessor.DefaultOutputDatabaseConnectionString = defaultOutputDatabaseConnectionString;
                _appProcessor.GridExportFolder = defaultDataGridExportFolder;

                dt = _appProcessor.GetRandomNamesList(rdr,
                                                      numRows,
                                                      false,   //no output to xml file
                                                      rdr.RandomDataXmlFilesFolder,
                                                      rdr.ListName,
                                                      false);  //no output to preview grid
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append("Error in CreateRandomNamesAndLocationsDataTable routine.\r\n");
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                throw new System.Exception(_msg.ToString());
            }
            finally
            {
                ;
            }

            return(dt);
        }