Beispiel #1
0
        public void Execute()
        {
            var checkSql = new SqlBase();

            switch (checkSql.GetSqlVersion())
            {
            case SqlTypeEnum.Sql2000:
                var backup2000 = new Sql2000();
                backup2000.Backup();
                break;

            case SqlTypeEnum.Sql2005:
                var backup2005 = new Sql2005();
                backup2005.Backup();
                break;

            case SqlTypeEnum.Sql2008:
                var backup2008 = new Sql2008();
                backup2008.Backup();
                break;
            }
        }
Beispiel #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (comboBoxDatabase.SelectedItem == null)
            {
                MessageBox.Show("未输入数据库名");
                return;
            }
            if (textBoxDbUser.Text == "")
            {
                MessageBox.Show("未输入数据库用户名");
                return;
            }
            if (comboBoxDatabase.SelectedItem.ToString() == "")
            {
                MessageBox.Show("未输入数据库");
                return;
            }

            AppSetingHelper.UpdateAppString("DatabaseName", AESHelper.AESEncrypt(GlobleVariable.DatabaseName, "adsfadsfadfadsfasasdfads"));
            AppSetingHelper.UpdateAppString("DatabaseUser", AESHelper.AESEncrypt(GlobleVariable.DatabaseUser, "adsfadsfadfadsfasasdfads"));
            AppSetingHelper.UpdateAppString("DatabasePassword", AESHelper.AESEncrypt(GlobleVariable.DatabasePassword, "adsfadsfadfadsfasasdfads"));
            AppSetingHelper.UpdateAppString("LocalKeepDay", "-" + numericUpDownLocalKeepDay.Value.ToString());
            AppSetingHelper.UpdateAppString("BackupTime", numericUpDownBackupTime.Value.ToString());


            AppSetingHelper.UpdateAppString("RunTime", "1");

            GlobleVariable.LocalKeeyDay = -1 * (int)numericUpDownLocalKeepDay.Value;

            string outFangyouClient, outFangyouVer;

            GetFangyouInfo(out outFangyouVer, out outFangyouClient);
            GlobleVariable.FangyouClient = outFangyouClient;
            GlobleVariable.FangyouVer    = outFangyouVer;
            AppSetingHelper.UpdateAppString("FangyouVer", outFangyouVer);
            AppSetingHelper.UpdateAppString("FangyouClient", outFangyouClient);
            var sqlBase = new SqlBase();

            GlobleVariable.SqlServerType = sqlBase.GetSqlVersion();
            AppSetingHelper.UpdateAppString("SqlType", GlobleVariable.SqlServerType.ToString());
            AppSetingHelper.UpdateAppString("LocalKeeyDay", GlobleVariable.LocalKeeyDay.ToString());

            var result = MessageBox.Show("是否立即执行备份工作?", "提示", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                var checkSql = new SqlBase();
                GlobleVariable.Progress = true;
                switch (checkSql.GetSqlVersion())
                {
                case SqlTypeEnum.Sql2000:
                    var backup2000 = new Sql2000();
                    backup2000.Backup();
                    break;

                case SqlTypeEnum.Sql2005:
                    var backup2005 = new Sql2005();
                    backup2005.Backup();
                    break;

                case SqlTypeEnum.Sql2008:
                    var backup2008 = new Sql2008();
                    backup2008.Backup();
                    break;
                }
            }

            this.Close();
        }