Last active
May 17, 2019 11:39
-
-
Save vmandic/3554533db40a1018c5c5d3abbb2b202e to your computer and use it in GitHub Desktop.
meds-processor, part/4, snippet #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MedsProcessor.Common; | |
namespace MedsProcessor.WebAPI.Core | |
{ | |
public class HzzoDataProcessorStatus | |
{ | |
public HzzoDataProcessorStatus( | |
bool wasDataLoaded, | |
ProcessorState processorState, | |
int timesRan) | |
{ | |
this.IsDataLoaded = wasDataLoaded; | |
this.TimesProcessorHasRan = timesRan; | |
this.ProcessorState = processorState; | |
} | |
public HzzoDataProcessorStatus( | |
bool wasDataLoaded, | |
ProcessorState processorState, | |
int timesRan, | |
DateTime? lastRunFinishedOn, | |
TimeSpan? lastRunDuration) : this(wasDataLoaded, processorState, timesRan) | |
{ | |
this.LastRunFinishedOn = lastRunFinishedOn; | |
this.LastRunDuration = lastRunDuration; | |
} | |
public bool IsDataLoaded { get; } | |
public DateTime? LastRunStartedOn => | |
LastRunFinishedOn.HasValue | |
? LastRunFinishedOn.Value.Add(LastRunDuration.Value) | |
: (DateTime?) null; | |
public TimeSpan? LastRunStartedBefore => | |
LastRunFinishedOn.HasValue | |
? DateTime.Now.Subtract(LastRunStartedOn.Value).Duration() | |
: (TimeSpan?) null; | |
public DateTime? LastRunFinishedOn { get; } | |
public TimeSpan? LastRunDuration { get; } | |
public int TimesProcessorHasRan { get; } | |
public ProcessorState ProcessorState { get; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment