Ejemplo n.º 1
0
 private void WriteArchiveTemplate(ArchiveTemplateDto dto)
 {
     this.writer.WriteStartElement("ArchiveTemplate");
     // Name
     this.writer.WriteStartElement("Name");
     this.writer.WriteString(dto.Name);
     this.writer.WriteEndElement();
     // Type
     this.writer.WriteStartElement("Type");
     this.writer.WriteValue(ConvertConsolidationFunctionToString(dto.ConsolidationFunction));
     this.writer.WriteEndElement();
     // X factor
     this.writer.WriteStartElement("XFactor");
     this.writer.WriteValue(dto.XFactor);
     this.writer.WriteEndElement();
     // Readings per data point
     this.writer.WriteStartElement("ReadingsPerDataPoint");
     this.writer.WriteValue(dto.ReadingsPerDataPoint);
     this.writer.WriteEndElement();
     // Max data points
     this.writer.WriteStartElement("MaxDataPoints");
     this.writer.WriteValue(dto.MaxDataPoints);
     this.writer.WriteEndElement();
     this.writer.WriteEndElement();
 }
Ejemplo n.º 2
0
 private void FixupFromDto(ArchiveTemplateDto dto)
 {
     this.dao                     = dto.Dao;
     this.name                    = dto.Name;
     this.maxDataPoints           = dto.MaxDataPoints;
     this.numReadingsPerDataPoint = dto.ReadingsPerDataPoint;
     this.consolidationFunction   = (ConsolidationFunctionType)dto.ConsolidationFunction;
     this.xFactor                 = dto.XFactor;
 }
Ejemplo n.º 3
0
        internal ArchiveTemplateDto CreateDto()
        {
            ArchiveTemplateDto dto = new ArchiveTemplateDto();

            dto.Dao  = this.dao;
            dto.Name = this.Name;
            dto.ConsolidationFunction = (int)this.ConsolidationFunction;
            dto.XFactor = this.XFactor;
            dto.ReadingsPerDataPoint = this.ReadingsPerDataPoint;
            dto.MaxDataPoints        = this.MaxDataPoints;
            return(dto);
        }
Ejemplo n.º 4
0
        private ArchiveTemplateDto[] ReadArchiveTemplates()
        {
            List <ArchiveTemplateDto> archiveTemplates = new List <ArchiveTemplateDto>();

            this.reader.Read();

            int sequenceNumber = 1;

            do
            {
                this.reader.Read();

                ArchiveTemplateDto dto = new ArchiveTemplateDto();

                // Name
                this.reader.ReadStartElement("Name");
                dto.Name = this.reader.ReadString();
                this.reader.ReadEndElement();

                // Type
                this.reader.ReadStartElement("Type");
                string typeAsString = this.reader.ReadString();
                dto.ConsolidationFunction = ConvertStringToConsolidationFunction(typeAsString);
                this.reader.ReadEndElement();

                // X factor
                this.reader.ReadStartElement("XFactor");
                dto.XFactor = this.reader.ReadContentAsInt();
                this.reader.ReadEndElement();

                // Readings per data point
                this.reader.ReadStartElement("ReadingsPerDataPoint");
                dto.ReadingsPerDataPoint = this.reader.ReadContentAsInt();
                this.reader.ReadEndElement();

                // Max data points
                this.reader.ReadStartElement("MaxDataPoints");
                dto.MaxDataPoints = this.reader.ReadContentAsInt();
                this.reader.ReadEndElement();

                archiveTemplates.Add(dto);
                this.archiveTemplateIndex.Add(sequenceNumber++, dto);
            } while (this.reader.ReadToNextSibling("ArchiveTemplate"));

            this.reader.ReadEndElement();

            return(archiveTemplates.ToArray());
        }
Ejemplo n.º 5
0
 internal ArchiveTemplate(TimeSeriesDatabase database, ArchiveTemplateDto dto)
 {
     this.database = database;
     FixupFromDto(dto);
 }
Ejemplo n.º 6
0
 public void AddArchiveTemplate(ArchiveTemplateDto newArchiveTemplate)
 {
     this.archiveTemplates.Add(newArchiveTemplate);
 }