public void AddPacket(IPacket packet, DateTime date)
 {
     #region Precondizioni
     if (packet == null)
     {
         throw new ArgumentNullException("tracking device null");
     }
     if (!CanAdd(packet))
     {
         new Exception("packet not valid");
     }
     if (!PrenotationDate.Contains(date))
     {
         new Exception("prenotation not available in this date");
     }
     #endregion
     _packetsPurchases.Add(new PacketPurchase(date, packet));
     OnPrenotatitionChangedHandler(this, new PrenotationEventArgs(this));
 }
 public void AddTrackingDevice(ITrackingDevice trackingDevice, AssociationDescriptor associationDescriptor)
 {
     #region Precondizioni
     if (trackingDevice == null)
     {
         throw new ArgumentNullException("tracking device null");
     }
     if (associationDescriptor == null)
     {
         throw new ArgumentNullException("association Descriptor null");
     }
     if (!PrenotationDate.Contains(associationDescriptor.DateRange))
     {
         throw new Exception("date range not valid");
     }
     #endregion
     _tdAssociations.Add(trackingDevice, associationDescriptor);
     OnPrenotatitionChangedHandler(this, new PrenotationEventArgs(this));
 }
 private bool CanAdd(IItemPrenotation IItemPrenotation)
 {
     return(PrenotationDate.Contains(IItemPrenotation.RangeData));
 }
 private bool IsIstantiable(IEnumerable <IItemPrenotation> items)
 {
     return(PrenotationDate.IsComplete((from i in items
                                        select i.RangeData)));
 }