private void SetIdleTimeValueFromDates() { if (!DateFinished.HasValue) { DateFinished = DateTime.Now; } IdleTimeValue = DateFinished.Value.Subtract(DateStarted); if (IdleTimeValue.Seconds > 30) { IdleTimeValue = IdleTimeValue.Add(new TimeSpan(0, 1, 0)); } IdleTimeValue = new TimeSpan(IdleTimeValue.Hours, IdleTimeValue.Minutes, 0); }
public override string ToString() { return(DateFinished.HasValue ? $"Date - {DateStarted.ToString("ddd, dd MMM")} - From [ {DateStarted.ToString("HH:mm:ss")} ] To [ {DateFinished.Value.ToString("HH:mm:ss")} ] - Time [ {IdleTimeValue.FormatAsString(false)} ]" : $"Date - {DateStarted.ToString("ddd, dd MMM")} - From [ {DateStarted.ToString("HH:mm:ss")} ] To [ IN PROGRESS ]"); }
public override string ToString() { return(DateFinished.HasValue ? string.Format("Date - {0} - From [ {1} ] To [ {2} ] - Time [ {3} ]", DateStarted.ToString("ddd, dd MMM"), DateStarted.ToString("HH:mm:ss"), DateFinished.Value.ToString("HH:mm:ss"), IdleTimeValue.FormatAsString()) : string.Format("Date - {0} - From [ {1} ] To [ IN PROGRESS ]", DateStarted.ToString("ddd, dd MMM"), DateStarted.ToString("HH:mm:ss"))); }