75 lines
3.0 KiB
C#
75 lines
3.0 KiB
C#
namespace Gremlin_BlazorServer.Data.EntityClasses;
|
|
|
|
public class Product : IMetadata {
|
|
//primary key:
|
|
public uint ProductId { get; set; }
|
|
|
|
//navigation properties:
|
|
public ProductLine? ProductLine { get; set; }
|
|
|
|
// public List<LineItem>? LineItems { get; set; }
|
|
public CustomDescription? CustomDescription { get; set; }
|
|
|
|
//foreign keys
|
|
public string ProductLineCode { get; set; } = string.Empty;
|
|
public uint CustomDescriptionId { get; set; }
|
|
|
|
//Agilent-specific properties:
|
|
public string ProductNumber { get; set; } = string.Empty;
|
|
public string OptionNumber { get; set; } = string.Empty;
|
|
public string? SapShortDescription { get; set; }
|
|
public string? SapLongDescription { get; set; }
|
|
public float Weight { get; set; }
|
|
public string? ProductStatus { get; set; }
|
|
public DateTime IntroductionDate { get; set; } = DateTime.Now;
|
|
public decimal ListPrice { get; set; }
|
|
public bool? HasBreakPrices { get; set; }
|
|
public int BreakRangeFrom { get; set; }
|
|
public int BreakRangeTo { 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; }
|
|
public string? DataVersionComment { get; set; }
|
|
public string DataStatus { get; set; } = "Active";
|
|
|
|
public bool Equals(Product? other) {
|
|
if (other is null) return false;
|
|
return ProductNumber == other.ProductNumber
|
|
&& OptionNumber == other.OptionNumber
|
|
&& SapShortDescription == other.SapShortDescription
|
|
&& SapLongDescription == other.SapLongDescription
|
|
&& ListPrice == other.ListPrice;
|
|
}
|
|
|
|
public static bool operator ==(Product? product1, Product? product2) {
|
|
if (product1 is null || product2 is null) return false;
|
|
return product1.ProductNumber == product2.ProductNumber
|
|
&& product1.OptionNumber == product2.OptionNumber
|
|
&& product1.SapShortDescription == product2.SapShortDescription
|
|
&& product1.SapLongDescription == product2.SapLongDescription
|
|
&& product1.ListPrice == product2.ListPrice;
|
|
}
|
|
|
|
public static bool operator !=(Product? product1, Product? product2)
|
|
{
|
|
if (product1 is null || product2 is null) return false;
|
|
return product1.ProductNumber != product2.ProductNumber
|
|
&& product1.OptionNumber != product2.OptionNumber
|
|
&& product1.SapShortDescription != product2.SapShortDescription
|
|
&& product1.SapLongDescription != product2.SapLongDescription
|
|
&& product1.ListPrice != product2.ListPrice;
|
|
}
|
|
|
|
// public override bool Equals(object? obj) {
|
|
// if (obj == null) return false;
|
|
// return obj is Account && base.Equals(obj);
|
|
// }
|
|
|
|
// public override int GetHashCode() => $"{ProductNumber}:{OptionNumber}".GetHashCode();
|
|
|
|
} |