Class4.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 System.Windows.Controls;
  11. using System.Windows;
  12. using CsvHelper;
  13. using WpfApp1;
  14. namespace WpfApp1.model
  15. {
  16. [DataContract]
  17. public class Worker
  18. {
  19. public Uri? ImageBitmap
  20. {
  21. get
  22. {
  23. var imageName = Environment.CurrentDirectory + "/img/" + (photo ?? "");
  24. return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
  25. }
  26. }
  27. [DataMember]
  28. public string name { get; set; }
  29. [DataMember]
  30. public string Pos { get; set; }
  31. [DataMember]
  32. public int Age { get; set; }
  33. [DataMember]
  34. public string Sex { get; set; }
  35. [DataMember]
  36. public bool available { get; set; }
  37. [DataMember(Name = "date")]
  38. private string? stringdate { get; set; }
  39. [DataMember]
  40. public string photo { get; set; }
  41. [IgnoreDataMember]
  42. public DateTime? date
  43. {
  44. get
  45. {
  46. return stringdate == null ? null : DateTime.Parse(stringdate);
  47. }
  48. set
  49. {
  50. stringdate = value.ToString();
  51. }
  52. }
  53. }
  54. }