protected string GetAccidentalQuantity(object obj)
    {
        FACILITYDETAIL_POLLUTANTRELEASE row = (FACILITYDETAIL_POLLUTANTRELEASE)obj;

        return(QuantityFormat.Format(row.AccidentalQuantity, row.AccidentalQuantityUnitCode));
        //return QuantityFormat.Format(row.AccidentalQuantity, "TNE");
    }
    /// <summary>
    /// Label update
    /// </summary>
    private void updateTableLabels(TimeSeriesClasses.WasteTransfer data1, TimeSeriesClasses.WasteTransfer data2)
    {
        this.grdCompareDetails.Visible = true;

        List <CompareDetailElement> elements = new List <CompareDetailElement>();


        elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Total"),
                                              data1 != null ? QuantityFormat.Format(data1.QuantityTotal, data1.QuantityUnit) : String.Empty,
                                              data2 != null ? QuantityFormat.Format(data2.QuantityTotal, data2.QuantityUnit) : String.Empty));

        elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Recovery"),
                                              data1 != null ? QuantityFormat.Format(data1.QuantityRecovery, data1.QuantityUnit) : String.Empty,
                                              data2 != null ? QuantityFormat.Format(data2.QuantityRecovery, data2.QuantityUnit) : String.Empty));

        elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Disposal"),
                                              data1 != null ? QuantityFormat.Format(data1.QuantityDisposal, data1.QuantityUnit) : String.Empty,
                                              data2 != null ? QuantityFormat.Format(data2.QuantityDisposal, data2.QuantityUnit) : String.Empty));

        elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Unspecified"),
                                              data1 != null ? QuantityFormat.Format(data1.QuantityUnspec, data1.QuantityUnit) : String.Empty,
                                              data2 != null ? QuantityFormat.Format(data2.QuantityUnspec, data2.QuantityUnit) : String.Empty));

        // data binding
        this.grdCompareDetails.DataSource = elements;
        grdCompareDetails.DataBind();
    }
    /// <summary>
    /// updateTableReportFacilities
    /// </summary>
    private void updateTable(TimeSeriesClasses.ComparisonPollutant data)
    {
        this.grdCompareDetailsAll.Visible       = true;
        this.grdCompareDetailsBothYears.Visible = true;

        //all facilites
        List <CompareDetailElement> elementsAll = new List <CompareDetailElement>();

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Quantity"),
                                                 data != null ? QuantityFormat.Format(data.QuantityFrom, CODE_KG) : String.Empty,
                                                 data != null ? QuantityFormat.Format(data.QuantityTo, CODE_KG) : String.Empty));

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Facilities"),
                                                 data != null ? NumberFormat.Format(data.FacilitiesFrom) : String.Empty,
                                                 data != null ? NumberFormat.Format(data.FacilitiesTo) : String.Empty));

        //facilites in both years
        List <CompareDetailElement> elementsBothYears = new List <CompareDetailElement>();


        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Quantity"),
                                                       data != null ? QuantityFormat.Format(data.BothQuantityFrom, CODE_KG) : String.Empty,
                                                       data != null ? QuantityFormat.Format(data.BothQuantityTo, CODE_KG) : String.Empty));

        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Facilities"),
                                                       data != null ? NumberFormat.Format(data.BothFacilities) : String.Empty,
                                                       data != null ? NumberFormat.Format(data.BothFacilities) : String.Empty));

        // data binding
        this.grdCompareDetailsAll.DataSource = elementsAll;
        grdCompareDetailsAll.DataBind();

        this.grdCompareDetailsBothYears.DataSource = elementsBothYears;
        grdCompareDetailsBothYears.DataBind();
    }
Exemple #4
0
    /// <summary>
    /// Label update
    /// </summary>
    private void updateTableLabels(TimeSeriesClasses.PollutantTransfers data1, TimeSeriesClasses.PollutantTransfers data2)
    {
        this.grdCompareDetails.Visible = true;

        List <CompareDetailElement> elements = new List <CompareDetailElement>();

        elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Quantity"),
                                              data1 != null ? QuantityFormat.Format(data1.Quantity, data1.QuantityUnit) : String.Empty,
                                              data2 != null ? QuantityFormat.Format(data2.Quantity, data2.QuantityUnit) : String.Empty));


        // data binding
        this.grdCompareDetails.DataSource = elements;
        grdCompareDetails.DataBind();
    }
Exemple #5
0
    /// <summary>
    /// Create trend sheet
    /// </summary>
    private void createTrendSheet(TrendTransferContent type, int facilityid, string pollutantCode)
    {
        this.ucStackColumnTime.Visible    = false;
        this.ucStackColumnCompare.Visible = false;
        this.ucYearCompareSeries.Visible  = false;
        this.compareTable.Visible         = false;

        // Get time series data, used by all sub sheets
        List <TimeSeriesClasses.PollutantTransfers> data = getTimeSeriesData(facilityid, pollutantCode);

        // Time series sheet
        if (type == TrendTransferContent.TimeSeries)
        {
            ViewState[CONTENT_TYPE] = TrendTransferContent.TimeSeries;
            if (data != null && data.Count > 0)
            {
                this.ucStackColumnTime.Visible = true;

                Color[]           colors      = new Color[] { Global.ColorWasteWater };
                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None };

                this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantTransferTrend.CODE_KG, colors, hatchStyles, null);
                //this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantTransferTrend.CODE_TNE, colors, null);

                List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>();

                foreach (var v in data)
                {
                    string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Common", "Quantity"), QuantityFormat.Format(v.Quantity, v.QuantityUnit)) };

                    TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
                    {
                        Year    = v.Year,
                        Values  = new double?[] { v.Quantity },
                        ToolTip = ToolTipFormatter.FormatLines(tip)
                    };
                    bars.Add(cd);
                }
                this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYears(bars, showEPER));
            }
        }

        // comparison
        if (type == TrendTransferContent.Comparison)
        {
            ViewState[CONTENT_TYPE] = TrendTransferContent.Comparison;
            if (data != null && data.Count > 0)
            {
                this.compareTable.Visible = true;

                // Create chart
                this.ucStackColumnCompare.Visible = true;

                Color[]           colors      = new Color[] { Global.ColorWasteWater };
                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None };
                this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, PollutantTransferTrend.CODE_KG, colors, hatchStyles, null);
                //this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, PollutantTransferTrend.CODE_TNE, colors, null);

                // init year combo boxes
                this.ucYearCompareSeries.Visible = true;
                int year1 = this.ucYearCompareSeries.Year1;
                int year2 = this.ucYearCompareSeries.Year2;
                // reset
                resetLabels();

                TimeSeriesClasses.PollutantTransfers data1 = data.Where(d => d.Year == year1).DefaultIfEmpty(new TimeSeriesClasses.PollutantTransfers(year1)).Single();
                TimeSeriesClasses.PollutantTransfers data2 = data.Where(d => d.Year == year2).DefaultIfEmpty(new TimeSeriesClasses.PollutantTransfers(year2)).Single();

                bool dataFound = data1 != null || data2 != null;


                if (dataFound)
                {
                    TimeSeriesUtils.BarData dataFrom = new TimeSeriesUtils.BarData {
                        Year = year1
                    };
                    TimeSeriesUtils.BarData dataTo = new TimeSeriesUtils.BarData {
                        Year = year2
                    };

                    if (data1 != null)
                    {
                        dataFrom.Values = new double?[] { data1.Quantity };
                    }

                    if (data2 != null)
                    {
                        dataTo.Values = new double?[] { data2.Quantity };
                    }

                    // from and to bar
                    this.ucStackColumnCompare.Add(new List <TimeSeriesUtils.BarData>()
                    {
                        dataFrom, dataTo
                    });
                    updateTableLabels(data1, data2);
                }

                // display that no data found for the selected years
                this.lbNoDataForSelectedYears.Visible = !dataFound;
            }
        }
    }
    /// <summary>
    /// Create trend sheet
    /// </summary>
    private void createTrendSheet(TrendReleaseContent type, int facilityid, MediumFilter.Medium medium)
    {
        this.ucStackColumnTime.Visible    = false;
        this.ucStackColumnCompare.Visible = false;
        this.ucYearCompareSeries.Visible  = false;
        this.compareTable.Visible         = false;

        // Get time series data, used by all sub sheets
        List <TimeSeriesClasses.PollutantReleases> data = getTimeSeriesData(facilityid, medium);

        // Time series sheet
        if (type == TrendReleaseContent.TimeSeries)
        {
            ViewState[CONTENT_TYPE] = TrendReleaseContent.TimeSeries;
            if (data != null && data.Count > 0)
            {
                this.ucStackColumnTime.Visible = true;

                // initialize chart

                Color[]           colors      = getColors(medium);
                string[]          labelTexts  = new string[] { Resources.GetGlobal("Common", "Accidental"), Resources.GetGlobal("Common", "Controlled") };
                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None };
                this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantReleaseTrend.CODE_KG, colors, hatchStyles, labelTexts);

                List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>();

                foreach (var v in data)
                {
                    string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Pollutant", "ReleasesTotal"), QuantityFormat.Format(v.Quantity, v.QuantityUnit)),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Pollutant", "ReleasesAccidentalReleases"), QuantityFormat.Format(v.QuantityAccidental, v.QuantityAccidentalUnit)),
                                                  (v.AccidentalPercent > 0.0) ? String.Format("{0}: {1:F5}%", Resources.GetGlobal("Pollutant", "ReleasesAccidentalPercentValue"), v.AccidentalPercent) : String.Format("{0}: 0%", Resources.GetGlobal("Pollutant", "ReleasesAccidentalPercentValue")) };


                    TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
                    {
                        Year    = v.Year,
                        Values  = new double?[] { TimeSeriesUtils.RangeValue(v.QuantityAccidental), TimeSeriesUtils.RangeValue(v.Quantity) - TimeSeriesUtils.RangeValue(v.QuantityAccidental) },
                        ToolTip = ToolTipFormatter.FormatLines(tip)
                    };
                    bars.Add(cd);
                }

                if ((medium == MediumFilter.Medium.Air) || (medium == MediumFilter.Medium.Water))
                {
                    this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYears(bars, showEPER));
                }
                if (medium == MediumFilter.Medium.Soil)
                {
                    this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bars, showEPER));
                }
            }
        }

        // comparison
        if (type == TrendReleaseContent.Comparison)
        {
            ViewState[CONTENT_TYPE] = TrendReleaseContent.Comparison;

            if (data != null && data.Count > 0)
            {
                this.compareTable.Visible = true;

                // Create chart
                this.ucStackColumnCompare.Visible = true;

                Color[]           colors      = getColors(medium);
                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None };
                string[]          labelTexts  = new string[] { Resources.GetGlobal("Common", "Accidental"), Resources.GetGlobal("Common", "Controlled") };

                this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, PollutantReleaseTrend.CODE_KG, colors, hatchStyles, labelTexts);
                //this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, PollutantReleaseTrend.CODE_TNE, colors, labelTexts);

                // init year combo boxes
                this.ucYearCompareSeries.Visible = true;
                int year1 = this.ucYearCompareSeries.Year1;
                int year2 = this.ucYearCompareSeries.Year2;
                // reset
                resetLabels();

                TimeSeriesClasses.PollutantReleases data1 = data.Where(d => d.Year == year1).DefaultIfEmpty(new TimeSeriesClasses.PollutantReleases(year1)).Single();
                TimeSeriesClasses.PollutantReleases data2 = data.Where(d => d.Year == year2).DefaultIfEmpty(new TimeSeriesClasses.PollutantReleases(year2)).Single();

                bool dataFound = data1 != null || data2 != null;


                if (dataFound)
                {
                    TimeSeriesUtils.BarData dataFrom = new TimeSeriesUtils.BarData {
                        Year = year1
                    };
                    TimeSeriesUtils.BarData dataTo = new TimeSeriesUtils.BarData {
                        Year = year2
                    };

                    if (data1 != null)
                    {
                        dataFrom.Values = new double?[] { data1.QuantityAccidental, data1.Quantity - data1.QuantityAccidental };
                    }

                    if (data2 != null)
                    {
                        dataTo.Values = new double?[] { data2.QuantityAccidental, data2.Quantity - data2.QuantityAccidental };
                    }

                    // from and to bar
                    this.ucStackColumnCompare.Add(new List <TimeSeriesUtils.BarData>()
                    {
                        dataFrom, dataTo
                    });
                    updateTableLabels(data1, data2);
                }

                // display that no data found for the selected years
                this.lbNoDataForSelectedYears.Visible = !dataFound;
            }
        }
    }
    protected string GetTotalQuantity(object obj)
    {
        FACILITYDETAIL_POLLUTANTRELEASE row = (FACILITYDETAIL_POLLUTANTRELEASE)obj;

        return(QuantityFormat.Format(row.TotalQuantity, row.TotalQuantityUnitCode));
    }
 protected string GetQuantityGroup(object obj)
 {
     TimeSeriesClasses.ConfidentialityPollutant row = (TimeSeriesClasses.ConfidentialityPollutant)obj;
     return(QuantityFormat.Format(row.QuantityConfidential, row.UnitConfidential));
 }
Exemple #9
0
 protected string GetQuantityUnspecified(object obj)
 {
     WasteTransfers.ResultHazardousWasteRecievingCountry row = (WasteTransfers.ResultHazardousWasteRecievingCountry)obj;
     return(QuantityFormat.Format(row.QuantityUnspecified, row.QuantityCommonUnit));
 }
    protected string GetQuantity(object obj)
    {
        FACILITYDETAIL_POLLUTANTTRANSFER row = (FACILITYDETAIL_POLLUTANTTRANSFER)obj;

        return(QuantityFormat.Format(row.Quantity, row.UnitCode));
    }
 //protected string GetTreaterSiteCountryCode(object obj)
 //{
 //    return ((QueryLayer.WasteTransfers.ResultHazardousWasteTreater)obj).TreaterSiteCountryCode;
 //}
 protected string GetQuantity(object obj)
 {
     WasteTransfers.ResultHazardousWasteTreater row = (WasteTransfers.ResultHazardousWasteTreater)obj;
     return(QuantityFormat.Format(row.Quantity, row.Unit, row.ConfidentialIndicator));
 }
 protected string GetNONHWQuantity(object obj)
 {
     AreaOverview.AOWasteTreeListRow row = (AreaOverview.AOWasteTreeListRow)obj;
     return(QuantityFormat.Format(row.GetQuantity(AreaOverview.CODE_NONHW), row.GetUnit(AreaOverview.CODE_NONHW)));
 }
Exemple #13
0
    /// <summary>
    /// updateTimeSeries
    /// </summary>
    private void updateTimeSeries(WasteTransferTimeSeriesFilter filter, WasteTypeFilter.Type wastetype)
    {
        CurrentWasteType = wastetype;

        // assume data is found
        dataFound(true);

        // result from qyerylayer
        List <TimeSeriesClasses.WasteTransfer> data = WasteTransferTrend.GetTimeSeries(filter, wastetype);

        // no data found, hide controls and leave
        if (data == null || data.Count == 0)
        {
            dataFound(false); return;
        }



        // set report data to table
        this.lvTimeSeriesTable.DataSource = data;
        this.lvTimeSeriesTable.DataBind();

        // init stack column, 3 ranges
        var _colors      = new List <Color>();
        var _legendTexts = new List <string>();
        var _hatchStyles = new List <ChartHatchStyle>();
        var _tips        = new List <string>();
        var _values      = new List <double?>();

        _tips.Add(Resources.GetGlobal("Common", "Year") + ": {0}");
        _tips.Add(Resources.GetGlobal("Common", "Facilities") + ": {0}");


        // When called from the Time Series menu, the treatment filter will be null
        // Then all treatments are displayed
        bool showAll = (filter.WasteTreatmentFilter == null);

        if (showAll || filter.WasteTreatmentFilter.Recovery)
        {
            _colors.Add(Global.ColorWasteRecovery);
            _legendTexts.Add(Resources.GetGlobal("Common", "TreatmentRecovery"));
            _hatchStyles.Add(ChartHatchStyle.None);
        }

        if (showAll || filter.WasteTreatmentFilter.Disposal)
        {
            _colors.Add(Global.ColorWasteDisposal);
            _legendTexts.Add(Resources.GetGlobal("Common", "TreatmentDisposal"));
            _hatchStyles.Add(ChartHatchStyle.None);
        }

        if (showAll || filter.WasteTreatmentFilter.Unspecified)
        {
            _colors.Add(Global.ColorWasteUnspec);
            _legendTexts.Add(Resources.GetGlobal("Common", "TreatmentUnspecified"));
            _hatchStyles.Add(ChartHatchStyle.None);
        }

        Color[]           colors      = _colors.ToArray();
        string[]          legendTexts = _legendTexts.ToArray();
        ChartHatchStyle[] hatchStyles = _hatchStyles.ToArray();

        this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, WasteTransferTrend.CODE_TNE, colors, hatchStyles, legendTexts);

        List <TimeSeriesUtils.BarData> bardata = new List <TimeSeriesUtils.BarData>();


        // loop through data and create tooltip
        foreach (var v in data)
        {
            _values.Clear();
            _tips.Clear();
            _tips.Add(String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year));
            _tips.Add(String.Format("{0}: {1}", Resources.GetGlobal("Common", "Facilities"), v.Facilities));

            if (showAll || filter.WasteTreatmentFilter.Recovery)
            {
                _values.Add(TimeSeriesUtils.RangeValue(v.QuantityRecovery));
                _tips.Add(String.Format("{0}: {1}", Resources.GetGlobal("Common", "Recovery"), QuantityFormat.Format(v.QuantityRecovery, v.QuantityUnit)));
            }
            if (showAll || filter.WasteTreatmentFilter.Disposal)
            {
                _values.Add(TimeSeriesUtils.RangeValue(v.QuantityDisposal));
                _tips.Add(String.Format("{0}: {1}", Resources.GetGlobal("Common", "Disposal"), QuantityFormat.Format(v.QuantityDisposal, v.QuantityUnit)));
            }
            if (showAll || filter.WasteTreatmentFilter.Unspecified)
            {
                _values.Add(TimeSeriesUtils.RangeValue(v.QuantityUnspec));
                _tips.Add(String.Format("{0}: {1}", Resources.GetGlobal("Common", "Unspecified"), QuantityFormat.Format(v.QuantityUnspec, v.QuantityUnit)));
            }

            TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
            {
                Year    = v.Year,
                Values  = _values.ToArray(),
                ToolTip = ToolTipFormatter.FormatLines(_tips.ToArray())
            };
            bardata.Add(cd);
        }

        this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bardata, false));
    }
Exemple #14
0
 public string GetQuantityAccidental(object obj)
 {
     PollutantReleases.ResultFacility row = (PollutantReleases.ResultFacility)obj;
     return(QuantityFormat.Format(row.QuantityAccidental, row.Unit, row.ConfidentialIndicator));
 }
Exemple #15
0
 protected string GetTotal(object obj)
 {
     AreaOverview.PollutantData row = (AreaOverview.PollutantData)obj;
     return(QuantityFormat.Format(row.Quantity, row.Unit));
 }
 protected string GetRecovery(object obj)
 {
     WasteTransfers.ResultFacility row = (WasteTransfers.ResultFacility)obj;
     return(QuantityFormat.Format(row.QuantityRecovery, row.QuantityCommonUnit, row.ConfidentialIndicatorRecovery));
 }
Exemple #17
0
    /// <summary>
    /// updateTimeSeries
    /// </summary>
    private void updateTimeSeries(PollutantReleasesTimeSeriesFilter filter, MediumFilter.Medium medium)
    {
        CurrentMedium = medium;

        // assume data is found
        dataFound(true);

        // result from qyerylayer
        List <TimeSeriesClasses.PollutantReleases> data = PollutantReleaseTrend.GetTimeSeries(filter, medium);;

        if (data == null || data.Count == 0)
        {
            dataFound(false); return;
        }

        // set report data to table
        this.lvTimeSeriesTable.DataSource = data;
        this.lvTimeSeriesTable.DataBind();


        Color[]  colors      = new Color[] {};
        string[] legendTexts = new string[] { Resources.GetGlobal("Common", "Accidental"), Resources.GetGlobal("Common", "Controlled") };

        // init chart. Must be done after table databinding, because missing years are added.
        if (medium.Equals(MediumFilter.Medium.Air))
        {
            colors = new Color[] { Global.ColorAirAccidental, Global.ColorAirTotal };
        }
        else if (medium.Equals(MediumFilter.Medium.Water))
        {
            colors = new Color[] { Global.ColorWaterAccidental, Global.ColorWaterTotal };
        }
        else if (medium.Equals(MediumFilter.Medium.Soil))
        {
            colors = new Color[] { Global.ColorSoilAccidental, Global.ColorSoilTotal };
        }

        ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None };

        this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantReleaseTrend.CODE_KG, colors, hatchStyles, legendTexts);
        //this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantReleaseTrend.CODE_TNE, colors, legendTexts);

        List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>();

        foreach (var v in data)
        {
            string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year),
                                          String.Format("{0}: {1}", Resources.GetGlobal("Common", "Facilities"), v.Facilities),
                                          String.Format("{0}: {1}", Resources.GetGlobal("Pollutant", "ReleasesTotal"), QuantityFormat.Format(v.Quantity, v.QuantityUnit)),
                                          String.Format("{0}: {1}", Resources.GetGlobal("Pollutant", "ReleasesAccidentalReleases"), QuantityFormat.Format(v.QuantityAccidental, v.QuantityAccidentalUnit)),
                                          (v.AccidentalPercent > 0.0) ? String.Format("{0}: {1:F5}%", Resources.GetGlobal("Pollutant", "ReleasesAccidentalPercentValue"), v.AccidentalPercent) : String.Format("{0}: 0%", Resources.GetGlobal("Pollutant", "ReleasesAccidentalPercentValue")) };

            TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
            {
                Year    = v.Year,
                Values  = new double?[] { TimeSeriesUtils.RangeValue(v.QuantityAccidental), TimeSeriesUtils.RangeValue(v.Quantity) - TimeSeriesUtils.RangeValue(v.QuantityAccidental) },
                ToolTip = ToolTipFormatter.FormatLines(tip)
            };
            bars.Add(cd);
        }

        this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bars, false));
    }
 protected string GetDisposal(object obj)
 {
     WasteTransfers.ResultFacility row = (WasteTransfers.ResultFacility)obj;
     return(QuantityFormat.Format(row.QuantityDisposal, row.QuantityCommonUnit, row.ConfidentialIndicatorDisposal));
 }
    /// <summary>
    /// updateTableReportFacilities
    /// </summary>
    private void updateTable(TimeSeriesClasses.ComparisonWasteTransfer data)
    {
        this.grdCompareDetailsAll.Visible       = true;
        this.grdCompareDetailsBothYears.Visible = true;


        //all facilities
        List <CompareDetailElement> elementsAll = new List <CompareDetailElement>();


        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Total"),
                                                 data != null ? QuantityFormat.Format(data.TotalFrom, CODE_TNE) : String.Empty,
                                                 data != null ? QuantityFormat.Format(data.TotalTo, CODE_TNE) : String.Empty));

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Recovery"),
                                                 data != null ? QuantityFormat.Format(data.RecoveryFrom, CODE_TNE) : String.Empty,
                                                 data != null ? QuantityFormat.Format(data.RecoveryTo, CODE_TNE) : String.Empty));

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Disposal"),
                                                 data != null ? QuantityFormat.Format(data.DisposalFrom, CODE_TNE) : String.Empty,
                                                 data != null ? QuantityFormat.Format(data.DisposalTo, CODE_TNE) : String.Empty));

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Unspecified"),
                                                 data != null ? QuantityFormat.Format(data.UnspecFrom, CODE_TNE) : String.Empty,
                                                 data != null ? QuantityFormat.Format(data.UnspecTo, CODE_TNE) : String.Empty));

        elementsAll.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Facilities"),
                                                 data != null ? NumberFormat.Format(data.FacilitiesFrom) : String.Empty,
                                                 data != null ? NumberFormat.Format(data.FacilitiesTo) : String.Empty));


        //facilites in both years
        List <CompareDetailElement> elementsBothYears = new List <CompareDetailElement>();


        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Total"),
                                                       data != null ? QuantityFormat.Format(data.BothTotalFrom, CODE_TNE) : String.Empty,
                                                       data != null ? QuantityFormat.Format(data.BothTotalTo, CODE_TNE) : String.Empty));

        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Recovery"),
                                                       data != null ? QuantityFormat.Format(data.BothRecoveryFrom, CODE_TNE) : String.Empty,
                                                       data != null ? QuantityFormat.Format(data.BothRecoveryTo, CODE_TNE) : String.Empty));

        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Disposal"),
                                                       data != null ? QuantityFormat.Format(data.BothDisposalFrom, CODE_TNE) : String.Empty,
                                                       data != null ? QuantityFormat.Format(data.BothDisposalTo, CODE_TNE) : String.Empty));

        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Unspecified"),
                                                       data != null ? QuantityFormat.Format(data.BothUnspecFrom, CODE_TNE) : String.Empty,
                                                       data != null ? QuantityFormat.Format(data.BothUnspecTo, CODE_TNE) : String.Empty));


        elementsBothYears.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Facilities"),
                                                       data != null ? NumberFormat.Format(data.BothFacilities) : String.Empty,
                                                       data != null ? NumberFormat.Format(data.BothFacilities) : String.Empty));


        // data binding
        this.grdCompareDetailsAll.DataSource = elementsAll;
        grdCompareDetailsAll.DataBind();

        this.grdCompareDetailsBothYears.DataSource = elementsBothYears;
        grdCompareDetailsBothYears.DataBind();
    }
 protected string GetUnspec(object obj)
 {
     WasteTransfers.ResultFacility row = (WasteTransfers.ResultFacility)obj;
     return(QuantityFormat.Format(row.QuantityUnspecified, row.QuantityCommonUnit, row.ConfidentialIndicatorUnspecified));
 }
Exemple #21
0
 /// <summary>
 /// binding
 /// </summary>
 protected string GetQuantity(object obj)
 {
     PollutantTransfers.ResultFacility row = (PollutantTransfers.ResultFacility)obj;
     return(QuantityFormat.Format(row.Quantity, row.QuantityUnit));
 }
    protected string GetQuantity(object obj)
    {
        FACILITYDETAIL_WASTETRANSFER row = (FACILITYDETAIL_WASTETRANSFER)obj;

        return(QuantityFormat.Format(row.Quantity, row.UnitCode, row.ConfidentialIndicator));
    }
Exemple #23
0
    /// <summary>
    /// populate
    /// </summary>
    public void Populate(PollutantTransferTimeSeriesFilter filter)
    {
        // result from qyerylayer
        List <TimeSeriesClasses.PollutantTransfers> data = PollutantTransferTrend.GetTimeSeries(filter);

        // set data to table.
        this.lvTimeSeriesTable.DataSource = data;
        this.lvTimeSeriesTable.DataBind();

        // init time series. Must be done after table databinding, because missing years are added.
        this.ucStackColumnTime.Visible = (data != null && data.Count > 0);
        if (this.ucStackColumnTime.Visible)
        {
            Color[]           colors      = new Color[] { Global.ColorWasteWater };
            ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None };
            // init time series
            this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantTransferTrend.CODE_KG, colors, hatchStyles, null);
            //this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, PollutantTransferTrend.CODE_TNE, colors, null);
            this.ucStackColumnTime.Width = 700;

            List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>();

            // loop through data and create tooltip
            foreach (var v in data)
            {
                string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year),
                                              String.Format("{0}: {1}", Resources.GetGlobal("Common", "Quantity"), QuantityFormat.Format(v.Quantity, v.QuantityUnit)),
                                              String.Format("{0}: {1}", Resources.GetGlobal("Common", "Facilities"), v.Facilities) };

                TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
                {
                    Year    = v.Year,
                    Values  = new double?[] { TimeSeriesUtils.RangeValue(v.Quantity) },
                    ToolTip = ToolTipFormatter.FormatLines(tip)
                };
                bars.Add(cd);
            }
            this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bars, false));
        }
    }
    /// <summary>
    /// Create trend sheet
    /// </summary>
    private void createTrendSheet(TrendWasteContent type, int facilityid, WasteTypeFilter.Type waste)
    {
        this.ucStackColumnTime.Visible    = false;
        this.ucStackColumnCompare.Visible = false;
        this.ucYearCompareSeries.Visible  = false;
        this.compareTable.Visible         = false;

        // Get time series data, used by all sub sheets
        List <TimeSeriesClasses.WasteTransfer> data = getTimeSeriesData(facilityid, waste);

        // Time series sheet
        if (type == TrendWasteContent.TimeSeries)
        {
            ViewState[CONTENT_TYPE] = TrendWasteContent.TimeSeries;
            if (data != null && data.Count > 0)
            {
                this.ucStackColumnTime.Visible = true;

                Color[]           colors      = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec };
                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None, ChartHatchStyle.None };
                string[]          legendTexts = new string[] { Resources.GetGlobal("Common", "TreatmentRecovery"),
                                                               Resources.GetGlobal("Common", "TreatmentDisposal"),
                                                               Resources.GetGlobal("Common", "TreatmentUnspecified") };


                // initialize chart
                this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, WasteTransferTrend.CODE_TNE, colors, hatchStyles, legendTexts);

                List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>();

                // add data to chart
                foreach (var v in data)
                {
                    string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Common", "Total"), QuantityFormat.Format(v.QuantityTotal, v.QuantityUnit)),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Common", "Recovery"), QuantityFormat.Format(v.QuantityRecovery, v.QuantityUnit)),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Common", "Disposal"), QuantityFormat.Format(v.QuantityDisposal, v.QuantityUnit)),
                                                  String.Format("{0}: {1}", Resources.GetGlobal("Common", "Unspec"), QuantityFormat.Format(v.QuantityUnspec, v.QuantityUnit)) };

                    TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData
                    {
                        Year    = v.Year,
                        Values  = new double?[] { TimeSeriesUtils.RangeValue(v.QuantityRecovery), TimeSeriesUtils.RangeValue(v.QuantityDisposal), TimeSeriesUtils.RangeValue(v.QuantityUnspec) },
                        ToolTip = ToolTipFormatter.FormatLines(tip)
                    };
                    bars.Add(cd);
                }

                //waste was not reported in EPER - hence do not include EPER years.
                this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bars, false));
            }
        }

        // comparison
        if (type == TrendWasteContent.Comparison)
        {
            ViewState[CONTENT_TYPE] = TrendWasteContent.Comparison;

            if (data != null && data.Count > 0)
            {
                this.compareTable.Visible = true;

                // Create chart
                this.ucStackColumnCompare.Visible = true;

                ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None, ChartHatchStyle.None };

                //Color[] colors = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec };
                //string[] legendTexts = new string[]{Resources.GetGlobal("Common", "TreatmentDisposal"),
                //                                    Resources.GetGlobal("Common", "TreatmentRecovery"),
                //                                    Resources.GetGlobal("Common", "TreatmentUnspecified")};
                Color[]  colors      = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec };
                string[] legendTexts = new string[] { Resources.GetGlobal("Common", "TreatmentRecovery"),
                                                      Resources.GetGlobal("Common", "TreatmentDisposal"),
                                                      Resources.GetGlobal("Common", "TreatmentUnspecified") };

                this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, WasteTransferTrend.CODE_TNE, colors, hatchStyles, legendTexts);

                // init year combo boxes
                this.ucYearCompareSeries.Visible = true;
                int year1 = this.ucYearCompareSeries.Year1;
                int year2 = this.ucYearCompareSeries.Year2;
                // reset
                resetLabels();

                TimeSeriesClasses.WasteTransfer data1 = data.Where(d => d.Year == year1).DefaultIfEmpty(new TimeSeriesClasses.WasteTransfer(year1, waste)).Single();
                TimeSeriesClasses.WasteTransfer data2 = data.Where(d => d.Year == year2).DefaultIfEmpty(new TimeSeriesClasses.WasteTransfer(year2, waste)).Single();

                bool dataFound = data1 != null || data2 != null;


                if (dataFound)
                {
                    TimeSeriesUtils.BarData dataFrom = new TimeSeriesUtils.BarData {
                        Year = year1
                    };
                    TimeSeriesUtils.BarData dataTo = new TimeSeriesUtils.BarData {
                        Year = year2
                    };


                    if (data1 != null)
                    {
                        dataFrom.Values = new double?[] { data1.QuantityRecovery, data1.QuantityDisposal, data1.QuantityUnspec };
                    }

                    if (data2 != null)
                    {
                        dataTo.Values = new double?[] { data2.QuantityRecovery, data2.QuantityDisposal, data2.QuantityUnspec };
                    }

                    // from and to bar
                    this.ucStackColumnCompare.Add(new List <TimeSeriesUtils.BarData>()
                    {
                        dataFrom, dataTo
                    });
                    updateTableLabels(data1, data2);
                }

                // display that no data found for the selected years
                this.lbNoDataForSelectedYears.Visible = !dataFound;
            }
        }
    }