FruitBankHybridApp/FruitBank.Common/Entities/StockTakingItem.cs

32 lines
1.1 KiB
C#

using FruitBank.Common.Dtos;
using LinqToDB;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[Table(Name = FruitBankConstClient.StockTakingItemDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockTakingItemDbTableName)]
public class StockTakingItem : MgStockTakingItem<StockTaking, ProductDto>
{
[Column(DataType = DataType.DecFloat, CanBeNull = false)]
public double OriginalNetWeight { get; set; }
[Column(DataType = DataType.DecFloat, CanBeNull = false)]
public double MeasuredNetWeight { get; set; }
[Association(ThisKey = nameof(Id), OtherKey = nameof(StockTakingItemPallet.StockTakingItemId), CanBeNull = true)]
public List<StockTakingItemPallet>? StockTakingItemPallets { get; set; }
public bool IsRequiredForMeasuring => OriginalStockQuantity != 0 || OriginalNetWeight != 0;
public string DisplayText
{
get
{
if (IsMeasured) return $"[KÉSZ] {Product!.Name}";
return IsRequiredForMeasuring ? $"[KÖT] {Product!.Name}" : $"{Product!.Name}";
}
}
}