public void SelectedColumnHandler(Object obj, EventArgs e)
        {
            Position      position = new Position(SelectedRow, SelectedColumn);
            IBookableItem item     = _bCoord.GetBookableItem(SelectedSector, position);

            if (item == null)
            {
                _labelItemValue.Text = "";
                _labelItemValue.Tag  = null;
            }
            else
            {
                bool available = _pCoord.IsAvailable(SelectedSector, position, Range);
                if (available)
                {
                    _labelItemValue.Text      = item.ToString();
                    _labelItemValue.ForeColor = Color.Green;
                    _labelItemValue.Tag       = item;
                }
                else
                {
                    _labelItemValue.Text      = item.ToString();
                    _labelItemValue.ForeColor = Color.Red;
                    _labelItemValue.Tag       = null;
                }
            }
        }
Пример #2
0
        public CustomizableItemPrenotation(DateRange rangeData, IBookableItem bookableItem, IDictionary <IItem, IEnumerable <DateRange> > pluginsAssociation) : this(rangeData, bookableItem)
        {
            #region Precondizioni
            if (pluginsAssociation == null)
            {
                throw new ArgumentNullException("pluginsAssociation null");
            }
            #endregion

            _pluginsAssociation = pluginsAssociation;
        }
Пример #3
0
        public void Visit(IBookableItem item)
        {
            if (_bookableNodes.ContainsKey(item))
            {
                return;
            }

            TreeNode node = new TreeNode();

            node.Text = item.BaseItem.FriendlyName + " Settore :" + item.Sector + " Posizione: " + item.Position.Row + "," + item.Position.Column;
            _bookableNodes.Add(item, node);
        }
        private void Populate(TreeNode tnSector, DateRange range)
        {
            Sector sector = tnSector.Tag as Sector;

            for (int i = 1; i <= sector.Rows; i++)
            {
                TreeNode tnRow = new TreeNode("Riga " + i);
                tnRow.Tag = i;
                for (int j = 1; j <= sector.Columns; j++)
                {
                    Position      positionToAdd = new Position(i, j);
                    IBookableItem item          = _bCoordinator.GetBookableItem(sector, positionToAdd);
                    TreeNode      tnBookableItem;

                    if (item == null)
                    {
                        tnBookableItem     = new TreeNode(j + " - nessun elemento");
                        tnBookableItem.Tag = null;
                    }
                    else
                    {
                        string status    = "Occupato";
                        Color  color     = Color.Red;
                        bool   available = _pCoordinator.IsAvailable(sector, positionToAdd, range);
                        if (available)
                        {
                            status = "Libero";
                            color  = Color.Green;
                        }
                        tnBookableItem           = new TreeNode(j + " - " + status + " - " + item.ToString());
                        tnBookableItem.ForeColor = color;
                        tnBookableItem.Tag       = item;
                        foreach (IItem plugin in _iCoordinator.GetAssociableItemOf(item.BaseItem))
                        {
                            TreeNode tnPluginItem = new TreeNode("Plugin - " + plugin.FriendlyName + "(+€" + plugin.DailyPrice + ")");
                            tnPluginItem.ForeColor = color;
                            tnPluginItem.Tag       = plugin;
                            tnBookableItem.Nodes.Add(tnPluginItem);
                        }
                    }

                    tnRow.Nodes.Add(tnBookableItem);
                }
                tnSector.Nodes.Add(tnRow);
            }
        }
Пример #5
0
        public CustomizableItemPrenotation(DateRange rangeData, IBookableItem bookableItem)
        {
            #region Precondizioni
            if (rangeData == null)
            {
                throw new ArgumentNullException("range data null");
            }
            if (bookableItem == null)
            {
                throw new ArgumentNullException("bookable item null");
            }
            #endregion

            _rangeData          = rangeData;
            _baseItem           = bookableItem;
            _pluginsAssociation = new Dictionary <IItem, IEnumerable <DateRange> >();
        }
Пример #6
0
 public void AddBookableItem(IBookableItem bookableItem)
 {
     #region Precondizioni
     if (bookableItem == null)
     {
         throw new ArgumentNullException("bookable item null");
     }
     foreach (IBookableItem item in Filter(bookableItem.Sector))
     {
         if (item.Position.Row == bookableItem.Position.Row &&
             item.Position.Column == bookableItem.Position.Column)
         {
             throw new Exception("position not available");
         }
     }
     #endregion
     (_bookableItems as List <IBookableItem>).Add(bookableItem);
 }
Пример #7
0
 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;
         }
     }
 }
Пример #8
0
        protected override void Init()
        {
            base.Init();

            /* Cerco un file di configurazione delle prenotation nel fileSystem,
             * se lo trovo carico le prenotation contenute
             */

            /* Prenotations HardCoded */
            StructureCoordinator sectorCoord = CoordinatorManager.Instance.CoordinatorOfType <StructureCoordinator>();
            Sector mySector    = sectorCoord.GetSectorIn("Stabilimento Bologna Via Mario Longhena", "Spiaggia", "Settore base");
            Sector mySectorVip = sectorCoord.GetSectorIn("Stabilimento Bologna Via Mario Longhena", "Spiaggia", "Settore vip");

            BookingCoordinator bookCoord         = CoordinatorManager.Instance.CoordinatorOfType <BookingCoordinator>();
            IBookableItem      myBookableItem    = bookCoord.GetBookableItem(mySector, new Position(1, 3));
            IBookableItem      myBookableItemVip = bookCoord.GetBookableItem(mySectorVip, new Position(1, 1));

            DateRange myRange1 = new DateRange(30);
            DateRange myRange2 = new DateRange(new DateTime(2017, 08, 10), new DateTime(2017, 08, 15));

            ICustomizableItemPrenotation myIItemPrenotation1 = new CustomizableItemPrenotation(myRange1, myBookableItem);
            ICustomizableItemPrenotation myIItemPrenotation2 = new CustomizableItemPrenotation(myRange2, myBookableItemVip);

            IItemCoordinator itemCoord = CoordinatorManager.Instance.CoordinatorOfType <IItemCoordinator>();
            IItem            lettino   = itemCoord.GetAssociableItemOf(myBookableItem.BaseItem).First();

            myIItemPrenotation1.AddPlugin(lettino, myRange1);
            myIItemPrenotation1.AddPlugin(lettino, new DateRange(myRange1.StartDate, myRange1.EndDate.AddDays(-2)));

            IItem lettinoVip  = itemCoord.GetAssociableItemOf(myBookableItemVip.BaseItem).First();
            IItem lettinoBase = itemCoord.GetAssociableItemOf(myBookableItemVip.BaseItem).ElementAt(1);

            myIItemPrenotation2.AddPlugin(lettinoVip, myRange2);
            myIItemPrenotation2.AddPlugin(lettinoBase, myRange2);
            myIItemPrenotation2.AddPlugin(lettinoBase, myRange2);
            myIItemPrenotation2.AddPlugin(lettinoBase, myRange2);
            myIItemPrenotation2.AddPlugin(lettinoBase, myRange2);

            List <ICustomizableItemPrenotation> myItems = new List <ICustomizableItemPrenotation>();

            myItems.Add(myIItemPrenotation1);

            List <ICustomizableItemPrenotation> myItems2 = new List <ICustomizableItemPrenotation>();

            myItems2.Add(myIItemPrenotation2);

            ITrackingDeviceCoordinator tdCoord = CoordinatorManager.Instance.CoordinatorOfType <TrackingDeviceCoordinator>();
            ITrackingDevice            myCard  = tdCoord.Next;

            IUserCoordinator userCoord = CoordinatorManager.Instance.CoordinatorOfType <UserCoordinator>();
            ICustomer        client    = userCoord.Customers.Where(c => c.FiscalCode.Equals("CC3")).First();

            CustomizableServizablePrenotation myPrenotation = new CustomizableServizablePrenotation(client, myRange1, myItems, myCard, new AssociationDescriptor(myRange1, "CardBase"));

            tdCoord.LockTrackingDevice(myPrenotation);

            ITrackingDevice myCard2 = tdCoord.Next;
            CustomizableServizablePrenotation myPrenotation2 = new CustomizableServizablePrenotation(client, myRange2, myItems2, myCard2, new AssociationDescriptor(myRange2, "CardBase"));

            tdCoord.LockTrackingDevice(myPrenotation2);

            ServiceCoordinator serviceCoord = CoordinatorManager.Instance.CoordinatorOfType <ServiceCoordinator>();

            myPrenotation.AddPacket(serviceCoord.Packets.ElementAt(0));
            myPrenotation.AddBundle(serviceCoord.Bundles.ElementAt(0));

            _prenotations.Add(myPrenotation);
            _prenotations.Add(myPrenotation2);
        }