TaskModel.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Windows.Media;
  3. using System.Windows.Media.Imaging;
  4. using Comal.Classes;
  5. using PropertyChanged;
  6. using Syncfusion.UI.Xaml.Kanban;
  7. namespace PRSDesktop;
  8. [DoNotNotify]
  9. public class TaskModel
  10. {
  11. public string Title { get; set; }
  12. public Guid ID { get; set; }
  13. public string Description { get; set; }
  14. public BitmapImage? Image { get; set; }
  15. public Color Color { get; set; }
  16. public bool Attachments { get; set; }
  17. public DateTime DueDate { get; set; }
  18. public DateTime CompletedDate { get; set; }
  19. public Guid EmployeeID { get; set; }
  20. public string AssignedTo { get; set; }
  21. public string Manager { get; set; }
  22. public Guid ManagerID { get; set; }
  23. public Guid JobID { get; set; }
  24. public string JobNumber { get; set; }
  25. public string JobName { get; set; }
  26. public bool Checked { get; set; }
  27. public string Category { get; set; }
  28. public Guid EmployeeCategory { get; set; }
  29. public KanbanType Type { get; set; }
  30. public int Number { get; set; }
  31. public bool Locked { get; set; }
  32. public TimeSpan EstimatedTime { get; set; }
  33. /// <summary>
  34. /// A string representation of the Notes field of Kanban.
  35. /// </summary>
  36. public string Notes { get; set; }
  37. public bool Search(string[] searches)
  38. {
  39. foreach (var search in searches)
  40. {
  41. var bFound = JobNumber?.ToUpper().Contains(search.ToUpper()) == true
  42. || JobName?.ToUpper().Contains(search.ToUpper()) == true
  43. || Title?.ToUpper().Contains(search.ToUpper()) == true
  44. || Description?.ToUpper().Contains(search.ToUpper()) == true
  45. || Manager?.ToUpper().Contains(search.ToUpper()) == true
  46. || AssignedTo?.ToUpper().Contains(search.ToUpper()) == true
  47. || Number.ToString().Contains(search.ToUpper()) == true;
  48. if (!bFound)
  49. return false;
  50. }
  51. return true;
  52. }
  53. public bool JobSearch(Guid id)
  54. {
  55. return JobID == id;
  56. }
  57. public static System.Drawing.Color KanbanColor(DateTime duedate, DateTime completed)
  58. {
  59. var compareDate = completed == DateTime.MinValue ? DateTime.Today : completed.Date;
  60. var color = System.Drawing.Color.LightGreen;
  61. if (duedate < compareDate)
  62. color = System.Drawing.Color.Salmon;
  63. else if (duedate.Date == compareDate)
  64. color = System.Drawing.Color.Orange;
  65. else if (duedate < compareDate.AddDays(7))
  66. color = System.Drawing.Color.LightYellow;
  67. return color;
  68. }
  69. }