ITaskControl.cs 2.7 KB

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