using System; using InABox.Clients; using InABox.Core; namespace Comal.Classes { public abstract class BaseGLCodeLookupGenerator : LookupGenerator { protected BaseGLCodeLookupGenerator(object[] items) : base(items) { AddColumn("Code", typeof(string)); AddColumn("Description", typeof(string)); } protected abstract Filter CreateFilter(); protected override void DoGenerateLookups() { Clear(); var codes = new Client().Query( Filters.Combine(CreateFilter(), new Filter(x=>x.Hidden).IsEqualTo(false)), new Columns(x=>x.ID, x => x.Code, x => x.Description), new SortOrder(x => x.Code) ); foreach (var row in codes.Rows) AddValue( row.Get(x => x.ID), string.Format("{0}: {1}", row.Get(x => x.Code), row.Get(x => x.Description)), row.Get(x => x.Code), row.Get(x => x.Description) ); } } }