Files
DP44/Common/DTS.Common/.svn/pristine/ab/abac89ce53a2efcb3a0d300713939052c7ad4a88.svn-base

79 lines
3.0 KiB
Plaintext
Raw Normal View History

2026-04-17 14:55:32 -04:00
using DTS.Common.Interface.Groups;
using DTS.Common.Interface.Groups.GroupList;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
namespace DTS.Common.Classes.Groups
{
/// <summary>
/// represents a record of a channel in the db
/// <inheritdoc cref="IChannelDbRecord"/>
/// </summary>
public class GroupDbRecord : Base.BasePropertyChanged, IGroupDbRecord
{
protected int _id = -1;
/// <summary>
/// The database id of the Channel
/// </summary>
[Key]
public int Id
{
get => _id;
set => SetProperty(ref _id, value, "Id");
}
public string SerialNumber { get; set; }
public string Picture { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public bool Embedded { get; set; }
public DateTime LastModified { get; set; }
public string LastModifiedBy { get; set; }
public int? StaticGroupId { get; set; }
public string ExtraProperties { get; set; }
public GroupDbRecord() { }
public GroupDbRecord(IGroupDbRecord copy)
{
Id = copy.Id;
SerialNumber = copy.SerialNumber;
Picture = copy.Picture;
DisplayName = copy.DisplayName;
Description = copy.Description;
Embedded = copy.Embedded;
LastModified = copy.LastModified;
LastModifiedBy = copy.LastModifiedBy;
StaticGroupId = copy.StaticGroupId;
ExtraProperties = copy.ExtraProperties;
}
public GroupDbRecord(IGroup copy, List<KeyValuePair<string, string>> extraProperties)
{
Id = copy.Id;
SerialNumber = copy.Name;
Picture = "";
DisplayName = copy.DisplayName;
Description = copy.Description;
Embedded = copy.Embedded;
LastModified = copy.LastModified;
LastModifiedBy = copy.LastModifiedBy;
StaticGroupId = copy.StaticGroupId;
ExtraProperties = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(extraProperties);
}
public GroupDbRecord(IDataReader reader)
{
Id = Utility.GetInt(reader, "Id", -1);
SerialNumber = Utility.GetString(reader, "SerialNumber");
Picture = Utility.GetString(reader, "Picture");
DisplayName = Utility.GetString(reader, "DisplayName");
Description = Utility.GetString(reader, "Description");
Embedded = Utility.GetBool(reader, "Embedded");
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy");
StaticGroupId = Utility.GetNullableInt(reader, "StaticGroupId");
ExtraProperties = Utility.GetString(reader, "ExtraProperties");
}
}
}