private void Button_查询_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_一级科目.Text)) { MessageBoxCommon.Show("请选择一级科目"); TextBox_一级科目.Focus(); return; } else if (string.IsNullOrEmpty(TextBox_二级科目.Text)) { MessageBoxCommon.Show("请选择二级科目"); TextBox_二级科目.Focus(); return; } else { string a = TextBox_一级科目.Text.ToString(); string b = TextBox_二级科目.Text.ToString(); List <Model_科目明细账> lm = vmk.GetSubjectDetail(a, b); if (lm.Count > 0) { this.Label_年.Content = lm[0].年 + "年"; } else { Model_科目明细账 m = new Model_科目明细账(); m.摘要 = "查询不到数据!"; lm.Add(m); } this.DataGrid_科目明细.ItemsSource = lm; } }
private void Button_科目明细Print_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_一级科目.Text)) { MessageBoxCommon.Show("请选择一级科目"); TextBox_一级科目.Focus(); return; } else if (string.IsNullOrEmpty(TextBox_二级科目.Text)) { MessageBoxCommon.Show("请选择二级科目"); TextBox_二级科目.Focus(); return; } if (new PA.Helper.ExcelHelper.ExcelWriter().ExportSubjectDetails(TextBox_一级科目.Text, TextBox_二级科目.Text) != "") { MessageBoxCommon.Show("打印失败,请检查数据。"); } }