public string Evaluate(RealtimeStateEvaluationContext context) { string state = context.StaticState; if (state == "Active") { DateTime nowAtSite = DateTime.Now; state = IsReviewRequired(context.NextReviewAt, nowAtSite) ? "InReview" : DeduceRealtimeState(context, nowAtSite); } return(state); }
private string DeduceRealtimeState(RealtimeStateEvaluationContext context, DateTime nowAtSite) { string deducedState = context.StaticState; if (nowAtSite < context.StartDateTime) { deducedState = "AwaitingActivation"; } if (nowAtSite > context.ExpirationDateTime) { deducedState = "Expired"; } else if (nowAtSite > context.EndDateTime) { deducedState = "Revalidate"; } return(deducedState); }