コード例 #1
0
ファイル: BackupMngr.cs プロジェクト: Vhoyer/GdC
        /// <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);
        }
コード例 #2
0
ファイル: FrmConfig.cs プロジェクト: Vhoyer/GdC
        private void btnAplicar_Click(object sender, EventArgs e)
        {
            ConfigMngr config = new ConfigMngr();

            config.BackupFolder = tbDirBack.Text;
            config.BackupTime = nmrHora.Value + ":" + nmrMin.Value;
            config.BackupEnable = cbEnable.Checked;
            config.MysqlFolder = tbMysqlDir.Text;
            config.BackupFrequency = checkFreq();
            config.BackupDay = dtpA.Text.Split('/')[0];
            config.BackupMonth = dtpA.Text.Split('/')[1];
            config.BackupDofW = dtpW.Text;

            try
            {
                config.UpdateFile();
            }
            catch (Exception err)
            {
                MessageBox.Show("Erro: " + err.Message + "\n\nDetalhes:\n" + err, "Erro");
            }
        }
コード例 #3
0
ファイル: BackupMngr.cs プロジェクト: Vhoyer/GdC
 public BackupMngr()
 {
     config = new ConfigMngr();
 }
コード例 #4
0
ファイル: FrmMain.cs プロジェクト: Vhoyer/GdC
        private void tmr_Tick(object sender, EventArgs e)
        {
            ConfigMngr config = new ConfigMngr();

            stslblTime.Text = DateTime.Now.ToLongTimeString();

            if (config.BackupEnable)
            {
                if (config.BackupFrequency.ToString().ToUpper() == "D")
                {
                    if (config.BackupTime == DateTime.Now.ToShortTimeString() && !config.DidHappened)
                    {
                        config.DidHappened = true;
                        config.UpdateFile();
                        BackupMngr backup = new BackupMngr();
                        backup.backupDb();
                    }
                    else if (!(config.BackupTime == DateTime.Now.ToShortTimeString()) && config.DidHappened)
                    {
                        config.DidHappened = false;
                        config.UpdateFile();
                    }
                }
                else if (config.BackupFrequency.ToString().ToUpper() == "S")
                {
                    if (config.BackupDofW == DateTime.Now.DayOfWeek.ToString() && !config.DidHappened)
                    {
                        config.DidHappened = true;
                        config.UpdateFile();
                        BackupMngr backup = new BackupMngr();
                        backup.backupDb();
                    }
                    else if (!(config.BackupDofW == DateTime.Now.DayOfWeek.ToString()) && config.DidHappened)
                    {
                        config.DidHappened = false;
                        config.UpdateFile();
                    }
                }
                else if (config.BackupFrequency.ToString().ToUpper() == "Q")
                {
                    if (config.BackupDofW == DateTime.Now.DayOfWeek.ToString() && !config.DidHappened)
                    {
                        config.DidHappened = true;
                        config.UpdateFile();
                        BackupMngr backup = new BackupMngr();
                        backup.backupDb();
                    }
                    else if (!(config.BackupDofW == DateTime.Now.DayOfWeek.ToString()) && config.DidHappened)
                    {
                        config.DidHappened = false;
                        config.UpdateFile();
                    }
                }
                else if (config.BackupFrequency.ToString().ToUpper() == "M")
                {
                    if (config.BackupDay == DateTime.Now.Day.ToString() && !config.DidHappened)
                    {
                        config.DidHappened = true;
                        config.UpdateFile();
                        BackupMngr backup = new BackupMngr();
                        backup.backupDb();
                    }
                    else if (!(config.BackupDay == DateTime.Now.Day.ToString()) && config.DidHappened)
                    {
                        config.DidHappened = false;
                        config.UpdateFile();
                    }
                }
                else if (config.BackupFrequency.ToString().ToUpper() == "A")
                {
                    if (config.BackupMonth == DateTime.Now.Month.ToString() &&
                        config.BackupDay == DateTime.Now.Day.ToString() &&
                        !config.DidHappened)
                    {
                        config.DidHappened = true;
                        config.UpdateFile();
                        BackupMngr backup = new BackupMngr();
                        backup.backupDb();
                    }
                    else if (!(config.BackupMonth == DateTime.Now.Month.ToString() &&
                             config.BackupDay == DateTime.Now.Day.ToString()) &&
                             config.DidHappened)
                    {
                        config.DidHappened = false;
                        config.UpdateFile();
                    }
                }
            }
        }
コード例 #5
0
ファイル: FrmConfig.cs プロジェクト: Vhoyer/GdC
        private void pnlsConfig_VisibleChanged(object sender, EventArgs e)
        {
            ConfigMngr config = new ConfigMngr();

            tbDirBack.Text = config.BackupFolder;
            nmrHora.Value = int.Parse(config.BackupTime.Split(':')[0]);
            nmrMin.Value = int.Parse(config.BackupTime.Split(':')[1]);
            cbEnable.Checked = config.BackupEnable;
            tbMysqlDir.Text = config.MysqlFolder;
            cbFreq.Text = CbFreqText(config.BackupFrequency);
            dtpA.Text = config.BackupDay + '/' + config.BackupMonth;
        }