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(DynamicGridOptions options) { base.DoReconfigure(options); options.Clear(); options.AddRows = true; options.DeleteRows = true; options.MultiSelect = true; } protected override void DoAdd(bool OpenEditorOnDirectEdit = false) { var IDs = ExtractValues(x => x.ID, Selection.All).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()) { DataComponent.SaveItems(dlg.Items()); Refresh(false, true); } } protected override void OnDeleteItem(User item) { item.SecurityGroup.ID = Guid.Empty; Client.Save(item, "Cleared security group"); } }