예제 #1
0
 //导出数据
 private void btnExport_Click(object sender, RoutedEventArgs e)
 {
     List<Model.TestInfoModel> checkedModelList = testInfoModelList.FindAll(x => x.IsChecked == true);
     if (checkedModelList.Count > 0)
     {
         ExportProgressPage.FileNamePreExt = "";
         ExportProgressPage.TestInfoList = checkedModelList;
         ExportDataWindow exportWindow = new ExportDataWindow();
         exportWindow.Owner = Application.Current.MainWindow;
         exportWindow.ShowDialog();
     }
     else
     {
         MessageBox.Show("请至少选择一条数据!", "系统信息");
     }
 }
예제 #2
0
        //导出数据
        private void btnExportData_Click(object sender, RoutedEventArgs e)
        {
            string standName = "";
            if (standManager.SelectedItem == null)
            {
                MessageBox.Show("请选择测试参考值!", "系统信息");
                return;
            }
            else
            {
                standName = standManager.SelectedItem.Stand_Name;
            }
            if (testInfoModelList.Count == 0)
            {
                MessageBox.Show("所选的参考值下没有测试信息,不能导出!", "系统信息");
                return;
            }

            List<Model.TestInfoModel> checkedModelList = testInfoModelList.FindAll(x => x.IsChecked == true);
            if (checkedModelList.Count > 0)
            {
                ExportProgressPage.FileNamePreExt = standName;
                ExportProgressPage.TestInfoList = checkedModelList;
                ExportDataWindow exportWindow = new ExportDataWindow();
                exportWindow.Owner = Application.Current.MainWindow;
                exportWindow.ShowDialog();
            }
            else
            {
                MessageBox.Show("请至少选择一条数据!", "系统信息");
            }

            //SaveFileDialog sfd = new SaveFileDialog();
            //sfd.Title = "请选择保存文件的路径";
            //sfd.DefaultExt = "xls";
            //sfd.FileName = standName + "测试参考值数据导出(" + DateTime.Now.ToString("yyyy-MM-dd") + ")";
            //sfd.OverwritePrompt = true;
            //sfd.AddExtension = true;
            //sfd.Filter = "Excel文件(*.xls)|*.xls";
            //if (sfd.ShowDialog() == true)
            //{
            //    string savePath = sfd.FileName;

            //    List<List<XElement>> dataList = DSJL.Export.GenerateCompareResportXml.ComputeAvg(testInfoModelList);
            //    ExportData exportData = new ExportData();
            //    try
            //    {
            //        exportData.Export(dataList, savePath);
            //        MessageBox.Show("导出成功!", "系统信息");
            //    }
            //    catch (Exception ee)
            //    {
            //        MessageBox.Show("导出数据异常!\r\n" + ee.Message, "系统错误");
            //    }

            //}
        }