using System; using System.Windows.Media; using System.Windows.Media.Imaging; using Comal.Classes; using PropertyChanged; using Syncfusion.UI.Xaml.Kanban; namespace PRSDesktop; [DoNotNotify] public class TaskModel { public string Title { get; set; } public Guid ID { get; set; } public string Description { get; set; } public BitmapImage? Image { get; set; } public Color Color { get; set; } public bool Attachments { get; set; } public DateTime DueDate { get; set; } public DateTime CompletedDate { get; set; } public Guid EmployeeID { get; set; } public string AssignedTo { get; set; } public string Manager { get; set; } public Guid ManagerID { get; set; } public Guid JobID { get; set; } public string JobNumber { get; set; } public string JobName { get; set; } public bool Checked { get; set; } public string Category { get; set; } public KanbanType Type { get; set; } public int Number { get; set; } public bool Locked { get; set; } public TimeSpan EstimatedTime { get; set; } /// /// A string representation of the Notes field of Kanban. /// public string Notes { get; set; } public bool Search(string[] searches) { foreach (var search in searches) { var bFound = JobNumber?.ToUpper().Contains(search.ToUpper()) == true || JobName?.ToUpper().Contains(search.ToUpper()) == true || Title?.ToUpper().Contains(search.ToUpper()) == true || Description?.ToUpper().Contains(search.ToUpper()) == true || Manager?.ToUpper().Contains(search.ToUpper()) == true || AssignedTo?.ToUpper().Contains(search.ToUpper()) == true || Number.ToString().Contains(search.ToUpper()) == true; if (!bFound) return false; } return true; } public bool JobSearch(Guid id) { return JobID == id; } public static System.Drawing.Color KanbanColor(DateTime duedate, DateTime completed) { var compareDate = completed == DateTime.MinValue ? DateTime.Today : completed.Date; var color = System.Drawing.Color.LightGreen; if (duedate < compareDate) color = System.Drawing.Color.Salmon; else if (duedate.Date == compareDate) color = System.Drawing.Color.Orange; else if (duedate < compareDate.AddDays(7)) color = System.Drawing.Color.LightYellow; return color; } }