12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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 KanbanStatus Status { get; set; }
- public Guid EmployeeCategory { get; set; }
- public KanbanType Type { get; set; }
- public int Number { get; set; }
- public bool Locked { get; set; }
- public TimeSpan EstimatedTime { get; set; }
- public bool ShowEmployeeImage { get; set; }
- /// <summary>
- /// A string representation of the Notes field of Kanban.
- /// </summary>
- public string Notes { get; set; }
- public bool IsAssignee => EmployeeID != Guid.Empty && EmployeeCategory == EmployeeID;
- public bool IsManager => ManagerID != Guid.Empty && EmployeeCategory == ManagerID;
- 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;
- }
- }
|