using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; using System.Windows.Controls.Primitives; using Comal.Classes; using InABox.Core; namespace PRSDesktop { public interface ITaskHost : IJobControl { IList KanbanTypes { get; } KanbanSettings KanbanSettings { get; } void SaveSettings(); void PopulateMenu(ITaskControl control, ContextMenu menu); Kanban? CreateKanban(Action customise); IEnumerable LoadKanbans(IEnumerable models, Columns columns); bool EditKanbans(IEnumerable models, Action customise = null); void DeleteKanbans(IEnumerable models, string auditnote); //Requisition CreateRequisition(TaskModel model, Action customise); //bool EditRequisition(TaskModel model, Action customise = null); KanbanReferences[] GetReferences(IEnumerable models); bool EditReferences(IEnumerable models); bool CanChangeTasks(IEnumerable models); } public interface ITaskControl { ITaskHost Host { get; set; } KanbanViewType KanbanViewType { get; } bool IsReady { get; set; } IEnumerable SelectedModels(TaskModel sender = null); string SectionName { get; } DataModel DataModel(Selection selection); void Setup(); void Refresh(bool resetselection); } public class KanbanReferences { public KanbanReferences() { Requisitions = new Guid[] { }; Setouts = new Guid[] { }; Deliveries = new Guid[] { }; Orders = new Guid[] { }; } public Guid Kanban { get; set; } public Guid[] Requisitions { get; set; } public Guid[] Setouts { get; set; } public Guid[] Deliveries { get; set; } public Guid[] Orders { get; set; } public Type ReferenceType() { if (Requisitions.Any()) return typeof(Requisition); if (Setouts.Any()) return typeof(Setout); if (Deliveries.Any()) return typeof(Delivery); if (Orders.Any()) return typeof(PurchaseOrder); return null; } public Guid GetID() { if (Requisitions.Any()) return Requisitions.First(); if (Setouts.Any()) return Setouts.First(); if (Deliveries.Any()) return Deliveries.First(); if (Orders.Any()) return Orders.First(); return Guid.Empty; } } }