//选择路径
 private void btnChoosePath_Click(object sender, RoutedEventArgs e)
 {
     if (ShowFileDialogTool.ShowSaveFileDialog(out choosePath, ShowFileDialogTool.pdfFilter, ShowFileDialogTool.pdfExt, "测试报告"))
     {
         choosePath          = choosePath.Substring(0, choosePath.LastIndexOf("\\"));
         btnExport.IsEnabled = true;
         txtPath.Text        = "导出报告位置:" + choosePath;
     }
 }
示例#2
0
 private bool ChooseBackupPath()
 {
     if (ShowFileDialogTool.ShowSaveFileDialog(out backFileName, ShowFileDialogTool.zipFilter, ShowFileDialogTool.zipExt, BackupName) && !backFileName.Equals(""))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
        //导出人员信息
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            List <Model.TB_AthleteInfo> selectedAthleteList = athleteList.FindAll(model => model.IsChecked == true);

            if (selectedAthleteList.Count == 0)
            {
                MessageBox.Show("请选择要导出的受试者信息!");
                return;
            }
            string fileName;
            string excelName = testManager.SelectedItem.TestName + "的受试者信息";

            if (ShowFileDialogTool.ShowSaveFileDialog(out fileName, ShowFileDialogTool.excelFilter, ShowFileDialogTool.excelExt, excelName))
            {
                string tempFileName = AppDomain.CurrentDomain.BaseDirectory + "\\AppTemplate\\listofnames.xls";
                string[,] contents = new string[selectedAthleteList.Count, 15];
                for (int i = 0; i < selectedAthleteList.Count; i++)
                {
                    Model.TB_AthleteInfo item = selectedAthleteList[i];
                    contents[i, 0]  = item.Ath_TestDate.ToString("yyyy年MM月dd日");
                    contents[i, 1]  = item.Ath_Name;
                    contents[i, 2]  = item.Ath_Sex;
                    contents[i, 3]  = ((DateTime)item.Ath_Birthday).ToString("yyyy年MM月dd日");
                    contents[i, 4]  = item.Ath_Height;
                    contents[i, 5]  = item.Ath_Weight;
                    contents[i, 6]  = item.Ath_Project;
                    contents[i, 7]  = item.Ath_MainProject;
                    contents[i, 8]  = item.Ath_TrainYears;
                    contents[i, 9]  = item.Ath_Level;
                    contents[i, 10] = item.Ath_Team;
                    contents[i, 11] = item.Ath_TestAddress;
                    contents[i, 12] = item.Ath_TestMachine;
                    contents[i, 13] = item.Ath_TestState;
                    contents[i, 14] = item.Ath_Remark;
                }
                try
                {
                    ExcelDao.ExcelUtil.SaveExcelFile(fileName, tempFileName, contents, 1, 3);
                    MessageBox.Show("导出成功!", "系统信息", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception ee)
                {
                    MessageBox.Show("导出受试者信息出错!\r\n" + ee.Message, "系统错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
示例#4
0
        //导出报告
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            if (testInfoModelList.Count == 0)
            {
                MessageBox.Show("所选的参考值下没有测试信息,不能导出!", "系统信息");
                return;
            }
            try
            {
                //刷新图表
                pageAvgCurve.ModelList = testInfoModelList;

                string pdfFileName = "";
                string reportTitle = "";
                string standName   = "";
                DSJL.Export.ExportModeEnum exportMode = DSJL.Export.ExportModeEnum.Mode1;

                List <Model.TestInfoModel> checkedModel = testInfoModelList.FindAll(x => x.IsChecked == true);

                if (rbMode1.IsChecked == true)
                {
                    //if (checkedModel.Count < 2)
                    //{
                    //    MessageBox.Show("请至少选择两条测试信息进行对比报告导出!", "系统信息");
                    //    return;
                    //}
                    exportMode  = DSJL.Export.ExportModeEnum.Mode1;
                    pdfFileName = "等速肌力互相对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")";
                    reportTitle = "等速肌力互相对比报告";
                }
                else if (rbMode2.IsChecked == true)
                {
                    exportMode  = DSJL.Export.ExportModeEnum.Mode2;
                    pdfFileName = "等速肌力个人与平均曲线报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")";
                    reportTitle = "等速肌力个人与平均曲线报告";
                }
                else if (rbMode3.IsChecked == true)
                {
                    //if (checkedModel.Count < 1)
                    //{
                    //    MessageBox.Show("请至少选择一条测试信息进行对比报告导出!", "系统信息");
                    //    return;
                    //}
                    if (standManager.SelectedItem == null)
                    {
                        MessageBox.Show("请选择测试参考值!", "系统信息");
                        return;
                    }
                    else
                    {
                        standName = standManager.SelectedItem.Stand_Name;
                    }
                    exportMode  = DSJL.Export.ExportModeEnum.Mode3;
                    pdfFileName = "等速肌力个人与参考值对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")";
                    reportTitle = "等速肌力个人与参考值对比报告";
                }

                string selectedPath = "";
                if (!ShowFileDialogTool.ShowSaveFileDialog(out selectedPath, ShowFileDialogTool.pdfFilter, ShowFileDialogTool.pdfExt, "测验报告"))
                {
                    return;
                }
                else
                {
                    selectedPath = selectedPath.Substring(0, selectedPath.LastIndexOf("\\"));
                }

                //生成数据xml对象,供导出报告使用
                DSJL.Export.GenerateCompareResportXml garxml = new DSJL.Export.GenerateCompareResportXml(exportMode);
                garxml.CurrentTitle              = reportTitle;
                garxml.TestInfoModelList         = GetSortedTestInfoModelList();
                garxml.StandardTestInfoModelList = testInfoModelList;
                garxml.StandName = standName;
                System.Xml.Linq.XDocument xdoc = garxml.GenerateXDoc();

                //生成平均曲线图片
                DSJL.Export.SaveUIElementToImage.SaveToImage(pageAvgCurve, AppDomain.CurrentDomain.BaseDirectory + "avg.jpg");
                //开始导出
                DSJL.Export.ExportCompareReport exportReport = new DSJL.Export.ExportCompareReport(xdoc);
                exportReport.Export(selectedPath + "\\" + pdfFileName + ".pdf");

                //删除平均曲线图片
                File.Delete(AppDomain.CurrentDomain.BaseDirectory + "avg.jpg");
                MessageBox.Show("导出成功!", "系统信息");
            }
            catch (Exception ee)
            {
                MessageBox.Show("导出出错!\r\n" + ee.Message, "系统错误");
            }
        }