Class4.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Formats.Asn1;
  4. using System.Globalization;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Runtime.Serialization;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using CsvHelper;
  11. using WpfApp2;
  12. namespace WpfApp2.model
  13. {
  14. [DataContract]
  15. public class Spares
  16. {
  17. [DataMember]
  18. public string name { get; set; }
  19. [DataMember]
  20. public string detail { get; set; }
  21. [DataMember]
  22. public int price { get; set; }
  23. [DataMember]
  24. public string type { get; set; }
  25. [DataMember]
  26. public string photo { get; set; }
  27. [DataMember]
  28. public bool available { get; set; }
  29. [DataMember(Name = "date")]
  30. private string? stringdate { get; set; }
  31. [IgnoreDataMember]
  32. public DateTime? date
  33. {
  34. get
  35. {
  36. return stringdate == null ? null : DateTime.Parse(stringdate);
  37. }
  38. set
  39. {
  40. stringdate = value.ToString();
  41. }
  42. }
  43. public Uri? ImageBitmap
  44. {
  45. get
  46. {
  47. var imageName = Environment.CurrentDirectory + "/img/" + (photo ?? "");
  48. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  49. }
  50. }
  51. }
  52. }