Esempio n. 1
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            Program    app        = Program.GetInstance();
            RoomDetail roomDetail = app.GetScreen <RoomDetail>("roomDetail");

            app.ShowScreen(roomDetail);
        }
Esempio n. 2
0
        private void ListItem_Click(object sender, EventArgs e)
        {
            Program     app         = Program.GetInstance();
            RoomService roomService = app.GetService <RoomService>("rooms");

            // Get the clicked item
            ListViewItem item = container.SelectedItems[0];

            if (item == null)
            {
                GuiHelper.ShowError("Error: Geen item geselecteerd");
                return;
            }

            // Find the movie
            int  id   = (int)item.Tag;
            Room room = roomService.GetRoomById(id);

            if (room == null)
            {
                GuiHelper.ShowError("Error: Kon geen zaal vinden voor dit item");
                return;
            }

            // Redirect to screen
            RoomDetail roomDetail = app.GetScreen <RoomDetail>("roomDetail");

            roomDetail.SetRoom(room);
            app.ShowScreen(roomDetail);
        }
Esempio n. 3
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            Program      app          = Program.GetInstance();
            ChairService chairManager = app.GetService <ChairService>("chairs");
            RoomService  roomManager  = app.GetService <RoomService>("rooms");

            // Create bulk update
            BulkUpdate bulkUpdate = new BulkUpdate();

            bulkUpdate.Begin();

            // Save room
            Room room = new Room((int)numberInput.Value);

            if (!roomManager.SaveRoom(room))
            {
                GuiHelper.ShowError(ValidationHelper.GetErrorList(room));
                return;
            }

            // Disable save button
            saveButton.Enabled = false;

            // Create chairs
            int    rows    = (int)rowInput.Value;
            int    columns = (int)columnInput.Value;
            double price   = (double)priceInput.Value;

            for (int i = 1; i <= rows; i++)
            {
                for (int j = 1; j <= columns; j++)
                {
                    Chair chair = new Chair(room.id, i, j, price, "default");

                    if (!chairManager.SaveChair(chair))
                    {
                        GuiHelper.ShowError(ValidationHelper.GetErrorList(room));
                    }
                }
            }

            // End bulk update
            bulkUpdate.End();

            // Enable save button
            saveButton.Enabled = true;

            // Redirect to screen
            RoomDetail roomDetail = app.GetScreen <RoomDetail>("roomDetail");

            roomDetail.SetRoom(room);
            app.ShowScreen(roomDetail);
            GuiHelper.ShowInfo("Zaal succesvol aangemaakt");
        }