819 lines · 32.5 KB · C#
RawDownload
//******************************************************************************************************//  CalculatedMeasurement.cs - Gbtc////  Copyright © 2010, Grid Protection Alliance.  All Rights Reserved.////  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See//  the NOTICE file distributed with this work for additional information regarding copyright ownership.//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may//  not use this file except in compliance with the License. You may obtain a copy of the License at:////      http://www.opensource.org/licenses/MIT////  Unless agreed to in writing, the subject software distributed under the License is distributed on an//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the//  License for the specific language governing permissions and limitations.////  Code Modification History://  ----------------------------------------------------------------------------------------------------//  04/11/2011 - Aniket Salver//       Generated original version of source code.//  04/21/2011 - Mehulbhai P Thakkar//       Added static methods for database operations.//  05/02/2011 - J. Ritchie Carroll//       Updated for coding consistency.//  05/03/2011 - Mehulbhai P Thakkar//       Guid field related changes as well as static functions update.//  05/05/2011 - Mehulbhai P Thakkar//       Added NULL value and Guid parameter handling for Save() operation.//  05/12/2011 - Aniket Salver//                  Modified the way Guid is retrived from the Data Base.//  05/13/2011 - Mehulbhai P Thakkar//       Added regular expression validator for Acronym.////****************************************************************************************************** using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.ComponentModel;using System.ComponentModel.DataAnnotations;using System.Data;using System.Linq;using GSF.ComponentModel.DataAnnotations;using GSF.Data;using GSF.TimeSeries.UI; namespace GSF.PhasorProtocols.UI.DataModels{    /// <summary>    /// Represents a record of <see cref="CalculatedMeasurement"/> information as defined in the database.    /// </summary>    public class CalculatedMeasurement : DataModelBase    {        #region [ Members ]         // Fields        private Guid m_nodeID;        private int m_id;        private string m_acronym;        private string m_name;        private string m_typeName;        private string m_assemblyName;        private string m_connectionString;        private string m_configSection;        private string m_outputMeasurements;        private string m_inputMeasurements;        private int m_minimumMeasurementsToUse;        private int m_framesPerSecond;        private double m_lagTime;        private double m_leadTime;        private bool m_useLocalClockAsRealTime;        private bool m_allowSortsByArrival;        private int m_loadOrder;        private bool m_enabled;        private bool m_ignoreBadTimeStamps;        private int m_timeResolution;        private bool m_allowPreemptivePublishing;        private string m_downsamplingMethod;        private string m_nodeName;        private bool m_performTimestampReasonabilityCheck;        private DateTime m_createdOn;        private string m_createdBy;        private DateTime m_updatedOn;        private string m_updatedBy;         #endregion         #region [ Properties ]         /// <summary>        /// Gets or sets <see cref="CalculatedMeasurement"/> NodeID.        /// </summary>        [Required(ErrorMessage = "Please select a node ID.")]        public Guid NodeID        {            get            {                return m_nodeID;            }            set            {                m_nodeID = value;                OnPropertyChanged("NodeID");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> ID.        /// </summary>        // Field is populated by database via auto-increment and has no screen interaction, so no validation attributes are applied        public int ID        {            get            {                return m_id;            }            set            {                m_id = value;            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> Acronym.        /// </summary>        [Required(ErrorMessage = "Calculated measurement acronym is a required field, please provide value.")]        [StringLength(200, ErrorMessage = "Calculated measurement acronym cannot exceed 200 characters.")]        [AcronymValidation]        public string Acronym        {            get            {                return m_acronym;            }            set            {                m_acronym = value;                OnPropertyChanged("Acronym");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> Name.        /// </summary>        [StringLength(200, ErrorMessage = "Calculated measurement name cannot exceed 200 characters.")]        public string Name        {            get            {                return m_name;            }            set            {                m_name = value;                OnPropertyChanged("Name");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> Acronym.        /// </summary>        [Required(ErrorMessage = "Calculated measurement type name is a required field, please provide value.")]        public string TypeName        {            get            {                return m_typeName;            }            set            {                m_typeName = value;                OnPropertyChanged("TypeName");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> AssemblyName.        /// </summary>        [Required(ErrorMessage = "Calculated measurement assembly name is a required field, please provide value.")]        public string AssemblyName        {            get            {                return m_assemblyName;            }            set            {                m_assemblyName = value;                OnPropertyChanged("AssemblyName");            }        }         /// <summary>        /// Gets or sets <see cref="CalculatedMeasurement"/> ConnectionString.        /// </summary>        // Because of database design, no validation attributes are applied.        public string ConnectionString        {            get            {                return m_connectionString;            }            set            {                if ((object)value == null)                    m_connectionString = string.Empty;                else                    m_connectionString = value;                OnPropertyChanged("ConnectionString");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> ConfigSection.        /// </summary>        [StringLength(200, ErrorMessage = "Config Section cannot exceed 200 characters.")]        public string ConfigSection        {            get            {                return m_configSection;            }            set            {                m_configSection = value;                OnPropertyChanged("ConfigSection");            }        }         /// <summary>        /// Gets or sets <see cref="CalculatedMeasurement"/> OutputMeasurements.        /// </summary>        // Because of database design, no validation attributes are applied.        public string OutputMeasurements        {            get            {                return m_outputMeasurements;            }            set            {                m_outputMeasurements = value;                OnPropertyChanged("OutputMeasurements");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> InputMeasurements.        /// </summary>        // Because of database design, no validation attributes are applied.        public string InputMeasurements        {            get            {                return m_inputMeasurements;            }            set            {                m_inputMeasurements = value;                OnPropertyChanged("InputMeasurements");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> MinimumMeasurementsToUse.        /// </summary>        [Required(ErrorMessage = " Calculated measurement minimum measurements to use is a required field, please provide value.")]        [DefaultValue(-1)]        public int MinimumMeasurementsToUse        {            get            {                return m_minimumMeasurementsToUse;            }            set            {                m_minimumMeasurementsToUse = value;                OnPropertyChanged("MinimumMeasurementsToUse");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> FramesPerSecond.        /// </summary>        [Required(ErrorMessage = " Calculated measurement frames per second is a required field, please provide value.")]        [DefaultValue(30)]        public int FramesPerSecond        {            get            {                return m_framesPerSecond;            }            set            {                m_framesPerSecond = value;                OnPropertyChanged("FramesPerSecond");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> LagTime.        /// </summary>        [Required(ErrorMessage = "Calculated measurement lag time is a required field, please provide value.")]        [DefaultValue(3.0D)]        public double LagTime        {            get            {                return m_lagTime;            }            set            {                m_lagTime = value;                OnPropertyChanged("LagTime");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> LeadTime.        /// </summary>        [Required(ErrorMessage = "Calculated measurement lead time is a required field, please provide value.")]        [DefaultValue(1.0D)]        public double LeadTime        {            get            {                return m_leadTime;            }            set            {                m_leadTime = value;                OnPropertyChanged("LeadTime");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> UseLocalClockAsRealTime.        /// </summary>        [DefaultValue(false)]        public bool UseLocalClockAsRealTime        {            get            {                return m_useLocalClockAsRealTime;            }            set            {                m_useLocalClockAsRealTime = value;                OnPropertyChanged("UseLocalClockAsRealTime");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> AllowSortsByArrival.        /// </summary>        [DefaultValue(true)]        public bool AllowSortsByArrival        {            get            {                return m_allowSortsByArrival;            }            set            {                m_allowSortsByArrival = value;                OnPropertyChanged("AllowSortsByArrival");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> LoadOrder.        /// </summary>        [Required(ErrorMessage = "Calculated measurement load order is a required field, please provide value.")]        [DefaultValue(0)]        public int LoadOrder        {            get            {                return m_loadOrder;            }            set            {                m_loadOrder = value;                OnPropertyChanged("LoadOrder");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> Enabled        /// </summary>        [DefaultValue(false)]        public bool Enabled        {            get            {                return m_enabled;            }            set            {                m_enabled = value;                OnPropertyChanged("Enabled");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> IgnoreBadTimeStamps        /// </summary>        [DefaultValue(false)]        public bool IgnoreBadTimeStamps        {            get            {                return m_ignoreBadTimeStamps;            }            set            {                m_ignoreBadTimeStamps = value;                OnPropertyChanged("IgnoreBadTimeStamps");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> TimeResolution        /// </summary>        [Required(ErrorMessage = "Calculated measurement time resoulution is a required field, please provide value.")]        [DefaultValue(10000)]        public int TimeResolution        {            get            {                return m_timeResolution;            }            set            {                m_timeResolution = value;                OnPropertyChanged("TimeResolution");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> AllowPreemptivePublishing        /// </summary>        [DefaultValue(true)]        public bool AllowPreemptivePublishing        {            get            {                return m_allowPreemptivePublishing;            }            set            {                m_allowPreemptivePublishing = value;                OnPropertyChanged("AllowPreemptivePublishing");            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> DownsamplingMethod        /// </summary>        [StringLength(15, ErrorMessage = "Calculated measurement name cannot exceed 15 characters.")]        [DefaultValue("LastReceived")]        public string DownsamplingMethod        {            get            {                return m_downsamplingMethod;            }            set            {                m_downsamplingMethod = value;                OnPropertyChanged("DownsamplingMethod");            }        }         /// <summary>        ///  Gets <see cref="CalculatedMeasurement"/> NodeName        /// </summary>        public string NodeName        {            get            {                return m_nodeName;            }        }         /// <summary>        ///  Gets or sets <see cref="CalculatedMeasurement"/> PerformTimestampReasonabilityCheck        /// </summary>        [DefaultValue(true)]        public bool PerformTimestampReasonabilityCheck        {            get            {                return m_performTimestampReasonabilityCheck;            }            set            {                m_performTimestampReasonabilityCheck = value;                OnPropertyChanged("PerformTimestampReasonabilityCheck");            }

Lines 1–500 of 819.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t