using System; using InABox.Clients; using InABox.Core; namespace Comal.Classes { public abstract class BaseActivityLookup : LookupGenerator { public BaseActivityLookup(T[] items) : base(items) { AddColumn("Code", typeof(string)); AddColumn("Description", typeof(string)); AddColumn("Color", typeof(string)); } protected abstract Guid EmployeeID(); protected virtual Filter CreateFilter() { return new Filter(x => x.Employee.ID).IsEqualTo(EmployeeID()); } protected override void DoGenerateLookups() { Clear(); var eacts = new Client().Query( CreateFilter(), new Columns(x => x.Activity.ID, x => x.Activity.Code, x => x.Activity.Description, x => x.Activity.Color), new SortOrder(x => x.Activity.Code) ); foreach (var row in eacts.Rows) AddValue( row.Get(col => col.Activity.ID), string.Format("{0}: {1}", row.Get(col => col.Activity.Code), row.Get(col => col.Activity.Description)), row.Get(col => col.Activity.Code), row.Get(col => col.Activity.Description), row.Get(col => col.Activity.Color) ); } } }