init
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using DTS.Common.Interface.Tags;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Tags
|
||||
{
|
||||
/// <summary>
|
||||
/// describes a database record for a tag
|
||||
/// <inheritdoc cref="ITag"/>
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// represents a single tag, which is composed of an ID and a string of text
|
||||
/// we don't currently let you obsolete, delete, or edit tags, just add
|
||||
/// </summary>
|
||||
public class Tag : Base.BasePropertyChanged, ITag
|
||||
{
|
||||
public Tag(string tagText, int tagId)
|
||||
{
|
||||
ID = tagId;
|
||||
Text = tagText;
|
||||
IsObsolete = false;
|
||||
}
|
||||
public const int INVALID_ID = -1;
|
||||
|
||||
private int _id;
|
||||
public int ID
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value, "ID");
|
||||
}
|
||||
|
||||
private string _text = "";
|
||||
public string Text
|
||||
{
|
||||
get => _text;
|
||||
set => SetProperty(ref _text, value, "Text");
|
||||
}
|
||||
|
||||
private bool _isObsolete = false;
|
||||
public bool IsObsolete
|
||||
{
|
||||
get => _isObsolete;
|
||||
set => SetProperty(ref _isObsolete, value, "IsObsolete");
|
||||
}
|
||||
public Tag(Tag copy)
|
||||
{
|
||||
ID = copy.ID;
|
||||
Text = copy.Text;
|
||||
IsObsolete = copy.IsObsolete;
|
||||
}
|
||||
|
||||
public Tag(IDataReader reader)
|
||||
{
|
||||
ID = Utility.GetInt(reader, "TagId");
|
||||
IsObsolete = Utility.GetBool(reader, "Obsolete");
|
||||
Text = Utility.GetString(reader, "TagText");
|
||||
}
|
||||
public Tag() { }
|
||||
public object Clone()
|
||||
{
|
||||
return new Tag(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user