Exemplo n.º 1
0
        private void buttonRunToFile_Click(object sender, EventArgs e)
        {
            completedWork = 0;

            saveFileStruct = new SaveFileStruct();

            saveFileStruct.DBDescription =
                GetConnectionStringFromCheckedBoxListDataBase();
            new SaveFile(
                (string pathToDir,
                 bool isHeader,
                 string separator,
                 string type) =>
            {
                saveFileStruct.pathToDir       = pathToDir;
                saveFileStruct.isHeader        = isHeader;
                saveFileStruct.separator       = separator;
                saveFileStruct.type            = type;
                saveFileStruct.query           = richTextBoxQuery.Text;
                saveFileStruct.connectionCount = GetConnectionCount();
                UtilityFile.CreateDir(pathToDir);
                var query = saveFileStruct.query + " LIMIT " + getByOneRequest;
                Run(query, SetResultsToFiles, saveFileStruct.DBDescription);
                var strPathToLog = saveFileStruct.pathToDir + @"\log.txt";
                console          = new Utility.Console(strPathToLog);
                console.Show();
            }).Show();
        }
Exemplo n.º 2
0
        private void SaveAllFiles(
            string pathToDir,
            bool isHeader,
            string separator,
            string type)
        {
            int pagesCount = tabControlResult.TabPages.Count;

            UtilityFile.CreateDir(pathToDir);
            for (int i = 0; i < pagesCount; i++)
            {
                var currentPage =
                    tabControlResult.
                    TabPages[i];
                var currentFileName =
                    currentPage.Name;
                DataTable dt =
                    (DataTable)
                    ((DataGridView)currentPage.
                     Controls[0]).
                    DataSource;
                SaveAllFiles(
                    dt,
                    currentFileName,
                    pathToDir,
                    isHeader,
                    separator,
                    type);
            }
        }