JobRetention.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using InABox.Core;
  4. namespace Comal.Classes
  5. {
  6. public class JobRetentionType : Entity, IRemotable, IPersistent, ILicense<ProjectManagementLicense>, ISequenceable
  7. {
  8. [TextBoxEditor]
  9. [EditorSequence(1)]
  10. public string Description { get; set; }
  11. [DoubleEditor]
  12. [EditorSequence(2)]
  13. public double Rate { get; set; }
  14. [DoubleEditor]
  15. [EditorSequence(3)]
  16. public double Maximum { get; set; }
  17. [DoubleEditor]
  18. [EditorSequence(4)]
  19. public double Completion { get; set; }
  20. [IntegerEditor]
  21. [EditorSequence(5)]
  22. public int Release { get; set; }
  23. [CheckBoxEditor]
  24. [EditorSequence(6)]
  25. public bool IncludeVariations { get; set; }
  26. [NullEditor]
  27. public long Sequence { get; set; }
  28. }
  29. public class JobRetentionTypeLink : EntityLink<JobRetentionType>
  30. {
  31. [LookupEditor(typeof(JobRetentionType))]
  32. public override Guid ID { get; set; }
  33. [TextBoxEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
  34. [EditorSequence(1)]
  35. public string Description { get; set; }
  36. [DoubleEditor(Visible = Visible.Hidden, Editable = Editable.Hidden)]
  37. [EditorSequence(2)]
  38. public double Rate { get; set; }
  39. [DoubleEditor(Visible = Visible.Hidden, Editable = Editable.Hidden)]
  40. [EditorSequence(3)]
  41. public double Maximum { get; set; }
  42. [DoubleEditor(Visible = Visible.Hidden, Editable = Editable.Hidden)]
  43. [EditorSequence(4)]
  44. public double Completion { get; set; }
  45. [IntegerEditor(Visible = Visible.Hidden, Editable = Editable.Hidden)]
  46. [EditorSequence(5)]
  47. public int Release { get; set; }
  48. [CheckBoxEditor(Visible = Visible.Hidden, Editable = Editable.Hidden)]
  49. [EditorSequence(6)]
  50. public bool IncludeVariations { get; set; }
  51. }
  52. public class JobRetentionTypeLookups : ILookupDefinition<JobRetentionType>
  53. {
  54. public SortOrder<JobRetentionType>? DefineSortOrder()
  55. {
  56. return new SortOrder<JobRetentionType>(x => x.Sequence);
  57. }
  58. public Filter<JobRetentionType>? DefineFilter()
  59. {
  60. return null;
  61. }
  62. public Columns<JobRetentionType> DefineColumns()
  63. {
  64. return Columns.All<JobRetentionType>();
  65. }
  66. public Columns<JobRetentionType> RequiredColumns()
  67. {
  68. return Columns.All<JobRetentionType>();
  69. }
  70. public string FormatLookup(Dictionary<string, object?> values, IEnumerable<string> exclude)
  71. {
  72. return $"{values["Description"]}";
  73. }
  74. }
  75. public class JobRetention : EnclosedEntity
  76. {
  77. [EditorSequence(1)] public JobRetentionTypeLink Type { get; set; }
  78. [DoubleEditor]
  79. [EditorSequence(2)]
  80. public double Rate { get; set; }
  81. [DoubleEditor]
  82. [EditorSequence(3)]
  83. public double Maximum { get; set; }
  84. [DoubleEditor]
  85. [EditorSequence(4)]
  86. public double Completion { get; set; }
  87. [IntegerEditor]
  88. [EditorSequence(5)]
  89. public int Release { get; set; }
  90. [CheckBoxEditor]
  91. [EditorSequence(6)]
  92. public bool IncludeVariations { get; set; }
  93. static JobRetention()
  94. {
  95. LinkedProperties.Register<JobRetention, JobRetentionTypeLink, double>(x => x.Type, x => x.Rate, x => x.Rate);
  96. LinkedProperties.Register<JobRetention, JobRetentionTypeLink, double>(x => x.Type, x => x.Maximum, x => x.Maximum);
  97. LinkedProperties.Register<JobRetention, JobRetentionTypeLink, double>(x => x.Type, x => x.Completion, x => x.Completion);
  98. LinkedProperties.Register<JobRetention, JobRetentionTypeLink, int>(x => x.Type, x => x.Release, x => x.Release);
  99. LinkedProperties.Register<JobRetention, JobRetentionTypeLink, bool>(x => x.Type, x => x.IncludeVariations, x => x.IncludeVariations);
  100. }
  101. }
  102. }