ITaskControl.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 Settings { get; }
  14. void SaveSettings();
  15. void PopulateMenu(ITaskControl control, 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. }
  25. public interface ITaskControl
  26. {
  27. ITaskHost Host { get; set; }
  28. KanbanView KanbanView { get; }
  29. bool IsReady { get; set; }
  30. IEnumerable<TaskModel> SelectedModels(TaskModel sender = null);
  31. string SectionName { get; }
  32. DataModel DataModel(Selection selection);
  33. void Setup();
  34. void Refresh(bool resetselection);
  35. }
  36. public class KanbanReferences
  37. {
  38. public KanbanReferences()
  39. {
  40. Requisitions = new Guid[] { };
  41. Setouts = new Guid[] { };
  42. Deliveries = new Guid[] { };
  43. Orders = new Guid[] { };
  44. }
  45. public Guid Kanban { get; set; }
  46. public Guid[] Requisitions { get; set; }
  47. public Guid[] Setouts { get; set; }
  48. public Guid[] Deliveries { get; set; }
  49. public Guid[] Orders { get; set; }
  50. public Type ReferenceType()
  51. {
  52. if (Requisitions.Any())
  53. return typeof(Requisition);
  54. if (Setouts.Any())
  55. return typeof(Setout);
  56. if (Deliveries.Any())
  57. return typeof(Delivery);
  58. if (Orders.Any())
  59. return typeof(PurchaseOrder);
  60. return null;
  61. }
  62. public Guid GetID()
  63. {
  64. if (Requisitions.Any())
  65. return Requisitions.First();
  66. if (Setouts.Any())
  67. return Setouts.First();
  68. if (Deliveries.Any())
  69. return Deliveries.First();
  70. if (Orders.Any())
  71. return Orders.First();
  72. return Guid.Empty;
  73. }
  74. }
  75. }