KanbanModel.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 : KanbanModel
  10. {
  11. public BitmapImage Image { get; set; }
  12. public Color Color { get; set; }
  13. public bool Attachments { get; set; }
  14. public DateTime DueDate { get; set; }
  15. public DateTime CompletedDate { get; set; }
  16. public Guid EmployeeID { get; set; }
  17. public string AssignedTo { get; set; }
  18. public string Manager { get; set; }
  19. public Guid ManagerID { get; set; }
  20. public Guid JobID { get; set; }
  21. public string JobNumber { get; set; }
  22. public string JobName { get; set; }
  23. public bool Checked { get; set; }
  24. public KanbanType Type { get; set; }
  25. public int Number { get; set; }
  26. public bool Locked { get; set; }
  27. public TimeSpan EstimatedTime { get; set; }
  28. /// <summary>
  29. /// A string representation of the Notes field of Kanban.
  30. /// </summary>
  31. public string Notes { get; set; }
  32. public bool Search(string[] searches)
  33. {
  34. foreach (var search in searches)
  35. {
  36. var bFound = JobNumber?.ToUpper().Contains(search.ToUpper()) == true
  37. || JobName?.ToUpper().Contains(search.ToUpper()) == true
  38. || Title?.ToUpper().Contains(search.ToUpper()) == true
  39. || Description?.ToUpper().Contains(search.ToUpper()) == true;
  40. if (!bFound)
  41. return false;
  42. }
  43. return true;
  44. }
  45. public bool JobSearch(Guid id)
  46. {
  47. return JobID == id;
  48. }
  49. public static System.Drawing.Color KanbanColor(DateTime duedate, DateTime completed)
  50. {
  51. var compareDate = completed == DateTime.MinValue ? DateTime.Today : completed.Date;
  52. var color = System.Drawing.Color.LightGreen;
  53. if (duedate < compareDate)
  54. color = System.Drawing.Color.Salmon;
  55. else if (duedate.Date == compareDate)
  56. color = System.Drawing.Color.Orange;
  57. else if (duedate < compareDate.AddDays(7))
  58. color = System.Drawing.Color.LightYellow;
  59. return color;
  60. }
  61. }