| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop.Integrations.Common;
- public abstract class BaseIntegrationGrid<TType, TEntity,TLink> : DynamicItemsListGrid<TType>
- where TType : BaseIntegrationCode<TEntity,TLink>, new()
- where TEntity : Entity, IRemotable, IPersistent, new()
- where TLink : EntityLink<TEntity>
- {
- 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<TType>(x => x.Code, 200, "Code");
- result.Add<TType>(x => x.Description, 0, "Description");
- result.Add<TType>(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<TType>(x => x.Entity.ID).IsEqualTo(column.ColumnName) && editor is CodePopupEditor popup)
- popup.CanAdd = Security.CanEdit<TEntity>();
- }
- }
|