Product.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using mysql.Classes;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace mysql.Model
  8. {
  9. public class Product
  10. {
  11. public int ID { get; set; }
  12. public string Title { get; set; }
  13. public string ArticleNumber { get; set; }
  14. public string Description { get; set; }
  15. public string Image { get; set; }
  16. public int ProductionPersonCount { get; set; }
  17. public int ProductionWorkshopNumber { get; set; }
  18. public decimal MinCostForAgent { get; set; }
  19. // public string ProductTypeTitle { get; set; }
  20. // public int ProductTypeID { get; set; }
  21. public ProductType CurrentProductType { get; set; }
  22. public string MaterialString { get; set; }
  23. public string Total { get; set; }
  24. public int DaysFromLastSale { get; set; }
  25. public string LinqTitle {
  26. get {
  27. return Globals.ProductTypeList
  28. .Where(t=>t.ID== CurrentProductType.ID)
  29. .Select(t=>t.Title)
  30. .FirstOrDefault();
  31. }
  32. }
  33. public Uri ImagePreview {
  34. get {
  35. var imageName = Environment.CurrentDirectory + (Image ?? "");
  36. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  37. }
  38. }
  39. public string TypeAndName {
  40. get {
  41. return CurrentProductType.Title+" | "+Title;
  42. }
  43. }
  44. public string BackgroundColor
  45. {
  46. get
  47. {
  48. if (DaysFromLastSale > 30) return "#fee";
  49. return "#fff";
  50. }
  51. }
  52. }
  53. }