using Comal.Classes; using InABox.Core; using InABox.DynamicGrid; namespace PRSDesktop.Integrations.Common; public abstract class BaseIntegrationGrid : DynamicItemsListGrid where TType : BaseIntegrationCode, new() where TEntity : Entity, IRemotable, IPersistent, new() where TLink : EntityLink { protected override void Init() { base.Init(); } protected override void DoReconfigure(DynamicGridOptions options) { base.DoReconfigure(options); options.AddRows = false; options.EditRows = false; options.DeleteRows = false; options.FilterRows = true; options.HideDatabaseFilters = true; options.DirectEdit = true; options.HideDirectEditButton = true; options.SelectColumns = true; options.MultiSelect = true; } protected override DynamicGridColumns LoadColumns() { var result = new DynamicGridColumns(); result.Add(x => x.Code, 200, "Code"); result.Add(x => x.Description, 0, "Description"); result.Add(x => x.Entity.ID, 200, typeof(TEntity).GetCaption()); return result; } protected override void CustomiseEditor(IDynamicEditorForm form, TType[] items, DynamicGridColumn column, BaseEditor editor) { base.CustomiseEditor(form, items, column, editor); if(new Column(x => x.Entity.ID).IsEqualTo(column.ColumnName) && editor is CodePopupEditor popup) popup.CanAdd = Security.CanEdit(); } }