init
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the interface tag aware classes must implement
|
||||
/// </summary>
|
||||
public interface ITagAware
|
||||
{
|
||||
}
|
||||
public abstract class TagAwareBase : DbTimeStampBase
|
||||
{
|
||||
public byte[] TagsBlobBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = new byte[TagIDs.Length * sizeof(int)];
|
||||
Buffer.BlockCopy(TagIDs, 0, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.Length < sizeof(int)) return;
|
||||
var tagsBlob = new int[value.Length / sizeof(int)];
|
||||
try
|
||||
{
|
||||
Buffer.BlockCopy(value, 0, tagsBlob, 0, value.Length);
|
||||
TagIDs = tagsBlob;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private int[] _tagIDs = new int[0];
|
||||
public int[] TagIDs
|
||||
{
|
||||
get => _tagIDs;
|
||||
set => _tagIDs = value ?? new int[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
public class Tags
|
||||
{
|
||||
|
||||
/// <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 : ICloneable
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Text { get; set; }
|
||||
public bool IsObsolete { get; set; }
|
||||
public Tag(Tag copy)
|
||||
{
|
||||
ID = copy.ID;
|
||||
Text = copy.Text;
|
||||
IsObsolete = copy.IsObsolete;
|
||||
}
|
||||
|
||||
public Tag(IDataRecord reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
ID = Convert.ToInt32(reader[DbOperations.Tags.TagFields.TagId.ToString()]);
|
||||
IsObsolete = Convert.ToBoolean(reader[DbOperations.Tags.TagFields.Obsolete.ToString()]);
|
||||
Text = Convert.ToString(reader[DbOperations.Tags.TagFields.TagText.ToString()]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log(ex);
|
||||
}
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
return new Tag(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DatabaseImport
|
||||
{
|
||||
/// <summary>
|
||||
/// this class encapsulates a single user
|
||||
/// </summary>
|
||||
public class User : TagAwareBase
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user