public void Insert(IPAModel ipa) { lock (reserveLock) { IPA_Pool.Add(ipa); } }
public bool Exists(IPAModel ipa) { if (ipa != null) { var count = GetAll().Where(x => x.ServiceSupplyId == ipa.ServiceSupplyId && x.StartDateTime == ipa.StartDateTime).ToList().Count; if (count >= 1) { return(true); } } return(false); }
/// <summary> /// insert an inprogress appointment into redis client pool /// </summary> /// <param name="ipa">InProgress Appointment</param> public void Insert(IPAModel ipa) { if (Exists(ipa)) { throw new Exception(Messages.TurnIsInProgressNow); } if (ipa.StartDateTime >= ipa.EndDateTime) { throw new Exception(Messages.EmptyTimePeriodNotValid); } if (ipa.StartDateTime <= DateTime.Now) { throw new Exception(Messages.TurnTimePassed); } try { lock (insertIPALock) { if (Exists(ipa)) { throw new Exception(Messages.TurnIsInProgressNow); } if (ipa.StartDateTime >= ipa.EndDateTime) { throw new Exception(Messages.EmptyTimePeriodNotValid); } if (ipa.StartDateTime <= DateTime.Now) { throw new Exception(Messages.TurnTimePassed); } _ipaPoolSingleton.Insert(ipa); } } catch (Exception) { throw; } }
public void Remove(IPAModel ipa) { IPA_Pool.Remove(ipa); }