101 lines
4.2 KiB
C#
101 lines
4.2 KiB
C#
using Newtonsoft.Json;
|
|
|
|
namespace Gremlin_BlazorServer.Data.EntityClasses;
|
|
|
|
public class Contact : IMetadata {
|
|
//primary key:
|
|
public uint ContactId { get; set; }
|
|
|
|
//foreign keys:
|
|
public uint AccountId { get; set; }
|
|
// public IList<uint> QuoteIds { get; set; } = new List<uint>();
|
|
|
|
//navigation properties:
|
|
public Account? Account { get; set; }
|
|
// public IList<Quote>? Quotes { get; set; }
|
|
|
|
//class properties:
|
|
public string? AcademicTitle { get; set; }
|
|
public string? FirstName { get; set; }
|
|
public string? LastName { get; set; }
|
|
public byte Gender { get; set; } = 0;
|
|
public bool OptInStatus { get; set; }
|
|
public string? Department { get; set; }
|
|
public string? Function { get; set; }
|
|
public string? Room { get; set; }
|
|
public bool IsReference { get; set; }
|
|
public string? Notes { get; set; }
|
|
public string? PhoneNumber { get; set; }
|
|
public string? MobileNumber { get; set; }
|
|
public string? EMail { get; set; }
|
|
public string? PreferredContactMethod { get; set; }
|
|
public bool NoPhoneCalls { get; set; }
|
|
public bool EmailBounced { get; set; }
|
|
public bool NoHardcopyMailing { get; set; }
|
|
public bool ValidatedContact { get; set; }
|
|
|
|
//Agilent-specific Properties:
|
|
public uint SapContactNumber { get; set; }
|
|
public DateTime SapContactCreationDate { get; set; } = DateTime.Now;
|
|
public DateTime SapContactModifiedDate { get; set; } = DateTime.Now;
|
|
public string? SapJobFunction { get; set; }
|
|
public string? SapProductInterest { get; set; }
|
|
public string? SapApplicationInterest { get; set; }
|
|
public string? SapJobLevel { get; set; }
|
|
public string? SapCompetitiveIBase { 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_BlazorServer";
|
|
public uint DataVersionNumber { get; set; } = 1;
|
|
public string? DataVersionComment { get; set; }
|
|
public string DataStatus { get; set; } = "Active";
|
|
|
|
public bool Equals(Contact? other) {
|
|
if (other is null) return false;
|
|
return SapContactNumber == other.SapContactNumber
|
|
&& LastName == other.LastName
|
|
&& FirstName == other.FirstName
|
|
&& EMail == other.EMail
|
|
&& PhoneNumber == other.PhoneNumber
|
|
&& EmailBounced == other.EmailBounced
|
|
&& OptInStatus == other.OptInStatus;
|
|
}
|
|
|
|
public static bool operator ==(Contact? contact1, Contact? contact2) {
|
|
if (contact1 is null || contact2 is null) return false;
|
|
if (contact1.SapContactNumber == 0) return false;
|
|
if (contact2.SapContactNumber == 0) return false;
|
|
return contact1.SapContactNumber == contact2.SapContactNumber
|
|
&& contact1.LastName == contact2.LastName
|
|
&& contact1.FirstName == contact2.FirstName
|
|
&& contact1.EMail == contact2.EMail
|
|
&& contact1.PhoneNumber == contact2.PhoneNumber
|
|
&& contact1.EmailBounced == contact2.EmailBounced
|
|
&& contact1.OptInStatus == contact2.OptInStatus;
|
|
}
|
|
|
|
public static bool operator !=(Contact? contact1, Contact? contact2)
|
|
{
|
|
if (contact1 is null || contact2 is null) return false;
|
|
if (contact1.SapContactNumber == 0) return false;
|
|
if (contact2.SapContactNumber == 0) return false;
|
|
return contact1.SapContactNumber != contact2.SapContactNumber
|
|
&& contact1.LastName != contact2.LastName
|
|
&& contact1.FirstName != contact2.FirstName
|
|
&& contact1.EMail != contact2.EMail
|
|
&& contact1.PhoneNumber != contact2.PhoneNumber
|
|
&& contact1.EmailBounced != contact2.EmailBounced
|
|
&& contact1.OptInStatus != contact2.OptInStatus;
|
|
}
|
|
|
|
// public override bool Equals(object? obj) {
|
|
// if (obj == null) return false;
|
|
// return obj is Account && base.Equals(obj);
|
|
// }
|
|
//
|
|
// public override int GetHashCode() => $"{LastName}:{FirstName}:{EMail}".GetHashCode();
|
|
} |