Ejemplo n.º 1
0
        //备份
        private void btnBackup_Click(object sender, RoutedEventArgs e)
        {
            if (txtBackupName.Text.Trim() == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("备份名称不能为空,请重新输入!");
                return;
            }
            string fileName = txtBackupName.Text.Trim() + "-" + DateTime.Now.ToString("yyyyMMdd");

            SaveFileDialog ofd = new SaveFileDialog();

            ofd.Title           = "请选择保存文件的路径";
            ofd.DefaultExt      = "zip";
            ofd.FileName        = fileName;
            ofd.OverwritePrompt = true;
            ofd.AddExtension    = true;
            ofd.Filter          = "等速肌力数据库备份文件(*.zip)|*.zip";
            if (ofd.ShowDialog() == true)
            {
                string path = ofd.FileName;
                try
                {
                    CompressProgress progressWindow = new CompressProgress();
                    progressWindow.OutputPath = path;
                    progressWindow.Owner      = Application.Current.MainWindow;
                    progressWindow.ShowDialog();

                    Model.TB_BackupInfo backInfo = new Model.TB_BackupInfo();
                    backInfo.BackupDate = DateTime.Now.ToString("yyyy-MM-dd");
                    backInfo.BackupName = txtBackupName.Text.Trim();
                    backInfo.BackupPath = path;
                    backInfoBLL.Add(backInfo);
                    ReloadData();
                    txtBackupName.Text = "";

                    MessageBoxTool.ShowConfirmMsgBox("备份成功!");
                }
                catch (Exception ee)
                {
                    MessageBoxTool.ShowErrorMsgBox("备份出错,请稍候重试!\r\n" + ee.Message);
                }
            }
        }
Ejemplo n.º 2
0
 private void dgBackupInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (dgBackupInfo.SelectedIndex >= 0)
     {
         foreach (var model in backupInfoCollection)
         {
             model.IsChecked = false;
         }
         if (dgBackupInfo.SelectedItems.Count > 1)
         {
             foreach (var item in dgBackupInfo.SelectedItems)
             {
                 Model.TB_BackupInfo model = item as Model.TB_BackupInfo;
                 model.IsChecked = true;
             }
         }
         else
         {
             Model.TB_BackupInfo model = dgBackupInfo.SelectedItem as Model.TB_BackupInfo;
             model.IsChecked = true;
         }
     }
 }
Ejemplo n.º 3
0
        //备份
        private void btnBackup_Click(object sender, RoutedEventArgs e)
        {
            if (txtBackupName.Text.Trim() == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("备份名称不能为空,请重新输入!");
                return;
            }
            string fileName = txtBackupName.Text.Trim() + "-" + DateTime.Now.ToString("yyyyMMdd");

            SaveFileDialog ofd = new SaveFileDialog();
            ofd.Title = "请选择保存文件的路径";
            ofd.DefaultExt = "zip";
            ofd.FileName = fileName;
            ofd.OverwritePrompt = true;
            ofd.AddExtension = true;
            ofd.Filter = "等速肌力数据库备份文件(*.zip)|*.zip";
            if (ofd.ShowDialog()== true)
            {
                string path = ofd.FileName;
                try
                {
                    CompressProgress progressWindow = new CompressProgress();
                    progressWindow.OutputPath = path;
                    progressWindow.Owner = Application.Current.MainWindow;
                    progressWindow.ShowDialog();

                    Model.TB_BackupInfo backInfo = new Model.TB_BackupInfo();
                    backInfo.BackupDate = DateTime.Now.ToString("yyyy-MM-dd");
                    backInfo.BackupName = txtBackupName.Text.Trim();
                    backInfo.BackupPath = path;
                    backInfoBLL.Add(backInfo);
                    ReloadData();
                    txtBackupName.Text = "";

                    MessageBoxTool.ShowConfirmMsgBox("备份成功!");

                }
                catch (Exception ee)
                {
                    MessageBoxTool.ShowErrorMsgBox("备份出错,请稍候重试!\r\n" + ee.Message);

                }
            }
        }