Product.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using wpf_connection3;
  7. namespace wpf_connection3
  8. {
  9. public class Product
  10. {
  11. public int ID { get; set; }
  12. public required string Title { get; set; }
  13. public string? Image { get; set; }
  14. public int ProductTypeID { get; set; }
  15. public required string ProductTypeTitle { get; set; }
  16. public required string ArticleNumber { get; set; }
  17. public double? MaterialCost { get; set; }
  18. public string? MaterialString { get; set; }
  19. public Uri? ImageBitmap
  20. {
  21. get
  22. {
  23. var imageName = Environment.CurrentDirectory + (Image ?? "");
  24. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  25. }
  26. }
  27. public int? LastMonthSaleQuantity { get; set; }
  28. public decimal MinCostForAgent { get; set; }
  29. public string BackgroundColor
  30. {
  31. get
  32. {
  33. // возвращаем цвет, в зависимости от количества продаж
  34. if (LastMonthSaleQuantity == null || LastMonthSaleQuantity == 0) return "#E75480"; // не белый
  35. return "#71bc78"; // не розовый
  36. }
  37. }
  38. }
  39. }