2using System.Xml.Serialization;
20[XmlType(TypeName =
"supplierDelivery")]
23 private int _supplierId;
26 private int _leadTime;
72 [XmlAttribute(
"supplierId")]
81 throw new ArgumentOutOfRangeException(
84 "The supplier identifier cannot be negative.");
88 SetProperty(ref _supplierId, value);
95 [XmlAttribute(
"itemId")]
104 throw new ArgumentOutOfRangeException(
107 "The item identifier cannot be negative.");
111 SetProperty(ref _itemId, value);
121 [XmlElement(
"warehouse")]
128 ArgumentNullException.ThrowIfNull(value);
131 if (SetProperty(ref _warehouse, value))
145 [XmlAttribute(
"leadTime")]
154 throw new ArgumentOutOfRangeException(
157 "The supplier-delivery lead time cannot be negative.");
161 SetProperty(ref _leadTime, value);
190 int standaloneWarehouseId,
198 standaloneWarehouseId),
229 return other is not
null
232 && Warehouse.Kind == other.Warehouse.Kind
233 && Warehouse.ReferenceId ==
266 ArgumentNullException.ThrowIfNull(warehouse);
270 && Warehouse.Kind == warehouse.Kind
271 && Warehouse.ReferenceId ==
Base class for model objects that notify listeners when one of their properties changes.
virtual void OnPropertyChanged([CallerMemberName] string? propertyName=null)
Raises the PropertyChanged event.
Represents a serializable reference to a warehouse.
int ReferenceId
Gets or sets the referenced identifier.
static WarehouseReference ForPlantWarehouse(int plantId)
Creates a reference to the warehouse attached to a plant.
static WarehouseReference ForStandaloneWarehouse(int warehouseId)
Creates a reference to a standalone warehouse.
WarehouseReferenceKind WarehouseKind
Gets the kind of referenced warehouse.
bool ConcernsItem(int itemId)
Determines whether this delivery concerns the specified item.
int SupplierId
Gets or sets the identifier of the supplier.
SupplierDelivery(int supplierId, int itemId, WarehouseReference warehouse, int leadTime)
Initializes a supplier-delivery relationship.
int WarehouseReferenceId
Gets the identifier used to reference the warehouse.
int ItemId
Gets or sets the identifier of the delivered item.
bool RefersToSameDelivery(SupplierDelivery? other)
Determines whether this object represents the same supplier/inventory relationship as another object.
static SupplierDelivery ToStandaloneWarehouse(int supplierId, int itemId, int standaloneWarehouseId, int leadTime)
Creates a delivery relationship involving a standalone warehouse.
int LeadTime
Gets or sets the supplier-delivery lead time.
static SupplierDelivery ToPlantWarehouse(int supplierId, int itemId, int plantId, int leadTime)
Creates a delivery relationship involving a warehouse attached to a plant.
SupplierDelivery()
Initializes an empty supplier-delivery relationship.
bool ConcernsInventory(int itemId, WarehouseReference warehouse)
Determines whether this delivery concerns the specified inventory.
WarehouseReference Warehouse
Gets or sets the warehouse receiving the item.
bool ConcernsSupplier(int supplierId)
Determines whether this delivery concerns the specified supplier.
WarehouseReferenceKind
Identifies the type of warehouse referenced by a relationship.