コード例 #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;
 }
コード例 #7
0
 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));
 }