108 lines
3.2 KiB
C#
108 lines
3.2 KiB
C#
namespace Gremlin_BlazorServer.Data.EntityClasses
|
|
{
|
|
public class Account : IMetadata
|
|
//: IEquatable<Account>
|
|
{
|
|
//primary key:
|
|
public uint AccountId { get; set; }
|
|
|
|
//foreign keys:
|
|
public IList<Contact>? Contacts { get; set; }
|
|
public uint? ParentAccountId { get; set; }
|
|
public AccountType AccountType { get; set; } = default!;
|
|
public SubMarket SubMarket { get; set; } = default!;
|
|
public IList<CustomDescription>? CustomDescriptions { get; set; }
|
|
|
|
//class properties:
|
|
public string? AccountName { get; set; }
|
|
public string? Notes { get; set; }
|
|
public string? Street { get; set; }
|
|
public uint ZIP { get; set; }
|
|
public string? City { get; set; }
|
|
public string? FloorOrBuilding { get; set; }
|
|
public float Longitude { get; set; }
|
|
public float Latitude { get; set; }
|
|
public string? PhoneNumber { get; set; }
|
|
public string? FaxNumber { get; set; }
|
|
public string? Webpage { get; set; }
|
|
public string? EMail { get; set; }
|
|
|
|
//Agilent-specific Properties:
|
|
public uint SAPAccountNumber { get; set; }
|
|
public DateTime AccountCreatedInSAPOn { get; set; }
|
|
|
|
//metadata:
|
|
public DateTime DataCreationDate { get; set; } = DateTime.Now;
|
|
public DateTime DataModificationDate { get; set; } = DateTime.Now;
|
|
public DateTime DataValidFrom { get; set; } = DateTime.Now;
|
|
public DateTime DataValidUntil { get; set; } = DateTime.MaxValue;
|
|
public string? DataModificationByUser { get; set; } = "Gremlin";
|
|
public uint DataVersionNumber { get; set; }
|
|
public string? DataVersionComment { get; set; }
|
|
public string? DataStatus { get; set; }
|
|
|
|
//IBase
|
|
//tbd
|
|
|
|
//public bool Equals(Account other)
|
|
//{
|
|
// if (other == null) return false;
|
|
// if (this == null) return false;
|
|
// if (this.SAPAccountNumber == other.SAPAccountNumber) return true;
|
|
// else return false;
|
|
//}
|
|
|
|
//public static bool operator ==(Account account1, Account account2)
|
|
//{
|
|
// if (account1.SAPAccountNumber == 0) return false;
|
|
// if (account2.SAPAccountNumber == 0) return false;
|
|
// if (account1.SAPAccountNumber == account2.SAPAccountNumber) return true;
|
|
// else return false;
|
|
//}
|
|
|
|
//public static bool operator !=(Account account1, Account account2)
|
|
//{
|
|
// if (account1.SAPAccountNumber == 0) return false;
|
|
// if (account2.SAPAccountNumber == 0) return false;
|
|
// if (account1.SAPAccountNumber == account2.SAPAccountNumber) return false;
|
|
// else return true;
|
|
//}
|
|
|
|
//public override bool Equals(object obj)
|
|
//{
|
|
// if (obj == null) return false;
|
|
|
|
// Account accountObj = obj as Account;
|
|
// if (accountObj == null) return false;
|
|
// else return base.Equals(obj);
|
|
//}
|
|
|
|
//public override int GetHashCode()
|
|
/////<summary>
|
|
/////Returns the (unique) SAP Account ID.
|
|
/////</summary>
|
|
//{
|
|
// return Convert.ToInt32(this.SAPAccountNumber);
|
|
//}
|
|
|
|
public List<Account> AddIfUniqueTo(List<Account> accounts)
|
|
{
|
|
if (accounts.Count > 0 && SAPAccountNumber == accounts[accounts.Count - 1].SAPAccountNumber)
|
|
{
|
|
return accounts;
|
|
}
|
|
|
|
foreach (Account account in accounts)
|
|
{
|
|
if (SAPAccountNumber == account.SAPAccountNumber)
|
|
{
|
|
return accounts;
|
|
}
|
|
}
|
|
|
|
accounts.Add(this);
|
|
return accounts;
|
|
}
|
|
}
|
|
}
|