DataEntryTag.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using InABox.Core;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using InABox.Clients;
  6. namespace Comal.Classes
  7. {
  8. public class DataEntryTagLookupGenerator : LookupGenerator<object>
  9. {
  10. public DataEntryTagLookupGenerator(object[] items) : base(items)
  11. {
  12. var classes = CoreUtils.Entities
  13. .Where(x => x.IsSubclassOf(typeof(Entity)) && CoreUtils.HasInterface<IDataEntryInstance>(x) && x.GetInterfaces().Contains(typeof(IPersistent)))
  14. .OrderBy(x => x.EntityName().Split('.').Last()).ToArray();
  15. foreach (var entity in classes)
  16. if (ClientFactory.IsSupported(entity))
  17. AddValue(entity.EntityName(), entity.GetCaption());
  18. }
  19. }
  20. public class DataEntryTag : Entity, IDataEntryTag, IRemotable, IPersistent, ILicense<DataEntryLicense>
  21. {
  22. [EditorSequence(1)]
  23. [TextBoxEditor]
  24. public string Name { get; set; } = "";
  25. [EditorSequence(2)]
  26. [ComboLookupEditor(typeof(DataEntryTagLookupGenerator), Visible = Visible.Default)]
  27. public string AppliesTo { get; set; } = "";
  28. }
  29. }