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