Ejemplo n.º 1
0
        /// <summary>
        /// Faz o backup do banco de dados inteiro
        /// </summary>
        public void backupDb()
        {
            Data();
            dirmngr = new DirMngr(config.BackupFolder + @"\Dumps\");

            List<string> cmdLst = new List<string>();
            try
            {
                cmdLst.Add("echo off");
                cmdLst.Add("cd " + '"' + config.MysqlFolder + @"\bin" + '"');
                cmdLst.Add(
                    "mysqldump -u " + Connect.User +
                    " -p" + Connect.Password +
                    " -x -e -B " + Connect.Database +
                    " > " + '"' + config.BackupFolder + @"\Dumps\dumpGdcBackup" + date + ".sql" + '"'
                    );

                dirmngr.CreateDir();

                DirMngr.runCmdExit(cmdLst);

                System.Windows.Forms.MessageBox.Show("Backup realizado com sucesso", "Backup", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            catch (Exception err)
            {
                System.Windows.Forms.MessageBox.Show("Erro: " + err.Message, "Backup", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// cria e/ou adiciona linhas a um arquivo .sql para backup
        /// </summary>
        /// <param name="content">campos do clientes separados por "[" numa unica string</param>
        public void backup(string content)
        {
            Data();
            config = new ConfigMngr();

            dirmngr = new DirMngr(config.BackupFolder + @"\backup" + date + ".sql");

            content = sqlcmd(content);

            dirmngr.AppendText(content);
        }
Ejemplo n.º 3
0
 public ConfigMngr()
 {
     dirmngr = new DirMngr(DirMngr.Dir + @"\Config(" + DirMngr.User + ").ini");
     LoadConfig();
 }