Esempio n. 1
0
        //---
        //+--
        public static DataTable PeriodicDailyDataHeatIndexesPresentation(AspDataReadHeatRecordType heat, AspDataReadHeatRecordType thom)
        {
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("Measure", typeof(string)));
            fdt.Columns.Add(new DataColumn("um", typeof(string)));
            fdt.Columns.Add(new DataColumn("Max", typeof(string)));
            fdt.Columns.Add(new DataColumn("HMax", typeof(string)));
            fdt.Columns.Add(new DataColumn("From", typeof(string)));
            fdt.Columns.Add(new DataColumn("To", typeof(string)));
            fdt.Columns.Add(new DataColumn("Mean", typeof(string)));
            fdt.Columns.Add(new DataColumn("Duration", typeof(string)));
            fdt.Columns.Add(new DataColumn("NMeasure", typeof(string)));

            AspMeasureDescriptioType dtype = AspUtility.LiteralDecodeMeteoParametersType(AspMeteoParametersType.HeathIndex);
            DataRow hr = fdt.NewRow();

            hr["Measure"]  = dtype.Description;
            hr["um"]       = dtype.MeasureUnit;
            hr["Max"]      = float.IsNaN(heat.Max) ? AspUtility.BadDataPresentation : heat.Max.ToString("#0.0");
            hr["HMax"]     = AspUtility.MorphHourToString(heat.HMax);
            hr["From"]     = AspUtility.MorphHourToString(heat.From);
            hr["To"]       = AspUtility.MorphHourToString(heat.To);
            hr["Mean"]     = float.IsNaN(heat.Mean) ? AspUtility.BadDataPresentation : heat.Mean.ToString("#0.0");
            hr["Duration"] = heat.Duration < 0 ? AspUtility.BadDataPresentation : heat.Duration.ToString();
            hr["NMeasure"] = heat.NMeasure < 0 ? AspUtility.BadDataPresentation : heat.NMeasure.ToString();
            fdt.Rows.Add(hr);

            AspMeasureDescriptioType dtype2 = AspUtility.LiteralDecodeMeteoParametersType(AspMeteoParametersType.Thom);
            DataRow tr = fdt.NewRow();

            tr["Measure"]  = dtype2.Description;
            tr["um"]       = string.Empty;
            tr["Max"]      = float.IsNaN(thom.Max) ? AspUtility.BadDataPresentation : thom.Max.ToString("#0.0");
            tr["HMax"]     = AspUtility.MorphHourToString(thom.HMax);
            tr["From"]     = AspUtility.MorphHourToString(thom.From);
            tr["To"]       = AspUtility.MorphHourToString(thom.To);
            tr["Mean"]     = float.IsNaN(thom.Mean) ? AspUtility.BadDataPresentation : thom.Mean.ToString("#0.0");
            tr["Duration"] = thom.Duration < 0 ? AspUtility.BadDataPresentation : thom.Duration.ToString();
            tr["NMeasure"] = thom.NMeasure < 0 ? AspUtility.BadDataPresentation : thom.NMeasure.ToString();
            fdt.Rows.Add(tr);

            fdt.Columns["Measure"].ColumnName  = "Misura";
            fdt.Columns["um"].ColumnName       = "Unità Misura";
            fdt.Columns["Max"].ColumnName      = "Massimo";
            fdt.Columns["HMax"].ColumnName     = "Ora Massimo";
            fdt.Columns["From"].ColumnName     = "Da";
            fdt.Columns["To"].ColumnName       = "A";
            fdt.Columns["Mean"].ColumnName     = "Media";
            fdt.Columns["Duration"].ColumnName = "Durata";
            fdt.Columns["NMeasure"].ColumnName = "# Misure";
            return(fdt);
        }
Esempio n. 2
0
        //---
        //+--
        public static DataTable PeriodicDailyDataSnapshotPresentation(AspDataReadRecordType[] records)
        {
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("measuretype", typeof(string)));
            fdt.Columns.Add(new DataColumn("um", typeof(string)));
            fdt.Columns.Add(new DataColumn("max", typeof(string)));
            fdt.Columns.Add(new DataColumn("hourmax", typeof(string)));
            fdt.Columns.Add(new DataColumn("min", typeof(string)));
            fdt.Columns.Add(new DataColumn("hourmin", typeof(string)));
            fdt.Columns.Add(new DataColumn("mean", typeof(string)));
            fdt.Columns.Add(new DataColumn("Escursion", typeof(string)));
            fdt.Columns.Add(new DataColumn("nmisure", typeof(string)));

            for (int i = 0; i < records.Length; i++)
            {
                DataRow nr = fdt.NewRow();
                AspMeteoParametersType   type  = AspUtility.ReverseDecodeMeteoParametersType(records[i].measuretype);
                AspMeasureDescriptioType dtype = AspUtility.LiteralDecodeMeteoParametersType(type);

                nr["measuretype"] = dtype.Description;
                nr["um"]          = dtype.MeasureUnit;
                nr["max"]         = float.IsNaN(records[i].max) ? AspUtility.BadDataPresentation : records[i].max.ToString("#0.0");
                nr["hourmax"]     = DateTime.MinValue.CompareTo(records[i].datemax) == 0 ? AspUtility.BadDataPresentation : records[i].datemax.ToString("HH:mm");
                nr["min"]         = float.IsNaN(records[i].min) ? AspUtility.BadDataPresentation : records[i].min.ToString("#0.0");
                nr["hourmin"]     = DateTime.MinValue.CompareTo(records[i].datemin) == 0 ? AspUtility.BadDataPresentation : records[i].datemin.ToString("HH:mm");
                nr["mean"]        = float.IsNaN(records[i].mean) ? AspUtility.BadDataPresentation : records[i].mean.ToString("#0.0");
                nr["Escursion"]   = float.IsNaN(records[i].excursion) ? AspUtility.BadDataPresentation : records[i].excursion.ToString("#0.0");
                nr["nmisure"]     = float.IsNaN(records[i].nmisure) ? AspUtility.BadDataPresentation : records[i].nmisure.ToString("#0");

                fdt.Rows.Add(nr);
            }

            fdt.Columns["measuretype"].ColumnName = "Misura";
            fdt.Columns["um"].ColumnName          = "Unità Misura";
            fdt.Columns["max"].ColumnName         = "Massimo";
            fdt.Columns["hourmax"].ColumnName     = "Massimo Ora";
            fdt.Columns["min"].ColumnName         = "Minimo";
            fdt.Columns["hourmin"].ColumnName     = "Minimo Ora";
            fdt.Columns["mean"].ColumnName        = "Media";
            fdt.Columns["Escursion"].ColumnName   = "Escursione";
            fdt.Columns["nmisure"].ColumnName     = "# Misure";

            return(fdt);
        }
Esempio n. 3
0
        //---
        //+--
        public static DataTable PeriodicDailyRainPresentation(AspDataReadRecordRainType record)
        {
            AspMeasureDescriptioType dtype = AspUtility.LiteralDecodeMeteoParametersType(AspMeteoParametersType.Rain);
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("Measure", typeof(string)));
            fdt.Columns.Add(new DataColumn("um", typeof(string)));
            fdt.Columns.Add(new DataColumn("Total", typeof(string)));
            fdt.Columns.Add(new DataColumn("Rate", typeof(string)));
            fdt.Columns.Add(new DataColumn("NMeasure", typeof(string)));

            DataRow row = fdt.NewRow();

            row["Measure"]  = dtype.Description;
            row["um"]       = dtype.MeasureUnit;
            row["Total"]    = float.IsNaN(record.Total) ? AspUtility.BadDataPresentation : record.Total.ToString("#0.0");
            row["Rate"]     = float.IsNaN(record.Rate) ? AspUtility.BadDataPresentation : record.Rate.ToString("#0.0");
            row["NMeasure"] = record.NMisure < 0 ? AspUtility.BadDataPresentation : record.NMisure.ToString();
            fdt.Rows.Add(row);

            return(fdt);
        }
Esempio n. 4
0
        //---
        //+--
        public static DataTable PeriodicMonthlyDataSnapshotPresentation(AspDataReadRecordType[] records)
        {
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("measuretype", typeof(string)));
            fdt.Columns.Add(new DataColumn("um", typeof(string)));
            fdt.Columns.Add(new DataColumn("max", typeof(string)));
            fdt.Columns.Add(new DataColumn("daymax", typeof(string)));
            fdt.Columns.Add(new DataColumn("hourmax", typeof(string)));
            fdt.Columns.Add(new DataColumn("min", typeof(string)));
            fdt.Columns.Add(new DataColumn("daymin", typeof(string)));
            fdt.Columns.Add(new DataColumn("hourmin", typeof(string)));
            fdt.Columns.Add(new DataColumn("mean", typeof(string)));
            fdt.Columns.Add(new DataColumn("Escursion", typeof(string)));
            fdt.Columns.Add(new DataColumn("nmisure", typeof(string)));

            for (int i = 0; i < records.Length; i++)
            {
                DataRow nr = fdt.NewRow();
                AspMeteoParametersType   type  = AspUtility.ReverseDecodeMeteoParametersType(records[i].measuretype);
                AspMeasureDescriptioType dtype = AspUtility.LiteralDecodeMeteoParametersType(type);

                nr["measuretype"] = dtype.Description;
                nr["um"]          = dtype.MeasureUnit;
                nr["max"]         = float.IsNaN(records[i].max) ? AspUtility.BadDataPresentation : records[i].max.ToString("#0.0");
                nr["daymax"]      = float.IsNaN(records[i].max) ? AspUtility.BadDataPresentation : records[i].datemax.Day.ToString();
                nr["hourmax"]     = float.IsNaN(records[i].max) ? AspUtility.BadDataPresentation : string.Format("{0:00}:{1:00}", records[i].datemax.Hour, records[i].datemax.Minute);
                nr["min"]         = float.IsNaN(records[i].min) ? AspUtility.BadDataPresentation : records[i].min.ToString("#0.0");
                nr["daymin"]      = float.IsNaN(records[i].min) ? AspUtility.BadDataPresentation : records[i].datemin.Day.ToString();
                nr["hourmin"]     = float.IsNaN(records[i].min) ? AspUtility.BadDataPresentation : string.Format("{0:00}:{1:00}", records[i].datemin.Hour, records[i].datemin.Minute);
                nr["mean"]        = float.IsNaN(records[i].mean) ? AspUtility.BadDataPresentation : records[i].mean.ToString("#0.0");
                nr["Escursion"]   = float.IsNaN(records[i].excursion) ? AspUtility.BadDataPresentation : records[i].excursion.ToString("#0.0");
                nr["nmisure"]     = float.IsNaN(records[i].nmisure) ? AspUtility.BadDataPresentation : records[i].nmisure.ToString("#0");
                fdt.Rows.Add(nr);
            }

            return(fdt);
        }