ITaskControl.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Controls;
  5. using System.Windows.Controls.Primitives;
  6. using Comal.Classes;
  7. using InABox.Core;
  8. using InABox.Wpf;
  9. namespace PRSDesktop;
  10. public interface ITaskHost : IMasterDetailControl<Job>
  11. {
  12. IList<KanbanType> KanbanTypes { get; }
  13. KanbanSettings KanbanSettings { get; }
  14. TaskPanelProperties Properties { get; }
  15. void SaveSettings();
  16. void PopulateMenu(ITaskControl control, TaskModel task, ContextMenu menu);
  17. Kanban? CreateKanban(Action<Kanban> customise);
  18. IEnumerable<Kanban> LoadKanbans(IEnumerable<TaskModel> models, Columns<Kanban> columns);
  19. bool EditKanbans(IEnumerable<TaskModel> models, Action<Kanban>? customise = null);
  20. void DeleteKanbans(IEnumerable<TaskModel> models, string auditnote);
  21. //Requisition CreateRequisition(TaskModel model, Action<Requisition> customise);
  22. //bool EditRequisition(TaskModel model, Action<Requisition> customise = null);
  23. KanbanReferences[] GetReferences(IEnumerable<TaskModel> models);
  24. bool EditReferences(IEnumerable<TaskModel> models);
  25. bool CanChangeTasks(IEnumerable<TaskModel> models);
  26. }
  27. public interface ITaskControl
  28. {
  29. ITaskHost Host { get; set; }
  30. KanbanViewType KanbanViewType { get; }
  31. bool IsReady { get; set; }
  32. IEnumerable<TaskModel> SelectedModels(TaskModel? sender = null);
  33. string SectionName { get; }
  34. DataModel DataModel(Selection selection);
  35. void Setup();
  36. void Refresh();
  37. }
  38. public class KanbanReferences
  39. {
  40. public KanbanReferences()
  41. {
  42. Requisitions = new Guid[] { };
  43. Setouts = new Guid[] { };
  44. Deliveries = new Guid[] { };
  45. Orders = new Guid[] { };
  46. }
  47. public Guid Kanban { get; set; }
  48. public Guid[] Requisitions { get; set; }
  49. public Guid[] Setouts { get; set; }
  50. public Guid[] Deliveries { get; set; }
  51. public Guid[] Orders { get; set; }
  52. public Type ReferenceType()
  53. {
  54. if (Requisitions.Any())
  55. return typeof(Requisition);
  56. if (Setouts.Any())
  57. return typeof(Setout);
  58. if (Deliveries.Any())
  59. return typeof(Delivery);
  60. if (Orders.Any())
  61. return typeof(PurchaseOrder);
  62. return null;
  63. }
  64. public Guid GetID()
  65. {
  66. if (Requisitions.Any())
  67. return Requisitions.First();
  68. if (Setouts.Any())
  69. return Setouts.First();
  70. if (Deliveries.Any())
  71. return Deliveries.First();
  72. if (Orders.Any())
  73. return Orders.First();
  74. return Guid.Empty;
  75. }
  76. }