| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Core;
- using InABox.DynamicGrid;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRSDesktop;
- public class ProductGroupTreeView : DynamicTreeView<ProductGroup>
- {
- protected override Expression<Func<ProductGroup, Guid>> ID => x => x.ID;
- protected override Expression<Func<ProductGroup, Guid>> ParentID => x => x.Parent.ID;
- protected override Expression<Func<ProductGroup, string>> Description => x => x.Description;
- public Columns<ProductGroup> AdditionalColumns { get; } = new Columns<ProductGroup>();
- protected override void DoRefresh(Action<CoreTable?, Exception?> action)
- {
- Client.Query(
- null,
- new Columns<ProductGroup>(x => x.ID)
- .Add(x => x.Description)
- .Add(x => x.Parent.ID)
- .Add(AdditionalColumns),
- null,
- action);
- }
- protected override ProductGroup? DoLoadItem(Guid id)
- {
- return Client.Query(
- new Filter<ProductGroup>(x => x.ID).IsEqualTo(id),
- DynamicGridUtils.LoadEditorColumns(new Columns<ProductGroup>(x => x.ID)))
- .ToObjects<ProductGroup>().FirstOrDefault();
- }
- protected override void DoSaveItem(ProductGroup item)
- {
- Client.Save(item, "Edited by user.");
- }
- protected override bool DoDeleteItem(Guid id)
- {
- Client.Delete(new ProductGroup() { ID = id }, "Deleted by User");
- return true;
- }
- }
|