using Comal.Classes; using InABox.Clients; using InABox.Core; using InABox.DynamicGrid; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PRSDesktop; public class SecurityGroupUserGrid : DynamicOneToManyGrid { protected override void DoReconfigure(FluentList options) { base.DoReconfigure(options); options.BeginUpdate() .Clear() .AddRange(DynamicGridOption.AddRows) .AddRange(DynamicGridOption.DeleteRows) .AddRange(DynamicGridOption.MultiSelect) .EndUpdate(); } protected override void DoAdd(bool OpenEditorOnDirectEdit = false) { var IDs = Items.Select(x => x.ID).ToArray(); var filters = new Filters(); filters.Add(LookupFactory.DefineFilter()); filters.Add(new Filter(x => x.ID).NotInList(IDs)); var dlg = new MultiSelectDialog(filters.Combine(), null, true); if (dlg.ShowDialog()) { SaveItems(dlg.Items()); Refresh(false, true); } } protected override void OnDeleteItem(User item) { item.SecurityGroup.ID = Guid.Empty; Client.Save(item, "Cleared security group"); } }