public IConfirmation ReadyItemToProcessingItem() { if (IsSet) { return(null); } var(key, first) = ReadyElements.FirstOrDefault(); if (first != null) { ReadyElements.Remove(key); Set(first, first.ScopeConfirmation.GetScopeEnd() - first.ScopeConfirmation.GetScopeStart()); } return(first); }
public IConfirmation RevokeJob(Guid confirmationKey) { if (IsSet && Current.Key.Equals(confirmationKey)) { var rev = Current; Reset(); return(rev); } var(key, revoked) = ReadyElements.FirstOrDefault(x => x.Value.Key.Equals(confirmationKey)); if (revoked == null) { return(null); } ReadyElements.Remove(key); return(revoked); }
/// <summary> /// returns true if the update was successful /// </summary> /// <param name="jobConfirmation"></param> /// <returns></returns> public bool UpdateJob(IConfirmation jobConfirmation) { if (IsSet && Current.Key.Equals(jobConfirmation.Key)) { Current = Current.UpdateJob(jobConfirmation.Job); //ExpectedResourceIsBusyUntil = jobConfirmation.ScopeConfirmation.GetScopeEnd(); return(true); } var(key, ready) = ReadyElements.FirstOrDefault(x => x.Value.Key.Equals(jobConfirmation.Key)); if (ready == null) { return(false); } ReadyElements.Remove(key); ReadyElements.Add(key, ready.UpdateJob(jobConfirmation.Job)); return(true); }
public void Add(IConfirmation confirmation) { ReadyElements.Add(confirmation.ScopeConfirmation.GetScopeStart(), confirmation); }