kreta/Framework/Caching/DictionaryItem.cs
2024-03-13 00:33:46 +01:00

204 lines
5.3 KiB
C#

using System;
using System.Collections.Generic;
namespace Kreta.Framework.Caching
{
/// <summary>
/// Kódtétel osztály.
/// </summary>
[Serializable]
public class DictionaryItem
{
#region Constructors
public DictionaryItem(
int id,
int? value,
string name,
string name1,
string name2,
string name3,
string name4,
bool isVisible,
string code,
string type,
bool isProtected,
string color,
int? order,
string bgColor,
string description,
bool isActive,
string shortName,
int dictionaryTypeId)
{
Validate(name, type);
Id = id;
Value = value;
Name = name;
Name1 = name1;
Name2 = name2;
Name3 = name3;
Name4 = name4;
IsVisible = isVisible;
Code = code;
Type = type;
IsProtected = isProtected;
Color = color;
Order = order;
BgColor = bgColor;
Description = description;
IsActive = isActive;
ShortName = shortName;
DictionaryTypeId = dictionaryTypeId;
}
public DictionaryItem(DictionaryItem dictionaryItem)
{
Validate(dictionaryItem.Name, dictionaryItem.Type);
Id = dictionaryItem.Id;
Value = dictionaryItem.Value;
Name = dictionaryItem.Name;
Name1 = dictionaryItem.Name1;
Name2 = dictionaryItem.Name2;
Name3 = dictionaryItem.Name3;
Name4 = dictionaryItem.Name4;
IsVisible = dictionaryItem.IsVisible;
Code = dictionaryItem.Code;
Type = dictionaryItem.Type;
IsProtected = dictionaryItem.IsProtected;
Color = dictionaryItem.Color;
Order = dictionaryItem.Order;
BgColor = dictionaryItem.BgColor;
Description = dictionaryItem.Description;
IsActive = dictionaryItem.IsActive;
ShortName = dictionaryItem.ShortName;
DictionaryTypeId = dictionaryItem.DictionaryTypeId;
}
#endregion Constructors
#region Properties
/// <summary>
/// A kódtétel azonosítója
/// </summary>
public int Id { get; }
/// <summary>
/// A kódtétel értéke
/// </summary>
public int? Value { get; }
/// <summary>
/// A kódtétel neve
/// </summary>
public string Name { get; }
/// <summary>
/// A kódtétel neve 1
/// </summary>
public string Name1 { get; }
/// <summary>
/// A kódtétel neve 2
/// </summary>
public string Name2 { get; }
/// <summary>
/// A kódtétel neve 3
/// </summary>
public string Name3 { get; }
/// <summary>
/// A kódtétel neve 4
/// </summary>
public string Name4 { get; }
/// <summary>
/// A kódtétel látható-e
/// </summary>
public bool IsVisible { get; }
/// <summary>
/// A kódtétel kódja
/// </summary>
public string Code { get; }
/// <summary>
/// A kódtétel típusa
/// </summary>
public string Type { get; }
/// <summary>
/// A kódtétel védett-e
/// </summary>
public bool IsProtected { get; }
/// <summary>
/// A kódtétel szín kódja
/// </summary>
public string Color { get; }
/// <summary>
/// A kódtétel sorrendje
/// </summary>
public int? Order { get; }
/// <summary>
/// A kódtétel háttérszín kódja
/// </summary>
public string BgColor { get; }
/// <summary>
/// A kódtétel leírása
/// </summary>
public string Description { get; }
/// <summary>
/// A kódtétel aktív-e
/// </summary>
public bool IsActive { get; }
/// <summary>
/// A kódtétel rövid neve
/// </summary>
public string ShortName { get; }
/// <summary>
/// A kódtétel típusának azonosítója
/// </summary>
public int DictionaryTypeId { get; }
/// <summary>
/// Egyedi szótártáblák kiegészítő tulajdonságai
/// </summary>
public Dictionary<string, object> ExtendedProperties { get; set; }
#endregion Properties
private static void Validate(string name, string type)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (name.Length == 0)
{
throw new ArgumentException(@"The string can not be empty.", nameof(name));
}
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (type.Length == 0)
{
throw new ArgumentException(@"The string can not be empty.", nameof(type));
}
}
}
}