using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace OOO_WriteAndClear.DBModels { public partial class Order { public decimal OrderCost => OrderProducts.Sum(a=> a.ProductArticleNumberNavigation.CurrentPrice * a.ProductAmount); public decimal OrderCostWithoutDiscount => OrderProducts.Sum(a => a.ProductArticleNumberNavigation.ProductCost * a.ProductAmount); public decimal OrderDiscount => OrderCostWithoutDiscount - OrderCost; public decimal OrderDiscountPercent => 1 - (OrderCost / OrderCostWithoutDiscount); public SolidColorBrush OrderBackGround { get { SolidColorBrush brush = (SolidColorBrush)new BrushConverter().ConvertFrom("#20b2aa"); foreach (var item in OrderProducts) { if (item.ProductArticleNumberNavigation.ProductQuantityInStock == 0) { brush = (SolidColorBrush)new BrushConverter().ConvertFrom("#ff8c00"); break; } if (item.ProductArticleNumberNavigation.ProductQuantityInStock <= 3) { brush = (SolidColorBrush)new BrushConverter().ConvertFrom("#ffffff"); break; } } return brush; } } } }