| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using InABox.Core;
- namespace Comal.Classes
- {
- public class JobScopeActivity : Entity, IRemotable, IPersistent, IOneToMany<Job>, IOneToMany<JobScope>, ILicense<ProjectManagementLicense>
- {
-
- [NullEditor]
- [EntityRelationship(DeleteAction.Cascade)]
- public JobLink Job { get; set; }
-
- [NullEditor]
- [EntityRelationship(DeleteAction.Cascade)]
- public JobScopeLink Scope { get; set; }
-
- [EditorSequence(1)]
- [EntityRelationship(DeleteAction.SetNull)]
- public AssignmentActivityLink Activity { get; set; }
-
- [EditorSequence(2)]
- [DurationEditor(Summary = Summary.Sum)]
- public TimeSpan Hours { get; set; }
-
- [EditorSequence(3)]
- public double Rate { get; set; }
-
- [EditorSequence(4)]
- [CurrencyEditor(Summary = Summary.Sum, Editable = Editable.Disabled)]
- public double Cost { get; set; }
-
- [EditorSequence(5)]
- public double Markup { get; set; }
-
- [EditorSequence(6)]
- [CurrencyEditor(Summary = Summary.Sum, Editable = Editable.Disabled)]
- public double Sell { get; set; }
- protected override void DoPropertyChanged(string name, object? before, object? after)
- {
- base.DoPropertyChanged(name, before, after);
- if (name.Equals(nameof(Hours)))
- {
- Cost = Rate * ((TimeSpan?)after ?? TimeSpan.Zero).TotalHours;
- Sell = Cost * ((100.0F + Markup)/100.0F);
- }
- else if (name.Equals(nameof(Rate)))
- {
- Cost = Hours.TotalHours * ((double?)after ?? 0.0F);
- Sell = Cost * ((100.0F + Markup)/100.0F);
- }
- else if (name.Equals(nameof(Markup)))
- Sell = Cost * ((100.0F + ((double?)after ?? 0.0F))/100.0F);
- }
- }
- }
|