protected void Page_Load(object sender, EventArgs e) { // VALIDATE THE SPECIFIED TAX NAME string taxName = Request.QueryString["T"]; string locCode = Request.QueryString["L"]; string country = Request.QueryString["C"]; string province = Request.QueryString["P"]; int zoneId = AlwaysConvert.ToInt(Request.QueryString["Z"]); if (!TaxReportDataSource.IsTaxNameValid(taxName)) { Response.Redirect("Taxes.aspx"); } HiddenTaxName.Value = taxName; HiddenLocCode.Value = locCode; if (!Page.IsPostBack) { // SET THE DEFAULT DATE FILTER DateTime localNow = LocaleHelper.LocalNow; StartDate.SelectedDate = AlwaysConvert.ToDateTime(Request.QueryString["StartDate"], new DateTime(localNow.Year, 1, 1)); EndDate.SelectedDate = AlwaysConvert.ToDateTime(Request.QueryString["EndDate"], localNow); BindReport(); } }
protected void ExportButton_Click(Object sender, EventArgs e) { GenericExportManager <TaxReportSummaryItem> exportManager = GenericExportManager <TaxReportSummaryItem> .Instance; GenericExportOptions <TaxReportSummaryItem> options = new GenericExportOptions <TaxReportSummaryItem>(); options.CsvFields = new string[] { "TaxName", "LocCode", "TaxAmount" }; DateTime fromDate = StartDate.SelectedStartDate; DateTime toDate = EndDate.SelectedEndDate; string provinceCode = Province2.Visible ? Province2.SelectedValue : Province.Text.Trim(); IList <TaxReportSummaryItem> taxes = TaxReportDataSource.LoadSummaries(CountryFilter.SelectedValue, provinceCode, AlwaysConvert.ToInt(ZoneFilter.SelectedValue), fromDate, toDate, "TaxName ASC"); options.ExportData = taxes; options.FileTag = string.Format("TAX_REPORT(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString()); exportManager.BeginExport(options); }