private void Window_Loaded(object sender, RoutedEventArgs e) { INRDataProcessService myDataProcessService = BusinessStaticInstances.GetSingleDataProcessServiceInstance(); Task task = Task.Factory.StartNew(() => { try { report = myDataProcessService.GetSomeoneRecordStatisticalReport(_recordId); } catch (Exception ex) { MessageBox.Show("查询报告出错:" + ex.Message); this.Close(); } }); WatingWindow waitwindow = new WatingWindow(task); waitwindow.ShowDialog(); textblock_Age.Text = report.Age.ToString(); textblock_BeforeBMI.Text = Math.Round(report.BeforeBMI, 1).ToString(); textblock_BeforeWeight.Text = Math.Round(report.BeforeWeight, 1).ToString(); textblock_BookId.Text = report.HealthBookId; textblock_CurrentWeight.Text = Math.Round(report.CurrentWeight, 1).ToString(); textblock_Height.Text = Math.Round(report.Height, 1).ToString(); textblock_InvestigationTime.Text = report.InvestigationTime.ToString("yyyy-MM-dd"); textblock_Name.Text = report.Name; textblock_Week.Text = report.Week.ToString(); StatisticalReportPage page = new StatisticalReportPage(); page.DataContext = report; frame_Report.Navigate(page); }
private void Page_Loaded(object sender, RoutedEventArgs e) { if (DataContext == null || DataContext as NutritionalResearchStatisticalReportViewDto == null) { throw new ArgumentNullException("报告数据为空"); } report = DataContext as NutritionalResearchStatisticalReportViewDto; dg_StructureOfMeals.ItemsSource = report.StructureOfMeals.OrderBy(nObj => nObj.StructureCode).ToList(); dg_NutrtiveElementIntakeStatistics.ItemsSource = report.NutrtiveElementIntakeStatistics.OrderBy(nObj => nObj.NutritiveName).ToList(); dg_FoodFirstCategory.ItemsSource = report.FillingRecords.GroupBy(nObj => nObj.FirstCategoryCode).OrderBy(nObj => nObj.Key).Select(nObj => new FoodFirstCategorySummary { Code = nObj.Key, Name = nObj.First().FirstCategoryName }).ToList(); dg_FoodFirstCategory.SelectedIndex = 0; }