/// <remarks>ported from clock_out</remarks> public int ClockOut(TimeXact evnt) { if (!TimeXacts.Any()) { throw new ParseError(ParseError.ParseError_TimelogCheckoutEventWithoutACheckin); } return(ClockOutFromTimeLog(TimeXacts, evnt, Context)); }
/// <remarks>ported from clock_in</remarks> public void ClockIn(TimeXact evnt) { if (TimeXacts.Any(xt => xt.Account == evnt.Account)) { throw new ParseError(ParseError.ParseError_TimelogCannotDoubleCheckinToTheSameAccount); } TimeXacts.Add(evnt); }
public void Close() { if (TimeXacts.Any()) { IEnumerable <Account> accounts = TimeXacts.Select(tx => tx.Account); foreach (Account account in accounts) { Logger.Current.Debug(DebugTimeLog, () => String.Format("Clocking out from account {0}", account.FullName)); Context.Count += ClockOutFromTimeLog(TimeXacts, new TimeXact(null, TimesCommon.Current.CurrentTime, account), Context); } if (TimeXacts.Any()) { throw new InvalidOperationException("assert(time_xacts.empty());"); } } }