Models: Add IDelivery for DeliveryParts

This commit is contained in:
2024-03-27 16:04:47 +01:00
parent a04f887b4d
commit cac0959fe7
3 changed files with 10 additions and 2 deletions

View File

@ -26,6 +26,7 @@ using MimeKit;
using System.Windows.Input; using System.Windows.Input;
using LinqKit; using LinqKit;
using System.Linq.Expressions; using System.Linq.Expressions;
using Elwig.Models;
namespace Elwig.Helpers { namespace Elwig.Helpers {
public static partial class Utils { public static partial class Utils {
@ -326,7 +327,7 @@ namespace Elwig.Helpers {
> 0 => "+", > 0 => "+",
}; };
public static double AggregateDeliveryPartsKmw(IEnumerable<DeliveryPart> parts) public static double AggregateDeliveryPartsKmw(IEnumerable<IDelivery> parts)
=> parts.Aggregate( => parts.Aggregate(
(Weight: 0, Kmw: 0.0), (Weight: 0, Kmw: 0.0),
(sum, item) => ( (sum, item) => (

View File

@ -6,7 +6,7 @@ using System.Linq;
namespace Elwig.Models.Entities { namespace Elwig.Models.Entities {
[Table("delivery_part"), PrimaryKey("Year", "DId", "DPNr")] [Table("delivery_part"), PrimaryKey("Year", "DId", "DPNr")]
public class DeliveryPart { public class DeliveryPart : IDelivery {
[Column("year")] [Column("year")]
public int Year { get; set; } public int Year { get; set; }

View File

@ -0,0 +1,7 @@
namespace Elwig.Models {
public interface IDelivery {
int Weight { get; }
double Kmw { get; }
double Oe { get; }
}
}