laatzen/LaaProductionWeb/LaaProductionWeb.Services/Models/OrderScanModel.cs

36 lines
1.1 KiB
C#

namespace LaaProductionWeb.Services.Models
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
public class OrderScanModel : OrderModel
{
public string Host { get; set; }
public string Place { get; set; }
public int PalletsCount { get; set; }
[Display(Name = "Paletten-Nr.")]
public int PalletNr { get; set; } = 1;
public IDictionary<int, bool> Pallets { get; set; }
= new Dictionary<int, bool> { { 1, false } };
public string PrintUrl
=> $"~/Shipments/Print?ordernr={this.OrderNr}&positionnr={this.PositionNr}&palletnr={this.PalletNr}";
public string DownloadUrl
=> $"~/Shipments/Download?ordernr={this.OrderNr}&positionnr={this.PositionNr}&palletnr={this.PalletNr}";
public void UpdatePalletsCount(int palletsCount)
{
this.PalletsCount = palletsCount;
this.Pallets = Enumerable
.Range(1, palletsCount)
.ToDictionary(x => x, x => false);
this.Pallets[this.PalletNr] = true;
}
}
}