Exemplo n.º 1
0
    /// <summary>
    /// Save waste transfers data
    /// </summary>
    protected void doSave(object sender, EventArgs e)
    {
        try
        {
            CultureInfo  csvCulture = CultureResolver.ResolveCsvCulture(Request);
            CSVFormatter csvformat  = new CSVFormatter(csvCulture);

            // TODO: Consider moving this value to ViewState
            bool isCurrentWasteTypeAffectedByConfidentiality = WasteTransferTrend.IsAffectedByConfidentiality(SearchFilter, CurrentWasteType);

            // Create Header
            var header = CsvHeaderBuilder.GetTsWasteTransfersSearchHeader(
                SearchFilter,
                CurrentWasteType,
                isCurrentWasteTypeAffectedByConfidentiality);

            var data = WasteTransferTrend.GetTimeSeries(SearchFilter, CurrentWasteType);

            // dump to file
            string topheader  = csvformat.CreateHeader(header);
            string rowheaders = csvformat.GetWasteTransfersTimeSeriesHeader();

            Response.WriteUtf8FileHeader("EPRTR_Waste_Transfers_Time_Series");

            Response.Write(topheader + rowheaders);

            foreach (var v in data)
            {
                string row = csvformat.GetWasteTransfersTimeSeriesRow(v);
                Response.Write(row);
            }
            Response.End();
        }
        catch
        {
        }
    }