Exemplo n.º 1
0
        //Used to export the database backup from LIVE to a local folder.
        public async Task <bool> ExportDatabases(List <string> databases, string connectionString)
        {
            string folderPath = $"{_backupFolderPath}{DateTime.Now.ToString("dd-MM-yyyy")}\\";

            FormControls.ToggleAllElements(false);
            Directory.CreateDirectory(folderPath);


            for (int i = 0; i < databases.Count; i++)
            {
                if (!await SQLPackage.Run("Export", databases[i], connectionString, folderPath))
                {
                    FormControls.ClearOutputToApp();
                    return(false);
                }
            }

            FormControls.OutputToApp("------------------");
            FormControls.OutputToApp("Finished Exporting");

            return(true);
        }