Role.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using InABox.Core;
  2. namespace Comal.Classes
  3. {
  4. public class OrgChartSettings<TEntityLink> : BaseObject, IEnclosedEntity
  5. where TEntityLink : IEntityLink, new()
  6. {
  7. public OrgChartSettings()
  8. {
  9. ReportsTo = new TEntityLink();
  10. Color = "#00000000";
  11. Visible = true;
  12. }
  13. [EditorSequence("Org Chart", 1)]
  14. [Caption("Reports To", IncludePath = false)]
  15. public TEntityLink ReportsTo { get; set; }
  16. [EditorSequence("Org Chart", 2)]
  17. [ColorEditor]
  18. [Caption("Color", IncludePath = false)]
  19. public string Color { get; set; }
  20. [EditorSequence("Org Chart", 3)]
  21. [CheckBoxEditor]
  22. [Caption("Visible", IncludePath = false)]
  23. public bool Visible { get; set; }
  24. }
  25. public interface IOrgChart<TEntityLink> where TEntityLink : IEntityLink, new()
  26. {
  27. OrgChartSettings<TEntityLink> OrgChart { get; set; }
  28. }
  29. [UserTracking(typeof(Employee))]
  30. public class Role : Entity, IPersistent, IRemotable, IOrgChart<RoleLink>, ILicense<CoreLicense>, IExportable, IImportable
  31. {
  32. [EditorSequence(1)]
  33. [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
  34. public string Code { get; set; }
  35. [EditorSequence(2)]
  36. [TextBoxEditor]
  37. public string Name { get; set; }
  38. public OrgChartSettings<RoleLink> OrgChart { get; set; }
  39. protected override void Init()
  40. {
  41. base.Init();
  42. OrgChart = new OrgChartSettings<RoleLink>();
  43. }
  44. public override string ToString()
  45. {
  46. return Name;
  47. }
  48. }
  49. }