private void btnCancle_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBoxTool.ShowAskMsgBox("确定取消吗?") == MessageBoxResult.Yes)
     {
         cancled = true;
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DataFilePath?.Equals("") == true)//没有设置数据目录,则压缩默认数据目录的数据文件
            {
                if (Directory.Exists(Model.AppPath.XmlDataDirPath))
                {
                    fileNames.AddRange(Directory.GetFiles(Model.AppPath.XmlDataDirPath));
                }
                fileNames.Add(Model.AppPath.RootPath + "\\AppData\\DSJLDB.mdb");
            }
            else
            {
                if (!Directory.Exists(DataFilePath))
                {
                    MessageBoxTool.ShowConfirmMsgBox("未找到数据文件目录!");
                    this.Close();
                }
                else
                {
                    fileNames.AddRange(Directory.GetFiles(DataFilePath));
                }
            }
            pbCompression.Maximum = fileNames.Count;

            Thread t = new Thread(new ThreadStart(CompressionThread));

            t.Start();
        }
Beispiel #3
0
        //登录
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("用户名不能为空!");
                return;
            }
            if (txtPwd.Password == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("密码不能为空!");

                return;
            }
            if (adminInfoBLL.GetModelList("AdminName='" + txtName.Text.Trim() + "' and AdminPwd='" + txtPwd.Password.Trim() + "'").Count > 0)
            {
                mainWindow = new MainWindow();
                Application.Current.MainWindow = mainWindow;
                this.Close();
                mainWindow.Show();
            }
            else
            {
                MessageBoxTool.ShowConfirmMsgBox("用户名或密码输入错误,请重新输入!!");
            }
        }
Beispiel #4
0
 private bool ConfirmCancleBackup()
 {
     if (MessageBoxTool.ShowAskMsgBox("正在进行备份,确定要取消吗?") == MessageBoxResult.Yes)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #5
0
        //部分备份
        private void btnBackupProject_Click(object sender, RoutedEventArgs e)
        {
            if (txtBackupName.Text.Trim() == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("备份名称不能为空,请重新输入!");
                return;
            }
            BackupProjectWindow backupProjectWindow = new BackupProjectWindow();

            backupProjectWindow.BackupName = txtBackupName.Text.Trim();
            backupProjectWindow.ShowDialog();
        }
Beispiel #6
0
        private void btnBackup_Click(object sender, RoutedEventArgs e)
        {
            backupTask = new Task(() =>
            {
                try
                {
                    //创建temp 目录
                    CreateDir(AppPath.TempDirPath);
                    //1、读取选择的项目的测试数据,包括人员信息和测试数据
                    List <TB_TestManager> checkedTestManager = testManagerList.FindAll(x => x.IsChecked == true);
                    Converter <TB_TestManager, int> testManagerIDConverter = new Converter <TB_TestManager, int>((TB_TestManager manager) =>
                    {
                        return(manager.ID);
                    });
                    int[] checkedTestManagerIDs   = checkedTestManager.ConvertAll <int>(testManagerIDConverter).ToArray();
                    string testManagerIDs         = string.Join(",", checkedTestManagerIDs);
                    List <TB_AthleteInfo> athList = (new BLL.TB_AthleteInfo()).GetModelList(string.Format("ath_testid in ({0})", testManagerIDs));
                    Converter <TB_AthleteInfo, int> athIDConverter = new Converter <TB_AthleteInfo, int>((TB_AthleteInfo ath) =>
                    {
                        return(ath.ID);
                    });
                    string athIDs = string.Join(",", athList.ConvertAll <int>(athIDConverter).ToArray());
                    List <TB_TestInfo> testInfoList = (new BLL.TB_TestInfo()).GetModelList(string.Format("ath_id in ({0})", athIDs));
                    //2、复制空数据库文件,复制数据xml文件
                    File.Copy(AppPath.DataPath + AppPath.EmptyDBName, AppPath.TempDirPath + AppPath.DBName);
                    //3、往空数据库文件中写入数据
                    DBUtility.DbHelperOleDb.SetDBPath(AppPath.TempDirPath + AppPath.DBName);//------------------

                    //4、创建压缩窗口,设置DataFilePath属性,并启动,Invoke
                    this.Dispatcher.Invoke(new Action(() => {
                        CompressProgress compress = new CompressProgress();
                        compress.DataFilePath     = AppPath.TempDirPath;
                        compress.OutputPath       = backFileName;
                        if (compress.ShowDialog() == true)
                        {
                            //删除temp目录
                            DeleteTempDir();
                            MessageBoxTool.ShowConfirmMsgBox("备份成功!");
                            this.Close();
                        }
                    }));
                }
                catch (Exception ee)
                {
                    MessageBoxTool.ShowConfirmMsgBox(string.Format("备份出现错误!\r\n异常类型:{0}\r\n异常信息:{1}", ee.GetType().ToString(), ee.Message));
                }
            });
            backupTask.Start();
            btnBackup.IsEnabled = btnChangeFolder.IsEnabled = false;
            btnCancle.IsEnabled = true;
        }
Beispiel #7
0
 private void Stop_Service_Click(object sender, RoutedEventArgs e)
 {
     if (ServiceFactory.IsServiceExisted(ServeName))
     {
         this.Cursor = Cursors.Wait;
         ServiceFactory.ServiceStop(ServeName);
         ServiceFactory.UninstallService(ServePath);
         this.Cursor = Cursors.Arrow;
         MessageBoxTool.Succeed("卸载成功!");
     }
     else
     {
         MessageBoxTool.Error("服务不存在!");
     }
 }
Beispiel #8
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);
                }
            }
        }
Beispiel #9
0
        //还原
        private void btnRestore_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBoxTool.ShowAskMsgBox("还原数据库会把现有的数据库删除,且不可恢复,确定要还原吗?") == MessageBoxResult.Yes)
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Title  = "还原数据库";
                ofd.Filter = "压缩文件(*.zip)|*.zip";
                if (ofd.ShowDialog() == true)
                {
                    ExtractProgressWindow extractWindow = new ExtractProgressWindow();
                    extractWindow.BackupFile = ofd.FileName;
                    extractWindow.Owner      = Application.Current.MainWindow;
                    extractWindow.ShowDialog();

                    ReloadData();
                    DSJL.Tools.DBUpgrade.Upgrade();
                    MessageBoxTool.ShowConfirmMsgBox("还原成功!");
                }
            }
        }
Beispiel #10
0
 /// <summary>
 /// 系统设置保存
 /// </summary>
 private void SystemSave()
 {
     if (FormatVerification.IsFloat(interval.Text.Trim()))
     {
         if (OperateIniTool.Exist)
         {
             DataBaseConfig().OperateIniWrite("DB", "MySql");
             interval.Text.Trim().OperateIniWrite("Table", "interval");
             ConnectionStringsConfig.UpdateConnectionStringsConfig("DataBaseText", DataBaseConfig());
             SaveRun();
             this.Close();
         }
         else
         {
             MessageBoxTool.Error("配置文件丢失!");
         }
     }
     else
     {
         MessageBoxTool.Error("格式错误!");
     }
 }
Beispiel #11
0
 private void Go_Click(object sender, RoutedEventArgs e)
 {
     if (Table_Data.Items.Count > 0)
     {
         if (FormatVerification.IsFloat(IndexPs.Text.Trim()))
         {
             if (!FormatVerification.Strfloat(IndexPs.Text.Trim()))
             {
                 int Ind = Convert.ToInt32(IndexPs.Text.Trim());
                 if (Ind > 0 && Ind <= Convert.ToInt32(CountData.Content))
                 {
                     Index = Ind;
                 }
                 LoadLogInfo();
             }
         }
         else
         {
             MessageBoxTool.Error("格式输入错误!");
         }
     }
 }
Beispiel #12
0
        /// <summary>
        /// 导出日志
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Write_Log_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(DateTimes.Text))
            {
                MessageBoxTool.Error("请选择查询日期!");
                return;
            }
            string Times = (Convert.ToDateTime(DateTimes.Text)).ToString("yyyyMMdd");

            if (Ga_Map.TableNotexistBLL($"loginfo{Times}"))
            {
                Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
                sfd.Filter   = "日志文件|*.log";
                sfd.FileName = $"log_{Times}";
                if (sfd.ShowDialog() == true)
                {
                    Function.LogWrite(sfd.FileName, Times);
                }
            }
            else
            {
                MessageBoxTool.Error("暂无日志!");
            }
        }
Beispiel #13
0
        public bool Verify()
        {
            if (string.IsNullOrEmpty(DateTimes.Text))
            {
                MessageBoxTool.Error("请选择查询日期!");
                return(false);
            }
            if (!string.IsNullOrEmpty(AgvNum.Text))
            {
                if (!FormatVerification.IsFloat(AgvNum.Text.Trim()))
                {
                    MessageBoxTool.Error("AGV编号格式输入错误!");
                    return(false);
                }
            }
            if (FormatVerification.IsFloat(StartHour.Text))
            {
                if (FormatVerification.Strfloat(StartHour.Text))
                {
                    MessageBoxTool.Error("开始时间小时格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(StartHour.Text) > 23 || Convert.ToInt32(StartHour.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间小时格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间格小时式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Startminute.Text))
            {
                if (FormatVerification.Strfloat(Startminute.Text))
                {
                    MessageBoxTool.Error("开始时间分钟格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Startminute.Text) > 60 || Convert.ToInt32(Startminute.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间分钟格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间分钟格式输入错误!");
                return(false);
            }

            if (FormatVerification.IsFloat(Startsecond.Text))
            {
                if (FormatVerification.Strfloat(Startsecond.Text))
                {
                    MessageBoxTool.Error("开始时间秒格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Startsecond.Text) > 60 || Convert.ToInt32(Startsecond.Text) < 0)
                    {
                        MessageBoxTool.Error("开始时间秒格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("开始时间秒格式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(StopHour.Text))
            {
                if (FormatVerification.Strfloat(StopHour.Text))
                {
                    MessageBoxTool.Error("结束时间小时格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(StopHour.Text) > 23 || Convert.ToInt32(StopHour.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间小时格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间格小时式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Stopminute.Text))
            {
                if (FormatVerification.Strfloat(Stopminute.Text))
                {
                    MessageBoxTool.Error("结束时间分钟格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Stopminute.Text) > 60 || Convert.ToInt32(Stopminute.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间分钟格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间分钟格式输入错误!");
                return(false);
            }
            if (FormatVerification.IsFloat(Stopsecond.Text))
            {
                if (FormatVerification.Strfloat(Stopsecond.Text))
                {
                    MessageBoxTool.Error("结束时间秒格式输入错误!");
                    return(false);
                }
                else
                {
                    if (Convert.ToInt32(Stopsecond.Text) > 60 || Convert.ToInt32(Stopsecond.Text) < 0)
                    {
                        MessageBoxTool.Error("结束时间秒格式输入错误!");
                        return(false);
                    }
                }
            }
            else
            {
                MessageBoxTool.Error("结束时间秒格式输入错误!");
                return(false);
            }
            return(true);
        }