private void QuickReportShow_Load(object sender, EventArgs e) { if (DesignMode) { return; } try { LoadReports(ReportIDs.Split(',')); } catch (Exception excp) { MessageBox.Show("报表加载失败。\n原因:" + excp.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//Generate the preport requested and return a string taht is the report. private string CreateReport(ReportIDs reportid) { switch (reportid) { case ReportIDs.SalesByWeek: return(SalesByWeek()); case ReportIDs.SalesByMonth: return(SalesByMonth()); case ReportIDs.SalesByDay: return(SalesByDay()); default: return("Report requested is undefined."); } }
//Public method to access the creation of the requested report public string GenerateReport(ReportIDs reportidrequested) { return(CreateReport(reportidrequested)); }
//return the name of the report at the given ID public string ReportName(ReportIDs idrequested) { return(ReportNames[(int)idrequested]); }