| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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<SecurityGroup, User>
- {
- 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<User>();
- filters.Add(LookupFactory.DefineFilter<User>());
- filters.Add(new Filter<User>(x => x.ID).NotInList(IDs));
- var dlg = new MultiSelectDialog<User>(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");
- }
- }
|