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