private void tb_PrintReport_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; INRDataProcessService myDataProcessService = BusinessStaticInstances.GetSingleDataProcessServiceInstance(); bool exportResult = false; Exception exportExcepiton = null; Task task = Task.Factory.StartNew(() => { try { myDataProcessService.ExportNutritionalAnalysisReport2Print(record.Id); exportResult = true; } catch (Exception ex) { exportResult = false; exportExcepiton = ex; } }); WatingWindow waitwindow = new WatingWindow(task); waitwindow.ShowDialog(); if (!exportResult) { MessageBox.Show("报告导出失败:" + exportExcepiton.Message); } else { MessageBox.Show("请在Excel中打印报告。\r\n请关闭excel后,再打印下一份报告。"); } }
private void tb_ViewReport_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; if (record.State == InvestigationRecordStateType.NoFinish) { MessageBox.Show("该调查还未完成,没有任何报告"); return; } StatisticalReportWindow window = new StatisticalReportWindow(record.Id); window.Show(); }
private void tb_Audit_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; if (record.State != InvestigationRecordStateType.FinishedAndNoAudit) { MessageBox.Show("该调查已审核或还未完成"); return; } AuditRecordWindow auditWindow = new AuditRecordWindow(record.Id); auditWindow.Closed += AuditWindow_Closed; auditWindow.ShowDialog(); }
private void tb_ModifyAnswer_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; if (record.State != InvestigationRecordStateType.FinishedAndNoAudit) { MessageBox.Show("该调查已审核,不能修改"); return; } App.Current.Properties["CurrentRecordId"] = record.Id; Frame myframe = App.Current.Properties["MyFrame"] as Frame; myframe.Navigate(new Uri(@"Pages\QuestionPage.xaml", UriKind.Relative), 1); }
private void tb_ContinueAnswer_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; if (record.State != InvestigationRecordStateType.NoFinish) { MessageBox.Show("该调查已完成"); return; } App.Current.Properties["CurrentRecordId"] = record.Id; Frame myframe = App.Current.Properties["MyFrame"] as Frame; myframe.Navigate(new Uri(@"Pages\QuestionPage.xaml", UriKind.Relative), (record.LastFinishQuestionSN > 0) ? record.LastFinishQuestionSN : 1); }
private void tb_ExportReport_Click(object sender, RoutedEventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel文件|*.xlsx"; Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; if (sfd.ShowDialog() == true) { INRDataProcessService myDataProcessService = BusinessStaticInstances.GetSingleDataProcessServiceInstance(); bool exportResult = false; Exception exportExcepiton = null; Task task = Task.Factory.StartNew(() => { try { myDataProcessService.ExportNutritionalAnalysisReport2Excel(record.Id, sfd.FileName); exportResult = true; } catch (Exception ex) { exportResult = false; exportExcepiton = ex; } }); WatingWindow waitwindow = new WatingWindow(task); waitwindow.ShowDialog(); if (exportResult) { MessageBox.Show("已导出" + record.QueueId + "的营养分析报告"); } else { MessageBox.Show("导出失败:" + exportExcepiton.Message); } } }
private void tb_PrintReport_Loaded(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; InvestigationRecordViewDto record = btn.Tag as InvestigationRecordViewDto; switch (record.State) { case InvestigationRecordStateType.NoFinish: btn.Visibility = Visibility.Collapsed; break; case InvestigationRecordStateType.FinishedAndNoAudit: btn.Visibility = Visibility.Collapsed; break; case InvestigationRecordStateType.FinishedAndAudited: btn.Visibility = Visibility.Visible; break; default: return; } }