public void SetValidityRange(ValidityRange range) { Require.NotNull(range, "range"); Require.IsNotIn(State, DraftState.WaitingForApproval, DraftState.Accepted); ValidityRange = range; CheckCompletion(); }
public Promotion(ValidityRange validityRange, ReceiveCondition receiveCondition, Benefit benefit) { Id = Guid.NewGuid(); ValidityRange = validityRange; ReceiveCondition = receiveCondition; Benefit = benefit; }
private void CheckCompletion() { IsComplete = ValidityRange != null && Benefit != null && ReceiveCondition != null && ValidityRange.IsDefined() && ValidityRange.StartsAfter(DomainTime.Current.Now.AddDays(-1)); }
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)); }
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; }
public bool IsActive() { return(ValidityRange.Contains(DomainTime.Current.Now)); }