protected override void Init() { base.Init(); /* Cerco un file di configurazione delle structures nel fileSystem, * se lo trovo carico le structures contenute */ /* Structures HardCoded */ Sector sector1 = new Sector(new PriceDescriptor("Settore base", "Descrizione settore base", 0.0), 5, 10); Sector sector2 = new Sector(new PriceDescriptor("Settore vip", "Descrizione settore vip", 2.0), 2, 5); StructureArea area1 = new StructureArea(new BasicDescriptor("Spiaggia", "Descrizione spiaggia")); area1.addSector(sector1); area1.addSector(sector2); sector1 = new Sector(new PriceDescriptor("Settore base", "Descrizione settore base", 1.0), 2, 8); sector2 = new Sector(new PriceDescriptor("Settore idromassaggio", "Descrizione settore idromassaggio", 4.0), 1, 8); StructureArea area2 = new StructureArea(new BasicDescriptor("Piscina", "Descrizione piscina")); area2.addSector(sector1); area2.addSector(sector2); Structure structure = new Structure(new BasicDescriptor("Stabilimento Bologna Via Mario Longhena", "Descrizione stabilimento")); structure.addArea(area1); structure.addArea(area2); _structures.Add(structure); }
public IEnumerable <IBookableItem> Filter(StructureArea area) { #region Precondizioni if (area == null) { throw new ArgumentNullException("area null"); } #endregion return(_bookableItems.Where(item => area.Sectors.Contains(item.Sector)).ToArray()); }
public void AddBookableItemButtonHandler(Object obj, EventArgs e) { using (SelectBookableItemDialog sd = new SelectBookableItemDialog(_range)) { sd.LoadStructures(_sCoord.Structures); if (sd.ShowDialog() == DialogResult.OK) { IBookableItem bookableItem = sd.SelectedItem; if (bookableItem != null) { _itemPrenotation = new CustomizableItemPrenotation(sd.Range, sd.SelectedItem); _addBookableItemButton.Text = "Cambia elemento prenotabile"; _addPluginItemButton.Enabled = true; Sector sector = _itemPrenotation.BaseItem.Sector; Structure structure = null; StructureArea area = null; foreach (Structure s in _sCoord.Structures) { foreach (StructureArea a in s.Areas) { if (a.Sectors.Contains(sector)) { structure = s; area = a; break; } } } _locationLabelValue.Text = structure.ToString() + " - " + area.ToString() + " - " + sector.ToString(); _itemLabelValue.Text = _itemPrenotation.BaseItem.ToString(); _positionLabelValue.Text = _itemPrenotation.BaseItem.Position.ToString(); _rangeLabelValue.Text = _itemPrenotation.RangeData.StartDate.ToShortDateString() + " - " + _itemPrenotation.RangeData.EndDate.ToShortDateString(); _fromDateTimePicker.Enabled = true; _fromDateTimePicker.Value = _itemPrenotation.RangeData.StartDate; _toDateTimePicker.Enabled = true; _toDateTimePicker.Value = _itemPrenotation.RangeData.EndDate; } } else { return; } } }