/// <summary> /// Visita specifica ad un nodo di tipo ICustomizablePrenotation /// </summary> /// <param name="prenotation"></param> public void Visit(ICustomizableServizablePrenotation prenotation) { _prenotationNode.Text = "Prenotazione dal " + prenotation.PrenotationDate.StartDate.ToShortDateString() + " al " + prenotation.PrenotationDate.EndDate.ToShortDateString() + ", prezzo corrente : " + prenotation.Price; foreach (IPacket p in prenotation.Packets) { TreeNode[] nodes = CustomPacket(p as dynamic); _prenotationNode.Add(nodes); } foreach (IBundle b in prenotation.Bundles) { TreeNode[] nodes = CustomBundle(b as dynamic); _prenotationNode.Add(nodes); } }
public void AddPrenotation(ICustomizableServizablePrenotation prenotation) { #region Precondizioni if (prenotation == null) { throw new ArgumentNullException("prenotation null"); } if (!CanAdd(prenotation)) { throw new Exception("prenotation not valid"); } #endregion _prenotations.Add(prenotation); prenotation.PrenotationChanged += (sender, pea) => OnPrenotationChanged(this, pea); OnPrenotationChanged(this, new PrenotationEventArgs(prenotation)); }
public bool CanAdd(ICustomizableServizablePrenotation prenotation) { #region Precondizioni if (prenotation == null) { throw new ArgumentNullException("prenotation null"); } #endregion foreach (ICustomizableItemPrenotation item in prenotation.BookedItems) { if (!CanAdd(item)) { return(false); } } return(true); }