using System; using System.Linq; using System.Linq.Expressions; using Comal.Classes; using InABox.Core; using System.Diagnostics.CodeAnalysis; namespace comal.timesheets { public class EquipmentModel : ListModel { public EquipmentModel(IModelHost host, Func> filter, bool transient = false) : base(host, filter, transient) { //new EquipmentDocumentShell(); //new EquipmentKanbanShell(); //Reset(); } public EquipmentModel(IModelHost host, Func> filter, [NotNull] String filename) : base(host, filter, filename) { //new EquipmentDocumentShell(); //new EquipmentKanbanShell(); //Reset(); } // private void Reset() // { // Kanbans = new EquipmentKanbanShell[] { }; // Documents = new EquipmentDocumentShell[] { }; // } // public override Columns Columns => EquipmentShell.Columns. protected override Expression> ImageColumn => x => x.GroupLink.Thumbnail.ID; //public EquipmentKanbanShell[] Kanbans { get; private set; } //public EquipmentDocumentShell[] Documents { get; private set; } public String[] GroupNames => Items.Select(x => x.GroupName).Distinct().OrderBy(x => x).Prepend("All").ToArray(); // public override void BeforeLoad(MultiQuery query) // { // base.BeforeLoad(query); // // query.Add( // new Filter(x => x.Equipment.ID).InQuery(Filter(), x => x.ID), // EquipmentKanbanShell.Columns.Columns // ); // // query.Add( // new Filter(x => x.EntityLink.ID).InQuery(Filter(), x => x.ID), // EquipmentDocumentShell.Columns.Columns // ); // } // public override void AfterLoad(MultiQuery query) // { // base.AfterLoad(query); // Kanbans = query.Get() // .Rows // .Select(x => new EquipmentKanbanShell() { Row = x, Parent = this }) // .ToArray(); // Documents = query.Get() // .Rows // .Select(x => new EquipmentDocumentShell() { Row = x, Parent = this }) // .ToArray(); // } // protected override void DoUnload() // { // base.DoUnload(); // Reset(); // } } }