예제 #1
0
 public void SetValidityRange(ValidityRange range)
 {
     Require.NotNull(range, "range");
     Require.IsNotIn(State, DraftState.WaitingForApproval, DraftState.Accepted);
     ValidityRange = range;
     CheckCompletion();
 }
예제 #2
0
 public Promotion(ValidityRange validityRange, ReceiveCondition receiveCondition, Benefit benefit)
 {
     Id = Guid.NewGuid();
     ValidityRange = validityRange;
     ReceiveCondition = receiveCondition;
     Benefit = benefit;
 }
예제 #3
0
 public Promotion(ValidityRange validityRange, ReceiveCondition receiveCondition, Benefit benefit)
 {
     Id               = Guid.NewGuid();
     ValidityRange    = validityRange;
     ReceiveCondition = receiveCondition;
     Benefit          = benefit;
 }
예제 #4
0
 private void CheckCompletion()
 {
     IsComplete =
         ValidityRange != null &&
         Benefit != null &&
         ReceiveCondition != null &&
         ValidityRange.IsDefined() &&
         ValidityRange.StartsAfter(DomainTime.Current.Now.AddDays(-1));
 }
예제 #5
0
 public void MarkAsReady()
 {
     Require.NotNull(ValidityRange, "ValidityRange");
     Require.NotNull(Benefit, "Benefit");
     Require.NotNull(ReceiveCondition, "ReceiveCondition");
     Require.IsTrue(() => ValidityRange.IsDefined() && ValidityRange.StartsAfter(DomainTime.Current.Now.AddDays(-1)), "validity range should be in future");
     Require.IsIn(State, DraftState.New, DraftState.FixesRequired);
     State = DraftState.WaitingForApproval;
     DomainEventBus.Current.Raise(new PromotionDraftReady(Id, Owner.Id));
 }
예제 #6
0
 public PromotionDraft(Guid id, string name, Editor owner)
 {
     Require.NotEmpty(name, "name");
     Require.NotNull(owner, "owner");
     Id            = id;
     Name          = name;
     Owner         = owner;
     ValidityRange = ValidityRange.NotSpecified();
     CreationDate  = DomainTime.Current.Now;
 }
 public bool HasAttendedPremiere(Visitor visitor, ValidityRange validityRange, int requiredCount)
 {
     return true;
 }
예제 #8
0
 public void SetValidityRange(ValidityRange range)
 {
     Require.NotNull(range, "range");
     Require.IsNotIn(State, DraftState.WaitingForApproval, DraftState.Accepted);
     ValidityRange = range;
     CheckCompletion();
 }
예제 #9
0
 public bool IsActive()
 {
     return(ValidityRange.Contains(DomainTime.Current.Now));
 }