DataEntryTag.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.EntityName().Split('.').Last());
  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. protected override void Init()
  29. {
  30. base.Init();
  31. Name = "";
  32. AppliesTo = "";
  33. }
  34. }
  35. }