Models: Add IDelivery for DeliveryParts
This commit is contained in:
@ -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) => (
|
||||||
|
@ -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; }
|
||||||
|
|
||||||
|
7
Elwig/Models/IDelivery.cs
Normal file
7
Elwig/Models/IDelivery.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Elwig.Models {
|
||||||
|
public interface IDelivery {
|
||||||
|
int Weight { get; }
|
||||||
|
double Kmw { get; }
|
||||||
|
double Oe { get; }
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user