Beispiel #1
0
 /// <summary>
 /// Creates a copy of the original series. If copyDataValues is set to true,
 /// then the data values are also copied.
 /// The new series shares the same site, variable, source, method and quality
 /// control level. The new series does not belong to any data theme.
 /// </summary>
 /// <param name="original">The original series</param>
 public SeriesMetadata(SeriesMetadata original)
 {
     BeginDateTime       = original.BeginDateTime;
     EndDateTime         = original.EndDateTime;
     CreationDateTime    = DateTime.Now;
     EndDateTime         = original.EndDateTime;
     EndDateTimeUTC      = original.EndDateTimeUTC;
     IsCategorical       = original.IsCategorical;
     Method              = original.Method;
     QualityControlLevel = original.QualityControlLevel;
     Source              = original.Source;
     UpdateDateTime      = DateTime.Now;
     ValueCount          = original.ValueCount;
     Variable            = original.Variable;
 }
 /// <summary>
 /// Creates a copy of the original series. If copyDataValues is set to true,
 /// then the data values are also copied. 
 /// The new series shares the same site, variable, source, method and quality
 /// control level. The new series does not belong to any data theme.
 /// </summary>
 /// <param name="original">The original series</param>
 public SeriesMetadata(SeriesMetadata original)
 {
     BeginDateTime = original.BeginDateTime;
     EndDateTime = original.EndDateTime;
     CreationDateTime = DateTime.Now;
     EndDateTime = original.EndDateTime;
     EndDateTimeUTC = original.EndDateTimeUTC;
     IsCategorical = original.IsCategorical;
     Method = original.Method;
     QualityControlLevel = original.QualityControlLevel;
     Source = original.Source;
     UpdateDateTime = DateTime.Now;
     ValueCount = original.ValueCount;
     Variable = original.Variable;
 }
        protected virtual SeriesMetadata ReadSeriesFromSiteInfo(XmlReader r, Site site)
        {
            var series = new SeriesMetadata {Site = site};

            while (r.Read())
            {
                if (r.NodeType == XmlNodeType.Element)
                {
                    string nodeName = r.Name.ToLower();
                    if (nodeName == "variable")
                    {
                        series.Variable = ReadVariable(r);
                    }
                    else if (nodeName == "valuecount")
                    {
                        r.Read();
                        series.ValueCount = Convert.ToInt32(r.Value);
                    }
                    else if (nodeName == "begindatetime")
                    {
                        r.Read();
                        series.BeginDateTime = Convert.ToDateTime(r.Value, CultureInfo.InvariantCulture);
                        series.BeginDateTimeUTC = series.BeginDateTime;
                    }
                    else if (nodeName == "enddatetime")
                    {
                        r.Read();
                        series.EndDateTime = Convert.ToDateTime(r.Value, CultureInfo.InvariantCulture);
                        series.EndDateTimeUTC = series.EndDateTime;
                    }
                    else if (nodeName == "begindatetimeutc")
                    {
                        r.Read();
                        series.BeginDateTimeUTC = Convert.ToDateTime(r.Value, CultureInfo.InvariantCulture);
                    }
                    else if (nodeName == "enddatetimeutc")
                    {
                        r.Read();
                        series.EndDateTimeUTC = Convert.ToDateTime(r.Value, CultureInfo.InvariantCulture);
                    }
                    else if (nodeName == "method")
                    {
                        series.Method = ReadMethod(r);
                    }
                    else if (nodeName == "source")
                    {
                        series.Source = ReadSource(r);
                    }
                    else if (nodeName == "qualitycontrollevel")
                    {
                        series.QualityControlLevel = ReadQualityControlLevel(r);
                    }
                }
                else
                {
                    if (r.NodeType == XmlNodeType.EndElement && r.Name == "series")
                    {
                        return series;
                    }
                }
            }
            return series;
        }