//******************************************************************************************************// Measurement.cs - Gbtc//// Copyright © 2012, 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/08/2011 - Magdiel Lorenzo// Generated original version of source code.// 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 handling for Save() operation.// 05/13/2011 - Aniket Salver// Modified the way Guid is retrieved from the Data Base.// 05/13/2011 - Mehulbhai P Thakkar// Modified static methods to filter data by device.// 12/20/2012 - Starlynn Danyelle Gilliam// Modified Header.////****************************************************************************************************** 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.Data; namespace GSF.TimeSeries.UI.DataModels{ /// <summary> /// Represents a record of <see cref="Measurement"/> information as defined in the database. /// </summary> public class Measurement : DataModelBase { #region [ Members ] // Fields private Guid m_signalID; private int? m_historianID; private int m_pointID; private int? m_deviceID; private string m_pointTag; private string m_alternateTag; private int m_signalTypeID; private int? m_phasorSourceIndex; private string m_signalReference; private double m_adder; private double m_multiplier; private string m_description; private bool m_subscribed; private bool m_internal; private bool m_enabled; private string m_historianAcronym; private string m_deviceAcronym; private int? m_framesPerSecond; private string m_signalName; private string m_signalAcronym; private string m_signalSuffix; private string m_phasorLabel; private DateTime m_createdOn; private string m_createdBy; private DateTime m_updatedOn; private string m_updatedBy; private string m_id; private string m_companyAcronym; private string m_companyName; private bool m_selected; //This is added for the SelectMeasurement user control to provide check boxes. #endregion #region [ Constructors ] /// <summary> /// Creates a new instance of the <see cref="Measurement"/> class. /// </summary> public Measurement() { } /// <summary> /// Creates a new instance of the <see cref="Measurement"/> class. /// </summary> /// <param name="loadDefaults"> /// Determines whether to load default values into the properties using reflection. /// </param> public Measurement(bool loadDefaults) : base(loadDefaults, false) { } #endregion #region [ Properties ] /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal ID. /// </summary> public Guid SignalID { get { return m_signalID; } set { m_signalID = value; OnPropertyChanged("SignalID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Historian ID. /// </summary> // Because of database design, no validation attributes are applied public int? HistorianID { get { return m_historianID; } set { m_historianID = value; OnPropertyChanged("HistorianID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Point ID. /// </summary> // Field is populated by database via auto-increment and has no screen interaction, so no validation attributes are applied. public int PointID { get { return m_pointID; } set { m_pointID = value; } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Device ID. /// </summary> // Because of database design, no validation attributes are applied. public int? DeviceID { get { return m_deviceID; } set { m_deviceID = value; OnPropertyChanged("DeviceID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Point Tag. /// </summary> [Required(ErrorMessage = "Measurement point tag is a required field, please provide value.")] [StringLength(200, ErrorMessage = "Measurement point tag cannot exceed 200 characters.")] public string PointTag { get { return m_pointTag; } set { if ((object)value != null && value.Length > 200) m_pointTag = value.Substring(0, 200); else m_pointTag = value; OnPropertyChanged("PointTag"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Alternate Tag. /// </summary> public string AlternateTag { get { return m_alternateTag; } set { m_alternateTag = value; OnPropertyChanged("AlternateTag"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal Type ID. /// </summary> [Required(ErrorMessage = "Measurement signal type ID is a required field, please provide value.")] public int SignalTypeID { get { return m_signalTypeID; } set { m_signalTypeID = value; OnPropertyChanged("SignalTypeID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Phasor Source Index. /// </summary> // Because of database design, no validation attributes are applied public int? PhasorSourceIndex { get { return m_phasorSourceIndex; } set { m_phasorSourceIndex = value; OnPropertyChanged("PhasorSourceIndex"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal Reference. /// </summary> [Required(ErrorMessage = "Measurement signal reference is a required field, please provide value.")] public string SignalReference { get { return m_signalReference; } set { m_signalReference = value; OnPropertyChanged("SignalReference"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Adder. /// </summary> [DefaultValue(typeof(double), "0.0")] public double Adder { get { return m_adder; } set { m_adder = value; OnPropertyChanged("Adder"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Multiplier. /// </summary> [DefaultValue(typeof(double), "1.0")] public double Multiplier { get { return m_multiplier; } set { m_multiplier = value; OnPropertyChanged("Multiplier"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Description. /// </summary> // Because of database design, no validation attributes are applied public string Description { get { return m_description; } set { m_description = value; OnPropertyChanged("Description"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(false)] public bool Subscribed { get { return m_subscribed; } set { m_subscribed = value; OnPropertyChanged("Subscribed"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(true)] public bool Internal { get { return m_internal; } set { m_internal = value; OnPropertyChanged("Internal"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(false)] public bool Enabled { get { return m_enabled; } set { m_enabled = value; OnPropertyChanged("Enabled"); } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Historian Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string HistorianAcronym { get { return m_historianAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Device Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string DeviceAcronym { get { return m_deviceAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Frames Per Second. /// </summary> // Because of database design, no validation attributes are supplied public int? FramesPerSecond { get { return m_framesPerSecond; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Name. /// </summary> // Because of database design, no validation attributes are supplied public string SignalName { get { return m_signalName; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string SignalAcronym { get { return m_signalAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Suffix. /// </summary> // Because of database design, no validation attributes are supplied public string SignalSuffix { get { return m_signalSuffix; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Phasor Label. /// </summary> // Because of database design, no validation attributes are supplied public string PhasorLabel { get { return m_phasorLabel; } } /// <summary> /// Gets or sets when the current <see cref="Measurement"/> was Created. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public DateTime CreatedOn { get { return m_createdOn; } set { m_createdOn = value; } } /// <summary> /// Gets or sets who the current <see cref="Measurement"/> was created by. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public string CreatedBy { get { return m_createdBy; } set { m_createdBy = value; } } /// <summary> /// Gets or sets when the current <see cref="Measurement"/> updated. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public DateTime UpdatedOn { get { return m_updatedOn; } set { m_updatedOn = value; } } /// <summary>Lines 1–500 of 1524. Load more
//****************************************************************************************************** // Measurement.cs - Gbtc // // Copyright © 2012, 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/08/2011 - Magdiel Lorenzo // Generated original version of source code. // 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 handling for Save() operation. // 05/13/2011 - Aniket Salver // Modified the way Guid is retrieved from the Data Base. // 05/13/2011 - Mehulbhai P Thakkar // Modified static methods to filter data by device. // 12/20/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** 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.Data; namespace GSF.TimeSeries.UI.DataModels { /// <summary> /// Represents a record of <see cref="Measurement"/> information as defined in the database. /// </summary> public class Measurement : DataModelBase { #region [ Members ] // Fields private Guid m_signalID; private int? m_historianID; private int m_pointID; private int? m_deviceID; private string m_pointTag; private string m_alternateTag; private int m_signalTypeID; private int? m_phasorSourceIndex; private string m_signalReference; private double m_adder; private double m_multiplier; private string m_description; private bool m_subscribed; private bool m_internal; private bool m_enabled; private string m_historianAcronym; private string m_deviceAcronym; private int? m_framesPerSecond; private string m_signalName; private string m_signalAcronym; private string m_signalSuffix; private string m_phasorLabel; private DateTime m_createdOn; private string m_createdBy; private DateTime m_updatedOn; private string m_updatedBy; private string m_id; private string m_companyAcronym; private string m_companyName; private bool m_selected; //This is added for the SelectMeasurement user control to provide check boxes. #endregion #region [ Constructors ] /// <summary> /// Creates a new instance of the <see cref="Measurement"/> class. /// </summary> public Measurement() { } /// <summary> /// Creates a new instance of the <see cref="Measurement"/> class. /// </summary> /// <param name="loadDefaults"> /// Determines whether to load default values into the properties using reflection. /// </param> public Measurement(bool loadDefaults) : base(loadDefaults, false) { } #endregion #region [ Properties ] /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal ID. /// </summary> public Guid SignalID { get { return m_signalID; } set { m_signalID = value; OnPropertyChanged("SignalID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Historian ID. /// </summary> // Because of database design, no validation attributes are applied public int? HistorianID { get { return m_historianID; } set { m_historianID = value; OnPropertyChanged("HistorianID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Point ID. /// </summary> // Field is populated by database via auto-increment and has no screen interaction, so no validation attributes are applied. public int PointID { get { return m_pointID; } set { m_pointID = value; } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Device ID. /// </summary> // Because of database design, no validation attributes are applied. public int? DeviceID { get { return m_deviceID; } set { m_deviceID = value; OnPropertyChanged("DeviceID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Point Tag. /// </summary> [Required(ErrorMessage = "Measurement point tag is a required field, please provide value.")] [StringLength(200, ErrorMessage = "Measurement point tag cannot exceed 200 characters.")] public string PointTag { get { return m_pointTag; } set { if ((object)value != null && value.Length > 200) m_pointTag = value.Substring(0, 200); else m_pointTag = value; OnPropertyChanged("PointTag"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Alternate Tag. /// </summary> public string AlternateTag { get { return m_alternateTag; } set { m_alternateTag = value; OnPropertyChanged("AlternateTag"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal Type ID. /// </summary> [Required(ErrorMessage = "Measurement signal type ID is a required field, please provide value.")] public int SignalTypeID { get { return m_signalTypeID; } set { m_signalTypeID = value; OnPropertyChanged("SignalTypeID"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Phasor Source Index. /// </summary> // Because of database design, no validation attributes are applied public int? PhasorSourceIndex { get { return m_phasorSourceIndex; } set { m_phasorSourceIndex = value; OnPropertyChanged("PhasorSourceIndex"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Signal Reference. /// </summary> [Required(ErrorMessage = "Measurement signal reference is a required field, please provide value.")] public string SignalReference { get { return m_signalReference; } set { m_signalReference = value; OnPropertyChanged("SignalReference"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Adder. /// </summary> [DefaultValue(typeof(double), "0.0")] public double Adder { get { return m_adder; } set { m_adder = value; OnPropertyChanged("Adder"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Multiplier. /// </summary> [DefaultValue(typeof(double), "1.0")] public double Multiplier { get { return m_multiplier; } set { m_multiplier = value; OnPropertyChanged("Multiplier"); } } /// <summary> /// Gets or sets the current <see cref="Measurement"/>'s Description. /// </summary> // Because of database design, no validation attributes are applied public string Description { get { return m_description; } set { m_description = value; OnPropertyChanged("Description"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(false)] public bool Subscribed { get { return m_subscribed; } set { m_subscribed = value; OnPropertyChanged("Subscribed"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(true)] public bool Internal { get { return m_internal; } set { m_internal = value; OnPropertyChanged("Internal"); } } /// <summary> /// Gets or sets whether the current <see cref="Measurement"/> is enabled. /// </summary> [DefaultValue(false)] public bool Enabled { get { return m_enabled; } set { m_enabled = value; OnPropertyChanged("Enabled"); } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Historian Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string HistorianAcronym { get { return m_historianAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Device Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string DeviceAcronym { get { return m_deviceAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Frames Per Second. /// </summary> // Because of database design, no validation attributes are supplied public int? FramesPerSecond { get { return m_framesPerSecond; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Name. /// </summary> // Because of database design, no validation attributes are supplied public string SignalName { get { return m_signalName; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Acronym. /// </summary> // Because of database design, no validation attributes are supplied public string SignalAcronym { get { return m_signalAcronym; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Signal Suffix. /// </summary> // Because of database design, no validation attributes are supplied public string SignalSuffix { get { return m_signalSuffix; } } /// <summary> /// Gets the current <see cref="Measurement"/>'s Phasor Label. /// </summary> // Because of database design, no validation attributes are supplied public string PhasorLabel { get { return m_phasorLabel; } } /// <summary> /// Gets or sets when the current <see cref="Measurement"/> was Created. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public DateTime CreatedOn { get { return m_createdOn; } set { m_createdOn = value; } } /// <summary> /// Gets or sets who the current <see cref="Measurement"/> was created by. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public string CreatedBy { get { return m_createdBy; } set { m_createdBy = value; } } /// <summary> /// Gets or sets when the current <see cref="Measurement"/> updated. /// </summary> // Field is populated by trigger and has no screen interaction, so no validation attributes are applied public DateTime UpdatedOn { get { return m_updatedOn; } set { m_updatedOn = value; } } /// <summary>