/// <summary> /// Save /// </summary> protected void doSave(object sender, EventArgs e) { try { CultureInfo csvCulture = CultureResolver.ResolveCsvCulture(Request); CSVFormatter csvformat = new CSVFormatter(csvCulture); // Create Header int facilityReportId = (int)ViewState[FACILITY_REPORTID]; string pollutantCode = PollutantCode; bool confidentialityAffected = PollutantReleaseTrend.IsAffectedByConfidentiality(FacilityBasic.FacilityID, PollutantCode, CurrentMedium); Dictionary <string, string> header = CsvHeaderBuilder.GetFacilityTrendHeader(facilityReportId, confidentialityAffected); // Create Body string mediumName = LOVResources.MediumName(EnumUtil.GetStringValue(CurrentMedium)); string codeEPER = pollutantCode + "EPER"; string pollutantName = LOVResources.PollutantNameEPER(pollutantCode, codeEPER); List <TimeSeriesClasses.PollutantReleases> data = getTimeSeriesData(FacilityBasic.FacilityID, CurrentMedium); // dump to file string topheader = csvformat.CreateHeader(header); string pollutantHeader = csvformat.GetPollutantReleaseTrendHeader(); Response.WriteUtf8FileHeader("EPRTR_Pollutant_Releases_Time_Series"); Response.Write(topheader + pollutantHeader); foreach (var v in data) { string row = csvformat.GetPollutantReleaseTrendRow(v, pollutantName, mediumName); Response.Write(row); } Response.End(); } catch { } }