People.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using static wpf_listbox.models.Globals;
  7. using System.Threading.Tasks;
  8. using System.Collections.Generic;
  9. using wpf_listbox;
  10. using CsvHelper;
  11. using System.Diagnostics;
  12. using wpf_listbox.models;
  13. using static wpf_listbox.MainWindow;
  14. using System.IO;
  15. using System.Globalization;
  16. using System.Runtime.Serialization;
  17. namespace wpf_listbox.models
  18. {
  19. [DataContract]
  20. public class People
  21. {
  22. [DataMember]
  23. public string Name { get; set; }
  24. [DataMember]
  25. public int Age { get; set; }
  26. [DataMember]
  27. public int Price { get; set; }
  28. [DataMember]
  29. public string Gender { get; set; }
  30. [DataMember]
  31. public string Photo { get; set; }
  32. [DataMember]
  33. public string Place { get; set; }
  34. [DataMember]
  35. public bool IsFavorite { get; set; }
  36. [DataMember(Name = "dateOfConnections")]
  37. private string? stringDate { get; set; }
  38. [IgnoreDataMember]
  39. public DateTime? dateOfConnections
  40. {
  41. get
  42. {
  43. return stringDate == null ? null : DateTime.Parse(stringDate);
  44. }
  45. set
  46. {
  47. stringDate = value.ToString();
  48. }
  49. }
  50. public Uri? ImageBitmap
  51. {
  52. get
  53. {
  54. var imageName = Environment.CurrentDirectory + "/img/" + (Photo ?? "");
  55. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  56. }
  57. }
  58. }
  59. }