StockLocationLastStockTakeConverter.cs 884 B

12345678910111213141516171819202122232425
  1. using Comal.Classes;
  2. using InABox.Core;
  3. using InABox.Mobile;
  4. namespace PRS.Mobile
  5. {
  6. public class StockLocationLastStockTakeConverter : AbstractConverter<StockLocationShell, string>
  7. {
  8. public bool Active { get; set; }
  9. protected override string? Convert(StockLocationShell? value, object? parameter = null)
  10. {
  11. return !Active || value == null
  12. ? ""
  13. : !value.CurrentStocktake.IsEmpty()
  14. ? "Stocktake In Progress"
  15. : value.StocktakeFrequency == StockTakeFrequency.Never
  16. ? value.LastStocktake.IsEmpty()
  17. ? $"Last Stocktake : Never"
  18. : $"Last Stocktake : {value.LastStocktake:dd MMM yy}"
  19. : $"Stocktake Due : {value.NextStocktake:dd MMM yy}";
  20. }
  21. }
  22. }