54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
namespace LaaProductionWeb.Blazor.Components.CSD.Models
|
|
{
|
|
using System.Text.RegularExpressions;
|
|
|
|
public class Charcode
|
|
{
|
|
private string uiid;
|
|
public string UIId
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.uiid))
|
|
{
|
|
this.uiid = Regex.Replace($"{this.Basis}_{this.Bezeichnung}_{this.Stelle}_{this.Laenge}_{this.Code}_{this.Value}", "[^a-zA-Z0-9]", "_").ToLower();
|
|
}
|
|
|
|
return this.uiid;
|
|
}
|
|
}
|
|
|
|
public string Basis { get; set; }
|
|
|
|
public string Bezeichnung { get; set; }
|
|
|
|
public int Stelle { get; set; }
|
|
|
|
public int Laenge { get; set; }
|
|
|
|
public string Code { get; set; }
|
|
|
|
public string Value { get; set; }
|
|
|
|
public bool Selected { get; set; }
|
|
|
|
public override bool Equals(object other)
|
|
=> other is Charcode charcode && charcode == this;
|
|
|
|
public override int GetHashCode()
|
|
=> this.UIId.GetHashCode();
|
|
|
|
public override string ToString()
|
|
=> $"{this.Basis} {this.Bezeichnung} {this.Stelle} {this.Laenge} {this.Code} {this.Value}";
|
|
|
|
public static bool operator ==(Charcode left, Charcode right)
|
|
=> left?.Basis == right?.Basis
|
|
&& left?.Bezeichnung == right?.Bezeichnung
|
|
&& left?.Stelle == right?.Stelle
|
|
&& left?.Laenge == right?.Laenge
|
|
&& left?.Code == right?.Code;
|
|
|
|
public static bool operator !=(Charcode left, Charcode right)
|
|
=> !(left == right);
|
|
}
|
|
} |