Ejemplo n.º 1
0
 public virtual void Hide()
 {
     canvas.Children.Clear();
     FrontEndHelper.GetMainWindow().CurrentCanvas = null;
     canvas.Visibility = Visibility.Hidden;
     IsInitialized     = false;
 }
        public override void Initialize()
        {
            canvas.Background = new SolidColorBrush(Color.FromRgb(9, 48, 65));

            //load image
            Image logoImage = new Image
            {
                MaxWidth  = 200,
                MaxHeight = 100,
                Source    = new CustomImage("resources/images/logo.png").GetImage().Source,
                Cursor    = Cursors.Hand
            };

            logoImage.Loaded += LogoImage_Loaded;
            logoImage.MouseLeftButtonDown += FrontEndHelper.GetMainWindow().LogoImage_MouseLeftButtonDown;
            canvas.Children.Add(logoImage);

            //load hello label
            Label helloLabel = new Label
            {
                Content    = "Hello " + user.username,
                FontSize   = 22,
                Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)),
                Cursor     = Cursors.Hand,
            };

            helloLabel.MouseLeftButtonDown += FrontEndHelper.GetMainWindow().HelloLabel_MouseLeftButtonDown;
            Canvas.SetRight(helloLabel, 0.05 * canvas.Width);
            Canvas.SetTop(helloLabel, 0.3 * canvas.Height);
            canvas.Children.Add(helloLabel);
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            canvas.Background = new SolidColorBrush(Color.FromRgb(9, 48, 65));

            double buttonWidth  = 120;
            double buttonHeight = 50;
            double buttonSpace  = 25;
            double logoWidth    = 200;
            double logoHeight   = 100;

            Image logoImage = new Image
            {
                MaxWidth  = logoWidth,
                MaxHeight = logoHeight,
                Source    = new CustomImage("resources/images/logo.png").GetImage().Source,
                Cursor    = Cursors.Hand
            };

            logoImage.Loaded += LogoImage_Loaded;
            logoImage.MouseLeftButtonDown += FrontEndHelper.GetMainWindow().LogoImage_MouseLeftButtonDown;
            canvas.Children.Add(logoImage);

            Button signupButton = FrontEndHelper.CreateButton(buttonWidth, buttonHeight, "Sign up");

            Canvas.SetTop(signupButton, buttonSpace);
            Canvas.SetRight(signupButton, 10 + buttonSpace);
            canvas.Children.Add(signupButton);

            Button loginButton = FrontEndHelper.CreateButton(buttonWidth, buttonHeight, "Login");

            Canvas.SetTop(loginButton, buttonSpace);
            Canvas.SetRight(loginButton, buttonWidth + 10 + 2 * buttonSpace);
            canvas.Children.Add(loginButton);
        }
Ejemplo n.º 4
0
 public override void Hide()
 {
     canvas.Children.Clear();
     FrontEndHelper.GetAdminWindow().currentCanvas = null;
     canvas.Visibility = Visibility.Hidden;
     IsInitialized     = false;
 }
        private void UpdateOfferButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            Offer  offer  = (Offer)button.Tag;

            FrontEndHelper.CreateUpdateOfferPopupWindow(offer);
        }
Ejemplo n.º 6
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            Button  button  = (Button)sender;
            Website website = (Website)button.Tag;

            //MessageBox.Show("update " + website.name);
            FrontEndHelper.CreateUpdateWebsitePopupWindow(website);
        }
Ejemplo n.º 7
0
        private void AddMealPlanButton_Click(object sender, RoutedEventArgs e)
        {
            Button        button  = (Button)sender;
            List <object> objects = (List <object>)button.Tag;
            Hotel         hotel   = (Hotel)objects[0];
            ListBox       listBox = (ListBox)objects[1];

            FrontEndHelper.CreateAddMealPlanPopupWindow(hotel, listBox);
        }
Ejemplo n.º 8
0
        private void AddViewbutton_Click(object sender, RoutedEventArgs e)
        {
            Button        addViewButton = (Button)sender;
            List <object> objects       = (List <object>)addViewButton.Tag;
            Room          room          = (Room)objects[0];
            ListBox       viewsList     = (ListBox)objects[1];

            FrontEndHelper.CreateAddRoomViewPopupWindow(room, viewsList);
        }
Ejemplo n.º 9
0
 public override void Show()
 {
     if (!IsInitialized)
     {
         Initialize();
         IsInitialized = true;
     }
     FrontEndHelper.GetAdminWindow().currentCanvas = this;
     canvas.Visibility = Visibility.Visible;
 }
Ejemplo n.º 10
0
 public virtual void Show()
 {
     if (!IsInitialized)
     {
         Initialize();
         IsInitialized = true;
     }
     FrontEndHelper.GetMainWindow().CurrentCanvas = this;
     canvas.Visibility = Visibility.Visible;
 }
Ejemplo n.º 11
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            Button     deleteButton = (Button)sender;
            DataModels database     = DataModels.GetInstance();

            // remove rroom
            //database.deleteRoom();

            Admin_window adminWindow = FrontEndHelper.GetAdminWindow();

            if (adminWindow.currentCanvas != null)
            {
                adminWindow.currentCanvas.Hide();
            }
            adminWindow.InitializeRoomsCanvas(database.GetAllRooms());
        }
Ejemplo n.º 12
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            Button deleteButton = (Button)sender;
            Hotel  hotel        = (Hotel)deleteButton.Tag;

            if (MessageBox.Show($"Are you sure to delete {hotel.name} ?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                //Todo: delete from database
                Admin_window admin_Window = FrontEndHelper.GetAdminWindow();
                if (admin_Window.currentCanvas != null)
                {
                    admin_Window.currentCanvas.Hide();
                }

                admin_Window.InitializeHotelsCanvas(DataModels.GetInstance().GetAllHotels());
            }
        }
Ejemplo n.º 13
0
        private void AddFacilityPhoto_Click(object sender, RoutedEventArgs e)
        {
            Button addPhotoButton = (Button)sender;
            Hotel  hotel          = (Hotel)addPhotoButton.Tag;

            OpenFileDialog dlg = new OpenFileDialog
            {
                Filter = "JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif|PNG Files (*.png)|*.png",
                Title  = "Select Hotel Facility Photo"
            };

            dlg.ShowDialog();

            if (dlg.FileNames.Length == 0)
            {
                MessageBox.Show("Please select photo");
                return;
            }

            List <HotelFacility> facilities = new List <HotelFacility>();

            foreach (string fileName in dlg.FileNames)
            {
                facilities.Add(new HotelFacility(Guid.NewGuid().ToString(), new CustomImage(fileName)));
            }

            if (DataModels.GetInstance().AddFacilities(hotel.licenseNumber, facilities) == true)
            {
                MessageBox.Show("Added");
                Admin_window admin_Window = FrontEndHelper.GetAdminWindow();
                if (admin_Window.currentCanvas != null)
                {
                    admin_Window.currentCanvas.Hide();
                }
                admin_Window.InitializeHotelsCanvas(DataModels.GetInstance().GetAllHotels());
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
Ejemplo n.º 14
0
        private void RefundButton_Click(object sender, RoutedEventArgs e)
        {
            DataModels database = DataModels.GetInstance();
            Button     button   = (Button)sender;
            Booking    booking  = (Booking)button.Tag;
            User       user     = FrontEndHelper.GetMainWindow().ActiveUser;

            if (DateTime.Now > booking.startDate.Subtract(TimeSpan.FromDays(3)))
            {
                MessageBox.Show("This booking is not refundable");
                return;
            }
            if (database.DeleteBooking(booking.number))
            {
                MessageBox.Show("Refunded.");
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
Ejemplo n.º 15
0
        public override void Initialize()
        {
            int    boxSpacing = 50;
            double cardWidth  = canvas.Width - 0.2 * canvas.Width;

            ScrollViewer bookingsScrollViewer = new ScrollViewer
            {
                Height = canvas.Height
            };

            canvas.Children.Add(bookingsScrollViewer);

            StackPanel bookingCardStackPanel = new StackPanel();

            bookingsScrollViewer.Content = bookingCardStackPanel;

            for (int i = 0; i < bookings.Count; i++)
            {
                Booking booking = bookings[i];

                //initialize card
                Border cardBorder = new Border
                {
                    BorderBrush     = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    BorderThickness = new Thickness(3),
                    Width           = cardWidth,
                };
                if (i == bookings.Count - 1)
                {
                    cardBorder.Margin = new Thickness(0.1 * canvas.Width, boxSpacing, 0.1 * canvas.Width, boxSpacing);
                }
                else
                {
                    cardBorder.Margin = new Thickness(0.1 * canvas.Width, boxSpacing, 0.1 * canvas.Width, 0);
                }
                bookingCardStackPanel.Children.Add(cardBorder);

                StackPanel bookingStackPanel = new StackPanel
                {
                    Width = cardWidth
                };
                cardBorder.Child = bookingStackPanel;

                //set username label
                Label userNameLabel = new Label
                {
                    Content  = "User Name : " + booking.bookingUser.name,
                    FontSize = 22,
                    Margin   = new Thickness(0, 15, 0, 0)
                };
                bookingStackPanel.Children.Add(userNameLabel);

                //set bookingnumber label
                Label bookingNumberLabel = new Label
                {
                    Content  = "Booking Number : " + booking.number,
                    FontSize = 22
                };
                bookingStackPanel.Children.Add(bookingNumberLabel);

                //set room number and hotel grid
                Grid dataGrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(cardWidth / 2)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(cardWidth / 2)
                        }
                    },
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = GridLength.Auto
                        },
                        new RowDefinition {
                            Height = GridLength.Auto
                        },
                        new RowDefinition {
                            Height = GridLength.Auto
                        },
                        new RowDefinition {
                            Height = GridLength.Auto
                        }
                    }
                };
                bookingStackPanel.Children.Add(dataGrid);

                Label hotelLabel = new Label
                {
                    Content  = "Hotel : " + booking.bookingRoom.hotel.name,
                    FontSize = 22
                };
                Grid.SetRow(hotelLabel, 0);
                Grid.SetColumn(hotelLabel, 0);
                dataGrid.Children.Add(hotelLabel);

                Label roomLabel = new Label
                {
                    Content  = "Room Number : " + booking.bookingRoom.number,
                    FontSize = 22
                };
                Grid.SetRow(roomLabel, 0);
                Grid.SetColumn(roomLabel, 1);
                dataGrid.Children.Add(roomLabel);

                Label websiteLabel = new Label
                {
                    Content  = "Website : " + booking.bookingWebsite.name,
                    FontSize = 22
                };
                Grid.SetRow(websiteLabel, 1);
                Grid.SetColumn(websiteLabel, 0);
                dataGrid.Children.Add(websiteLabel);

                Label mealPlanLabel = new Label
                {
                    Content  = "Meal Plan : " + booking.bookingMealPlan.name,
                    FontSize = 22
                };
                Grid.SetRow(mealPlanLabel, 1);
                Grid.SetColumn(mealPlanLabel, 1);
                dataGrid.Children.Add(mealPlanLabel);

                Label numberofGuestsLabel = new Label
                {
                    Content  = "Number of Guests : " + booking.numberOfGuests,
                    FontSize = 22
                };
                Grid.SetRow(numberofGuestsLabel, 2);
                Grid.SetColumn(numberofGuestsLabel, 0);
                dataGrid.Children.Add(numberofGuestsLabel);

                Label priceLabel = new Label
                {
                    Content  = "Price : ",
                    FontSize = 22
                };
                Grid.SetRow(priceLabel, 2);
                Grid.SetColumn(priceLabel, 1);
                dataGrid.Children.Add(priceLabel);

                Button reviewButton = FrontEndHelper.CreateButton(0.15 * cardWidth, 50, "Review");
                reviewButton.Margin = new Thickness(0, 15, 0, 15);
                Grid.SetRow(reviewButton, 3);
                Grid.SetColumn(reviewButton, 0);
                dataGrid.Children.Add(reviewButton);

                Button refundButton = FrontEndHelper.CreateButton(0.15 * cardWidth, 50, "Refund");
                refundButton.Margin = new Thickness(0, 15, 0, 15);
                Grid.SetRow(refundButton, 3);
                Grid.SetColumn(refundButton, 1);
                dataGrid.Children.Add(refundButton);
            }
        }
Ejemplo n.º 16
0
 private void AddWebsiteButton_Click(object sender, RoutedEventArgs e)
 {
     FrontEndHelper.CreateAddWebsitePopupWindow();
 }
Ejemplo n.º 17
0
        public override void Initialize()
        {
            selectedLocations = new List <Location>();
            selectedDateRange = null;
            selectedType      = null;

            double itemsSpacing = 150;

            //set canvas background
            canvas.Background = new SolidColorBrush(Color.FromRgb(239, 239, 239));

            //creates room type combobox
            ComboBox roomTypesComboBox = new ComboBox
            {
                Width  = 200,
                Height = 30,
            };
            List <RoomType> roomTypes = DataModels.GetInstance().GetAllRoomTypes();

            roomTypesComboBox.ItemsSource       = roomTypes;
            roomTypesComboBox.SelectionChanged += ComboBox_SelectionChanged;
            if (roomTypes.Count > 0)
            {
                roomTypesComboBox.SelectedIndex = 0;
            }
            Canvas.SetLeft(roomTypesComboBox, 3 * itemsSpacing + 500);
            Canvas.SetTop(roomTypesComboBox, canvas.Height / 4);
            canvas.Children.Add(roomTypesComboBox);

            //creates booking range calendar
            Calendar bookingCalendar = new Calendar
            {
                SelectionMode = CalendarSelectionMode.SingleRange
            };

            selectedDateRange = new CalendarDateRange(DateTime.Today, DateTime.Today);
            bookingCalendar.SelectedDatesChanged += Calander_SelectedDatesChanged;
            Canvas.SetLeft(bookingCalendar, 2 * itemsSpacing + roomTypesComboBox.Width + 40);
            Canvas.SetTop(bookingCalendar, canvas.Height / 4);
            canvas.Children.Add(bookingCalendar);

            //creates locations check boxes
            Expander locationsExpander = new Expander
            {
                Width  = 160,
                Height = 200,
                Header = "Locations"
            };
            ScrollViewer locationsScrollViewer = new ScrollViewer();
            StackPanel   locationsStackPanel   = new StackPanel();

            locationsExpander.Content     = locationsScrollViewer;
            locationsScrollViewer.Content = locationsStackPanel;
            List <Location> locations = DataModels.GetInstance().GetAllLocations();

            foreach (Location location in locations)
            {
                CheckBox locationCheckBox = new CheckBox {
                    Content = location, FontSize = 20
                };
                locationCheckBox.Checked   += CheckBox_Checked;
                locationCheckBox.Unchecked += CheckBox_Unchecked;
                locationsStackPanel.Children.Add(locationCheckBox);
            }
            Canvas.SetLeft(locationsExpander, itemsSpacing);
            Canvas.SetTop(locationsExpander, canvas.Height / 4);
            canvas.Children.Add(locationsExpander);

            Button searchButton = FrontEndHelper.CreateButton(150, 60, "Search");

            searchButton.Click += FrontEndHelper.GetMainWindow().SearchButton_Click;
            Canvas.SetLeft(searchButton, canvas.Width / 2 - 100);
            Canvas.SetBottom(searchButton, canvas.Height / 6);
            canvas.Children.Add(searchButton);
        }
Ejemplo n.º 18
0
 private void Room_Add_Button_Click(object sender, RoutedEventArgs args)
 {
     FrontEndHelper.CreateAddRoomPopupWindow();
 }
Ejemplo n.º 19
0
        public static void CreateUpdateOfferPopupWindow(Offer offer)
        {
            Window popup = new Window
            {
                Width  = 330,
                Height = 400,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Title = "Update Website"
            };

            StackPanel stackPanel = new StackPanel
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                Margin     = new Thickness(10, popup.Height / 4, 10, 10)
            };

            Grid popupGrid = new Grid
            {
                Background        = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            popup.Content = stackPanel;
            stackPanel.Children.Add(popupGrid);

            //
            Label websiteLabel = new Label
            {
                Content  = "website: ",
                FontSize = 17
            };

            Grid.SetColumn(websiteLabel, 0);
            Grid.SetRow(websiteLabel, 0);
            popupGrid.Children.Add(websiteLabel);

            //
            Label websiteNameLabel2 = new Label
            {
                Content  = offer.website.name,
                FontSize = 15
            };

            Grid.SetColumn(websiteNameLabel2, 1);
            Grid.SetRow(websiteNameLabel2, 0);
            popupGrid.Children.Add(websiteNameLabel2);

            //
            Label hotelLabel = new Label
            {
                Content  = "Hotel: ",
                FontSize = 17
            };

            Grid.SetColumn(hotelLabel, 0);
            Grid.SetRow(hotelLabel, 1);
            popupGrid.Children.Add(hotelLabel);

            //
            Label hotelLabel2 = new Label
            {
                Content  = offer.room.hotel.name,
                FontSize = 17
            };

            Grid.SetColumn(hotelLabel2, 1);
            Grid.SetRow(hotelLabel2, 1);
            popupGrid.Children.Add(hotelLabel2);

            //
            Label roomNumberLabel = new Label
            {
                Content  = "Room Number: ",
                FontSize = 17
            };

            Grid.SetColumn(roomNumberLabel, 0);
            Grid.SetRow(roomNumberLabel, 2);
            popupGrid.Children.Add(roomNumberLabel);

            //
            Label roomNumberLabel2 = new Label
            {
                Content  = offer.room.number.ToString(),
                FontSize = 17
            };

            Grid.SetColumn(roomNumberLabel2, 1);
            Grid.SetRow(roomNumberLabel2, 2);
            popupGrid.Children.Add(roomNumberLabel2);

            //
            Label priceLabel = new Label
            {
                Content  = "Price ",
                FontSize = 17
            };

            Grid.SetColumn(priceLabel, 0);
            Grid.SetRow(priceLabel, 3);
            popupGrid.Children.Add(priceLabel);

            //
            TextBox priceTextBox = new TextBox
            {
                Width    = 150,
                Height   = 20,
                FontSize = 15,
                Text     = offer.price.ToString()
            };

            Grid.SetColumn(priceTextBox, 1);
            Grid.SetRow(priceTextBox, 3);
            popupGrid.Children.Add(priceTextBox);


            Button updateOfferConfirmButton = FrontEndHelper.CreateButton(80, 40, "Update");

            updateOfferConfirmButton.Margin = new Thickness(0, 10, 0, 0);

            List <Object> data = new List <Object>();

            data.Add(offer);
            data.Add(priceTextBox);
            updateOfferConfirmButton.Tag = data;

            updateOfferConfirmButton.Click += UpdateOfferConfirmButton_Click;;
            stackPanel.Children.Add(updateOfferConfirmButton);

            popup.Owner = GetAdminWindow();
            popup.ShowDialog();
        }
Ejemplo n.º 20
0
 private void ReviewButton_Click(object sender, RoutedEventArgs e)
 {
     FrontEndHelper.CreateAddReviewPopupWindow((Booking)((Button)sender).Tag);
 }
Ejemplo n.º 21
0
        public override void Initialize()
        {
            userName         = "";
            name             = "";
            email            = "";
            password         = "";
            creditCardSerial = "";
            creditCardCVV    = "";
            expirationDate   = new DateTime();

            double textBoxWidth = 300;
            double labelWdith   = 200;

            StackPanel signupDataStackPanel = new StackPanel
            {
                Margin = new Thickness(0.3 * canvas.Width, 0.05 * canvas.Height, 0, 0)
            };

            canvas.Children.Add(signupDataStackPanel);

            //set user name
            Grid userNameGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } }
            };

            Label userNameLabel = new Label {
                Content = "User Name : ", FontSize = 22
            };

            Grid.SetColumn(userNameLabel, 0);
            userNameGrid.Children.Add(userNameLabel);

            TextBox userNameTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            userNameTextBox.TextChanged += UserNameTextBox_TextChanged;
            Grid.SetColumn(userNameTextBox, 1);
            userNameGrid.Children.Add(userNameTextBox);

            signupDataStackPanel.Children.Add(userNameGrid);

            //set name
            Grid nameGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label nameLabel = new Label {
                Content = "Name : ", FontSize = 22
            };

            Grid.SetColumn(nameLabel, 0);
            nameGrid.Children.Add(nameLabel);

            TextBox nameTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            nameTextBox.TextChanged += NameTextBox_TextChanged;
            Grid.SetColumn(nameTextBox, 1);
            nameGrid.Children.Add(nameTextBox);

            signupDataStackPanel.Children.Add(nameGrid);

            //set email
            Grid emailGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label emailLabel = new Label {
                Content = "Email : ", FontSize = 22
            };

            Grid.SetColumn(emailLabel, 0);
            emailGrid.Children.Add(emailLabel);

            TextBox emailTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            emailTextBox.TextChanged += EmailTextBox_TextChanged;
            Grid.SetColumn(emailTextBox, 1);
            emailGrid.Children.Add(emailTextBox);

            signupDataStackPanel.Children.Add(emailGrid);

            //set password
            Grid passwordGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label passwordLabel = new Label
            {
                Content  = "Password : "******"Credit Card Serial : ", FontSize = 22
            };

            Grid.SetColumn(creditCardSerialLabel, 0);
            creditCardSerialGrid.Children.Add(creditCardSerialLabel);

            TextBox creditCardSerialTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            creditCardSerialTextBox.TextChanged += CreditCardSerialTextBox_TextChanged;
            Grid.SetColumn(creditCardSerialTextBox, 1);
            creditCardSerialGrid.Children.Add(creditCardSerialTextBox);

            signupDataStackPanel.Children.Add(creditCardSerialGrid);

            //set credit card cvv
            Grid creditCardCVVGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label creditCardCVVLabel = new Label {
                Content = "Credit Card CVV : ", FontSize = 22
            };

            Grid.SetColumn(creditCardCVVLabel, 0);
            creditCardCVVGrid.Children.Add(creditCardCVVLabel);

            TextBox creditCardCVVTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            creditCardCVVTextBox.TextChanged += CreditCardCVVTextBox_TextChanged;
            Grid.SetColumn(creditCardCVVTextBox, 1);
            creditCardCVVGrid.Children.Add(creditCardCVVTextBox);

            signupDataStackPanel.Children.Add(creditCardCVVGrid);

            //set credit card expiration date
            Grid creditCardExpirationDateGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label creditCardExpirationDateLabel = new Label {
                Content = "Expiration Date : ", FontSize = 22
            };

            Grid.SetColumn(creditCardExpirationDateLabel, 0);
            creditCardExpirationDateGrid.Children.Add(creditCardExpirationDateLabel);

            DatePicker creditCardExpirationDatePicker = new DatePicker
            {
                Width = textBoxWidth
            };

            creditCardExpirationDatePicker.SelectedDateChanged += CreditCardExpirationDatePicker_SelectedDateChanged;
            Grid.SetColumn(creditCardExpirationDatePicker, 1);
            creditCardExpirationDateGrid.Children.Add(creditCardExpirationDatePicker);

            signupDataStackPanel.Children.Add(creditCardExpirationDateGrid);

            //set signup button
            Button signupButton = FrontEndHelper.CreateButton(0.1 * canvas.Width, 0.075 * canvas.Height, "Signup");

            signupButton.Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0);
            signupButton.Click += FrontEndHelper.GetMainWindow().SignupButtonUserData_Click;
            signupDataStackPanel.Children.Add(signupButton);
        }
Ejemplo n.º 22
0
        public override void Initialize()
        {
            double       cardWidth    = 0.8 * canvas.Width;
            ScrollViewer scrollViewer = new ScrollViewer
            {
                Height = canvas.Height
            };

            canvas.Children.Add(scrollViewer);

            StackPanel hotelCardsStackPanel = new StackPanel
            {
                Width = canvas.Width
            };

            scrollViewer.Content = hotelCardsStackPanel;

            Button addHotelButton = FrontEndHelper.CreateButton(120, 60, "Add Hotel");

            addHotelButton.HorizontalAlignment = HorizontalAlignment.Right;
            addHotelButton.Margin = new Thickness(0, 20, 0.1 * canvas.Width, 0);
            addHotelButton.Click += AddHotelButton_Click;
            hotelCardsStackPanel.Children.Add(addHotelButton);

            for (int i = 0; i < hotels.Count; i++)
            {
                Hotel hotel = hotels[i];

                Border border = new Border
                {
                    Width           = cardWidth,
                    BorderBrush     = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    BorderThickness = new Thickness(3)
                };
                if (i == hotels.Count - 1)
                {
                    border.Margin = new Thickness(0.1 * canvas.Width, 0.1 * canvas.Height, 0.1 * canvas.Width, 25);
                }
                else
                {
                    border.Margin = new Thickness(0.1 * canvas.Width, 0.1 * canvas.Height, 0.1 * canvas.Width, 0);
                }

                hotelCardsStackPanel.Children.Add(border);

                StackPanel cardStackPanel = new StackPanel();
                border.Child = cardStackPanel;

                Grid hotelDataGrid = new Grid
                {
                    Width             = cardWidth,
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        }
                    },
                    Margin = new Thickness(0, 20, 0, 20)
                };
                cardStackPanel.Children.Add(hotelDataGrid);

                Image hotelImaege = new Image
                {
                    Source   = hotel.image.GetImage().Source,
                    MaxWidth = 0.4 * cardWidth,
                    Margin   = new Thickness(0.05 * cardWidth, 0, 0.05 * cardWidth, 0)
                };
                Grid.SetColumn(hotelImaege, 0);
                hotelDataGrid.Children.Add(hotelImaege);

                StackPanel hotelDataStackPanel = new StackPanel
                {
                    Width = 0.5 * cardWidth
                };
                Grid.SetColumn(hotelDataStackPanel, 1);
                hotelDataGrid.Children.Add(hotelDataStackPanel);

                Label hotelName = new Label
                {
                    Content  = "Name : " + hotel.name,
                    FontSize = 22
                };
                hotelDataStackPanel.Children.Add(hotelName);

                Label hotelLicenseNumber = new Label
                {
                    Content  = "License Number : " + hotel.licenseNumber,
                    FontSize = 22
                };
                hotelDataStackPanel.Children.Add(hotelLicenseNumber);

                Label locationLabal = new Label
                {
                    Content  = "Location : " + hotel.location.city + " , " + hotel.location.country,
                    FontSize = 22
                };
                hotelDataStackPanel.Children.Add(locationLabal);

                Grid buttonsGrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                    },
                    Margin = new Thickness(0.2 * cardWidth, 0, 0, 0)
                };
                cardStackPanel.Children.Add(buttonsGrid);

                Button deleteButton = FrontEndHelper.CreateButton(80, 40, "Delete");
                deleteButton.Tag    = hotel;
                deleteButton.Click += DeleteButton_Click;
                Grid.SetColumn(deleteButton, 0);
                buttonsGrid.Children.Add(deleteButton);

                Button updatePhotoButton = FrontEndHelper.CreateButton(180, 40, "Update Hotel Photo");
                updatePhotoButton.Margin = new Thickness(0.025 * cardWidth, 0, 0, 0);
                updatePhotoButton.Tag    = hotel;
                updatePhotoButton.Click += UpdatePhotoButton_Click;
                Grid.SetColumn(updatePhotoButton, 1);
                buttonsGrid.Children.Add(updatePhotoButton);

                Button addFacilityPhoto = FrontEndHelper.CreateButton(180, 40, "Add Facility Photo");
                addFacilityPhoto.Margin = new Thickness(0.025 * cardWidth, 0, 0, 0);
                addFacilityPhoto.Tag    = hotel;
                addFacilityPhoto.Click += AddFacilityPhoto_Click;
                Grid.SetColumn(addFacilityPhoto, 2);
                buttonsGrid.Children.Add(addFacilityPhoto);

                Button addMealPlanButton = FrontEndHelper.CreateButton(160, 40, "Add meal plan");
                addMealPlanButton.Margin = new Thickness(0.025 * cardWidth, 0, 0, 0);
                addMealPlanButton.Tag    = new List <object>();
                ((List <object>)addMealPlanButton.Tag).Add(hotel);
                addMealPlanButton.Click += AddMealPlanButton_Click;
                Grid.SetColumn(addMealPlanButton, 3);
                buttonsGrid.Children.Add(addMealPlanButton);

                //add expander
                Expander moreDataExpander = new Expander
                {
                    Width  = cardWidth,
                    Header = "More Data"
                };
                cardStackPanel.Children.Add(moreDataExpander);

                TabControl moreDataTabs = new TabControl();
                moreDataExpander.Content = moreDataTabs;
                moreDataTabs.Background  = new SolidColorBrush(Color.FromRgb(239, 239, 239));

                //add meals tab
                TabItem MealsTab = new TabItem {
                    Header = "Meals"
                };
                StackPanel MealsPanel = new StackPanel();
                MealsTab.Content = MealsPanel;
                moreDataTabs.Items.Add(MealsTab);

                ListBox mealsPlanListBox = new ListBox
                {
                    Width = cardWidth
                };
                ((List <object>)addMealPlanButton.Tag).Add(mealsPlanListBox);
                MealsPanel.Children.Add(mealsPlanListBox);

                for (int j = 0; j < hotel.mealPlans.Count; j++)
                {
                    MealPlan    mealPlan     = hotel.mealPlans[j];
                    ListBoxItem mealPlanItem = new ListBoxItem
                    {
                        Content  = mealPlan,
                        FontSize = 22,
                    };
                    mealsPlanListBox.Items.Add(mealPlanItem);
                }

                //add hotel facilities
                TabItem hotelFacilitiesPhotosTab = new TabItem {
                    Header = "Photos"
                };
                Canvas hotelPhotosCanvas = new Canvas
                {
                    Width  = cardWidth,
                    Height = 300
                };
                hotelFacilitiesPhotosTab.Content = hotelPhotosCanvas;
                moreDataTabs.Items.Add(hotelFacilitiesPhotosTab);

                List <CustomImage> images = new List <CustomImage>();
                images.Add(hotel.image);
                foreach (HotelFacility facility in hotel.facilities)
                {
                    images.Add(facility.image);
                }
                ImageAlbum hotelAlbum = new ImageAlbum(hotelPhotosCanvas, 25, 25, 250, 250, images);
            }
        }
Ejemplo n.º 23
0
        public override void Initialize()
        {
            int    boxSpacing = 50;
            double cardWidth  = canvas.Width - 0.2 * canvas.Width;
            double cardHeight = 0.7 * canvas.Height;

            canvas.Background = new SolidColorBrush(Color.FromRgb(239, 239, 239));

            ScrollViewer websitesScrollViewer = new ScrollViewer
            {
                Height = canvas.Height
            };

            canvas.Children.Add(websitesScrollViewer);

            StackPanel websitesCardStackPanel = new StackPanel();

            websitesScrollViewer.Content = websitesCardStackPanel;

            Button addWebsiteButton = FrontEndHelper.CreateButton(150, 50, "Add Website");

            addWebsiteButton.Click += AddWebsiteButton_Click;
            addWebsiteButton.Margin = new Thickness(canvas.Width - addWebsiteButton.Width - 100, 6, 0, 0);
            websitesCardStackPanel.Children.Add(addWebsiteButton);

            foreach (Website website in websites)
            {
                Border cardBorder = new Border
                {
                    BorderBrush     = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    BorderThickness = new Thickness(3),
                    Width           = cardWidth,
                    Margin          = new Thickness(0.1 * canvas.Width, boxSpacing, 0.1 * canvas.Width, 0)
                };
                websitesCardStackPanel.Children.Add(cardBorder);
                StackPanel websiteData_SP   = new StackPanel();
                Label      websiteNameLabel = new Label
                {
                    Content  = "Website Link: " + website.name,
                    FontSize = 22,
                };
                websiteData_SP.Children.Add(websiteNameLabel);
                Grid grid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(canvas.Width * 0.6)
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        }
                    }
                };

                Label RatingLabel = new Label
                {
                    Content  = "Website Rating:\t",
                    FontSize = 22,
                };
                for (int i = 0; i < website.rating; i++)
                {
                    RatingLabel.Content += "★";
                }

                Grid.SetColumn(RatingLabel, 0);
                grid.Children.Add(RatingLabel);

                Button updateButton = FrontEndHelper.CreateButton(cardWidth * 0.09, cardHeight * 0.09, "Update");
                updateButton.Tag    = website;
                updateButton.Click += UpdateButton_Click;
                updateButton.Margin = new Thickness(5, 0, 2.5, 3);
                Grid.SetColumn(updateButton, 1);
                grid.Children.Add(updateButton);

                Button deleteButton = FrontEndHelper.CreateButton(cardWidth * 0.09, cardHeight * 0.09, "Delete");
                deleteButton.Tag    = website;
                deleteButton.Click += DeleteButton_Click;
                deleteButton.Margin = new Thickness(2.5, 0, 5, 3);
                Grid.SetColumn(deleteButton, 2);
                grid.Children.Add(deleteButton);

                websiteData_SP.Children.Add(grid);
                cardBorder.Child = websiteData_SP;
            }
        }
Ejemplo n.º 24
0
        public static void createAddOfferPopupWindow()
        {
            DataModels database = DataModels.GetInstance();
            Window     popup    = new Window
            {
                Width  = 330,
                Height = 400,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Title = "Add Offer"
            };

            StackPanel stackPanel = new StackPanel
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                Margin     = new Thickness(10, popup.Height / 4, 10, 10)
            };

            Grid popupGrid = new Grid
            {
                Background        = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },                                            // Website combo
                    new RowDefinition {
                        Height = GridLength.Auto
                    },                                            // Hotel Combo
                    new RowDefinition {
                        Height = GridLength.Auto
                    },                                            // Room # Combo
                    new RowDefinition {
                        Height = GridLength.Auto
                    }                                            // Price TextBox
                }
            };

            popup.Content = stackPanel;
            stackPanel.Children.Add(popupGrid);


            //
            Label websiteLabel = new Label
            {
                Content  = "Website: ",
                FontSize = 17
            };

            Grid.SetColumn(websiteLabel, 0);
            Grid.SetRow(websiteLabel, 0);
            popupGrid.Children.Add(websiteLabel);

            //
            Label hotelLicenceLabel = new Label
            {
                Content  = "Hotel: ",
                FontSize = 17
            };

            Grid.SetColumn(hotelLicenceLabel, 0);
            Grid.SetRow(hotelLicenceLabel, 1);
            popupGrid.Children.Add(hotelLicenceLabel);

            //
            Label roomNumberLabel = new Label
            {
                Content  = "Room number: ",
                FontSize = 17
            };

            Grid.SetColumn(roomNumberLabel, 0);
            Grid.SetRow(roomNumberLabel, 2);
            popupGrid.Children.Add(roomNumberLabel);

            //
            Label offerPriceLabel = new Label
            {
                Content  = "Offer Price: ",
                FontSize = 17
            };

            Grid.SetColumn(offerPriceLabel, 0);
            Grid.SetRow(offerPriceLabel, 3);
            popupGrid.Children.Add(offerPriceLabel);


            //
            ComboBox websiteCombo = new ComboBox
            {
                Width    = 150,
                Height   = 30,
                FontSize = 15
            };

            Grid.SetColumn(websiteCombo, 1);
            Grid.SetRow(websiteCombo, 0);
            websiteCombo.ItemsSource   = database.GetAllWebsites();
            websiteCombo.SelectedIndex = 0;
            popupGrid.Children.Add(websiteCombo);

            //
            ComboBox hotelLicenceCombo = new ComboBox
            {
                Width    = 150,
                Height   = 30,
                FontSize = 15
            };

            Grid.SetColumn(hotelLicenceCombo, 1);
            Grid.SetRow(hotelLicenceCombo, 1);
            hotelLicenceCombo.ItemsSource       = database.GetAllHotels();
            hotelLicenceCombo.SelectedIndex     = 0;
            hotelLicenceCombo.SelectionChanged += HotelLicenceCombo_SelectionChanged;
            popupGrid.Children.Add(hotelLicenceCombo);

            //
            ComboBox roomNumberCombo = new ComboBox
            {
                Width    = 150,
                Height   = 30,
                FontSize = 15
            };

            Grid.SetColumn(roomNumberCombo, 1);
            Grid.SetRow(roomNumberCombo, 2);

            roomNumberCombo.ItemsSource   = database.GetHotelRooms(((Hotel)hotelLicenceCombo.SelectedItem).licenseNumber);
            roomNumberCombo.SelectedIndex = 0;
            popupGrid.Children.Add(roomNumberCombo);
            hotelLicenceCombo.Tag = roomNumberCombo;

            //
            TextBox offerPriceTextBox = new TextBox
            {
                Width    = 150,
                Height   = 20,
                FontSize = 15
            };

            Grid.SetColumn(offerPriceTextBox, 1);
            Grid.SetRow(offerPriceTextBox, 3);
            popupGrid.Children.Add(offerPriceTextBox);

            Button addOfferConfirmButton = FrontEndHelper.CreateButton(80, 40, "Add");

            addOfferConfirmButton.Margin = new Thickness(0, 10, 0, 0);

            List <Object> data = new List <Object>();

            data.Add(websiteCombo);
            data.Add(hotelLicenceCombo);
            data.Add(roomNumberCombo);
            data.Add(offerPriceTextBox);

            addOfferConfirmButton.Tag    = data;
            addOfferConfirmButton.Click += AddOfferConfirmButton_Click;;
            stackPanel.Children.Add(addOfferConfirmButton);

            popup.Owner = GetAdminWindow();
            popup.ShowDialog();
        }
Ejemplo n.º 25
0
        public override void Initialize()
        {
            selectedMealPlan     = new List <MealPlan>(new MealPlan[rooms.Count]);
            selectedWebsitePrice = new List <Tuple <Website, int> >(new Tuple <Website, int> [rooms.Count]);
            int    boxSpacing = 50;
            double cardWidth  = canvas.Width - 0.2 * canvas.Width;
            double cardHeight = 0.7 * canvas.Height;

            canvas.Background = new SolidColorBrush(Color.FromRgb(239, 239, 239));

            ScrollViewer roomScrollViewer = new ScrollViewer
            {
                Height = canvas.Height
            };

            canvas.Children.Add(roomScrollViewer);

            StackPanel roomCardStackPanel = new StackPanel();

            roomScrollViewer.Content = roomCardStackPanel;

            for (int i = 0; i < rooms.Count; i++)
            {
                Room room = rooms[i];

                //creates room card
                Border cardBorder = new Border
                {
                    BorderBrush     = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    BorderThickness = new Thickness(3),
                    Width           = cardWidth,
                    Margin          = new Thickness(0.1 * canvas.Width, boxSpacing, 0.1 * canvas.Width, 0)
                };
                Grid roomGrid = new Grid
                {
                    Width = cardWidth,

                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(0.4 * cardWidth)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(0.6 * cardWidth)
                        }
                    },
                    RowDefinitions =
                    {
                        new RowDefinition {
                            Height = GridLength.Auto
                        },
                        new RowDefinition {
                            Height = GridLength.Auto
                        }
                    }
                };
                cardBorder.Child = roomGrid;
                roomCardStackPanel.Children.Add(cardBorder);

                //set card image
                Image roomImage = room.image.GetImage();
                roomImage.MaxWidth  = 0.35 * cardWidth;
                roomImage.MaxHeight = 0.85 * cardHeight;
                Grid.SetColumn(roomImage, 0);
                Grid.SetRow(roomImage, 0);
                roomGrid.Children.Add(roomImage);

                //set roomdatastackpanel
                StackPanel roomDataStackPanel = new StackPanel
                {
                    Width  = 0.6 * cardWidth,
                    Height = 0.85 * cardHeight,
                };
                Grid.SetColumn(roomDataStackPanel, 1);
                Grid.SetRow(roomDataStackPanel, 0);
                roomGrid.Children.Add(roomDataStackPanel);

                //set room type
                Label roomTypeLabel = new Label
                {
                    Content  = "Room Type: " + room.type.name,
                    FontSize = 22,
                    Margin   = new Thickness(0, 0.2 * cardHeight, 0, 0)
                };
                roomDataStackPanel.Children.Add(roomTypeLabel);

                //set hotel name
                Label roomHotelLabel = new Label
                {
                    Content  = "Hotel: " + room.hotel.name,
                    FontSize = 22,
                    Margin   = new Thickness(0, 0.05 * cardHeight, 0, 0)
                };
                roomDataStackPanel.Children.Add(roomHotelLabel);

                //set room price
                Label roomPriceLabel = new Label
                {
                    Content  = "Price: ",
                    FontSize = 22,
                    Margin   = new Thickness(0, 0.05 * cardHeight, 0, 0)
                };
                roomDataStackPanel.Children.Add(roomPriceLabel);

                //set view more button
                Grid grid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(0.5 * roomDataStackPanel.Width)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(0.5 * roomDataStackPanel.Width)
                        }
                    },
                    Margin = new Thickness(0, 0.05 * cardHeight, 0, 0)
                };

                Label locationLabel = new Label
                {
                    Content  = "Loaction: " + room.hotel.location.city + ", " + room.hotel.location.country,
                    FontSize = 22,
                };
                Grid.SetColumn(locationLabel, 0);
                grid.Children.Add(locationLabel);

                Button viewMoreButton = FrontEndHelper.CreateButton(cardWidth * 0.1, cardHeight * 0.1, "Reserve");

                Grid.SetColumn(viewMoreButton, 1);
                grid.Children.Add(viewMoreButton);
                roomDataStackPanel.Children.Add(grid);

                //creates view more expander
                Expander viewMoreExpander = new Expander
                {
                    Width  = canvas.Width,
                    Margin = new Thickness(0, 0, 0, 0.05 * cardHeight),
                    Header = "More Data"
                };
                Grid.SetColumnSpan(viewMoreExpander, 2);
                Grid.SetRow(viewMoreExpander, 1);
                roomGrid.Children.Add(viewMoreExpander);

                //creates tabs
                TabControl MoreDetailsTabs = new TabControl();
                viewMoreExpander.Content   = MoreDetailsTabs;
                MoreDetailsTabs.Background = new SolidColorBrush(Color.FromRgb(239, 239, 239));

                //creates meals tab
                TabItem MealsTab = new TabItem {
                    Header = "Meals"
                };
                StackPanel MealsPanel = new StackPanel();
                MealsTab.Content = MealsPanel;
                MoreDetailsTabs.Items.Add(MealsTab);

                for (int j = 0; j < room.hotel.mealPlans.Count; j++)
                {
                    MealPlan    mealPlan            = room.hotel.mealPlans[j];
                    RadioButton mealPlanRadioButton = new RadioButton
                    {
                        GroupName = "MealPlanRadioGroup " + i.ToString(),
                        Content   = mealPlan,
                        FontSize  = 22,
                        Margin    = new Thickness(0, 0.025 * cardHeight, 0, 0)
                    };
                    mealPlanRadioButton.Checked += mealRadioButtonChecked;
                    if (j == 0)
                    {
                        mealPlanRadioButton.IsChecked = true;
                    }
                    MealsPanel.Children.Add(mealPlanRadioButton);
                }

                //creates website and prices tab
                TabItem websitesTab = new TabItem {
                    Header = "Websites"
                };
                StackPanel websitesPanel = new StackPanel();
                websitesTab.Content = websitesPanel;
                MoreDetailsTabs.Items.Add(websitesTab);

                List <Tuple <Website, int> > websitePrice = DataModels.GetInstance().GetWebsitePricesForRoom(room);
                for (int j = 0; j < websitePrice.Count; j++)
                {
                    RadioButton websitePriceRadioButton = new RadioButton
                    {
                        GroupName   = "WebsitePriceRadioGroup " + i.ToString(),
                        DataContext = websitePrice[j],
                        Content     = websitePrice[j].Item1.name + " , " + websitePrice[j].Item2.ToString(),
                        FontSize    = 22,
                        Margin      = new Thickness(0, 0.025 * cardHeight, 0, 0)
                    };
                    websitePriceRadioButton.Checked += webstiePriceRadioButtonChecked;
                    if (j == 0)
                    {
                        websitePriceRadioButton.IsChecked = true;
                    }
                    websitesPanel.Children.Add(websitePriceRadioButton);
                }

                //creates room view tab
                TabItem roomViewsTab = new TabItem {
                    Header = "Views"
                };
                StackPanel roomViewsPanel = new StackPanel();
                roomViewsTab.Content = roomViewsPanel;
                MoreDetailsTabs.Items.Add(roomViewsTab);

                foreach (RoomView view in room.views)
                {
                    Label viewLabel = new Label
                    {
                        Content  = view.view,
                        FontSize = 22,
                        Margin   = new Thickness(0, 0.025 * cardHeight, 0, 0)
                    };
                    roomViewsPanel.Children.Add(viewLabel);
                }

                //create room photos
                TabItem hotelPhotosTab = new TabItem {
                    Header = "Photos"
                };
                Canvas hotelPhotosCanvas = new Canvas
                {
                    Width  = cardWidth,
                    Height = 300
                };
                hotelPhotosTab.Content = hotelPhotosCanvas;
                MoreDetailsTabs.Items.Add(hotelPhotosTab);

                List <CustomImage> images = new List <CustomImage>();
                images.Add(room.hotel.image);
                foreach (HotelFacility facility in room.hotel.facilities)
                {
                    images.Add(facility.image);
                }
                foreach (PlaceOfIntrest placeOfIntrest in room.hotel.location.placesOfIntrest)
                {
                    images.Add(placeOfIntrest.image);
                }
                ImageAlbum hotelAlbum = new ImageAlbum(hotelPhotosCanvas, 25, 25, 250, 250, images);

                //creates room reviews
                TabItem roomReviewsTab = new TabItem {
                    Header = "Room Reviews"
                };
                StackPanel roomReviewsStackPanel = new StackPanel();
                roomReviewsTab.Content = roomReviewsStackPanel;
                MoreDetailsTabs.Items.Add(roomReviewsTab);

                List <Booking> roomBookings = DataModels.GetInstance().GetRoomBookings(room);
                for (int j = 0; j < roomBookings.Count; j++)
                {
                    Booking booking = roomBookings[j];
                    Border  roomBookingCardBorder = new Border
                    {
                        Width               = 0.8 * cardWidth,
                        BorderBrush         = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                        BorderThickness     = new Thickness(3),
                        HorizontalAlignment = HorizontalAlignment.Left
                    };
                    if (j == roomBookings.Count - 1)
                    {
                        roomBookingCardBorder.Margin = new Thickness(0.1 * cardWidth, 25, 0.1 * cardWidth, 25);
                    }
                    else
                    {
                        roomBookingCardBorder.Margin = new Thickness(0.1 * cardWidth, 25, 0.1 * cardWidth, 0);
                    }
                    StackPanel roomBookingCardPanel = new StackPanel();
                    roomBookingCardBorder.Child = roomBookingCardPanel;
                    roomReviewsStackPanel.Children.Add(roomBookingCardBorder);

                    Label userNameLabel = new Label
                    {
                        Content  = "User Name : " + booking.bookingUser.username,
                        FontSize = 22
                    };
                    roomBookingCardPanel.Children.Add(userNameLabel);

                    Label ratingLabel = new Label
                    {
                        Content  = "Rating : " + booking.bookingReview.rating,
                        FontSize = 22
                    };
                    roomBookingCardPanel.Children.Add(ratingLabel);

                    Label startDateLabel = new Label
                    {
                        Content  = "From " + booking.startDate.ToShortDateString() + " To " + booking.endDate.ToShortDateString(),
                        FontSize = 22
                    };
                    roomBookingCardPanel.Children.Add(startDateLabel);

                    TextBlock description = new TextBlock
                    {
                        Width        = 0.8 * cardWidth - 5,
                        Text         = "Description : " + booking.bookingReview.description,
                        FontSize     = 22,
                        Margin       = new Thickness(0, 0, 0, 10),
                        TextWrapping = TextWrapping.WrapWithOverflow,
                        Padding      = new Thickness(5, 0, 0, 0)
                    };
                    roomBookingCardPanel.Children.Add(description);
                }
            }
        }
Ejemplo n.º 26
0
        public static void CreateReservePopupWindow(RoomsListShowCanvas roomListShowCanvas, int index)
        {
            DataModels database = DataModels.GetInstance();

            Window popup = new Window
            {
                Width  = 350,
                Height = 500,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Title = "Confirm Booking"
            };

            Grid popupGrid = new Grid
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255))
            };

            popup.Content = popupGrid;

            StackPanel reservePopupStackPanel = new StackPanel
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                Margin     = new Thickness(10, 10, 10, 10)
            };

            popupGrid.Children.Add(reservePopupStackPanel);

            Grid numberofGuestsGrid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                }
            };

            reservePopupStackPanel.Children.Add(numberofGuestsGrid);

            Label numberofGuestsLabel = new Label
            {
                Content  = "Number of Guests : ",
                FontSize = 22
            };

            Grid.SetColumn(numberofGuestsLabel, 0);
            numberofGuestsGrid.Children.Add(numberofGuestsLabel);

            TextBox numberofGuestTextBox = new TextBox
            {
                Width    = 50,
                FontSize = 22
            };

            Grid.SetColumn(numberofGuestTextBox, 1);
            numberofGuestsGrid.Children.Add(numberofGuestTextBox);

            Label mealLabel = new Label
            {
                Content  = "Meal Plan : " + roomListShowCanvas.GetSelectedMealPlan(index).name,
                FontSize = 22,
                Margin   = new Thickness(0, 10, 0, 0)
            };

            reservePopupStackPanel.Children.Add(mealLabel);

            Label websiteLabel = new Label
            {
                Content  = "Website : " + roomListShowCanvas.GetSelectedWebsite(index).name,
                FontSize = 22,
                Margin   = new Thickness(0, 10, 0, 0)
            };

            reservePopupStackPanel.Children.Add(websiteLabel);

            Label priceLabel = new Label
            {
                Content  = "Price : ",
                FontSize = 22,
                Margin   = new Thickness(0, 10, 0, 0)
            };

            reservePopupStackPanel.Children.Add(priceLabel);

            Calendar datePicker = new Calendar
            {
                SelectionMode = CalendarSelectionMode.SingleRange,
                Margin        = new Thickness(0, 10, 0, 0)
            };

            datePicker.SelectedDate     = DateTime.Now;
            datePicker.DisplayDateStart = DateTime.Today;
            List <Booking> bookings = database.GetRoomBookings(roomListShowCanvas.GetSelectedRoom(index));

            foreach (Booking booking in bookings)
            {
                datePicker.BlackoutDates.Add(new CalendarDateRange(booking.startDate, booking.endDate));
            }
            reservePopupStackPanel.Children.Add(datePicker);

            Button confirmReserveButton = FrontEndHelper.CreateButton(80, 40, "Confirm");

            confirmReserveButton.Margin = new Thickness(0, 10, 0, 0);
            confirmReserveButton.Click += ConfirmReserveButton_Click;
            reservePopupStackPanel.Children.Add(confirmReserveButton);
            List <object> data = new List <object>();

            data.Add(datePicker);
            data.Add(numberofGuestTextBox);
            data.Add(roomListShowCanvas);
            data.Add(index);
            confirmReserveButton.Tag = data;

            popup.Owner = GetMainWindow();
            popup.ShowDialog();
        }
Ejemplo n.º 27
0
        public static void CreateAddReviewPopupWindow(Booking booking)
        {
            Window popup = new Window
            {
                Width  = 330,
                Height = 400,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Title = "Add Review"
            };

            StackPanel stackPanel = new StackPanel
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                Margin     = new Thickness(10, popup.Height / 4, 10, 10)
            };

            Grid popupGrid = new Grid
            {
                Background        = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            popup.Content = stackPanel;
            stackPanel.Children.Add(popupGrid);

            //
            Label websiteNameLabel = new Label
            {
                Content  = "your review : ",
                FontSize = 17
            };

            Grid.SetColumn(websiteNameLabel, 0);
            Grid.SetRow(websiteNameLabel, 0);
            popupGrid.Children.Add(websiteNameLabel);

            //
            Label websiteRatingLabel = new Label
            {
                Content  = "Your Rating : ",
                FontSize = 17
            };

            Grid.SetColumn(websiteRatingLabel, 0);
            Grid.SetRow(websiteRatingLabel, 1);
            popupGrid.Children.Add(websiteRatingLabel);

            //
            TextBox reviewTextBox = new TextBox
            {
                Width    = 150,
                Height   = 20,
                FontSize = 15
            };

            Grid.SetColumn(reviewTextBox, 1);
            Grid.SetRow(reviewTextBox, 0);
            popupGrid.Children.Add(reviewTextBox);

            //
            TextBox ratingTextBox = new TextBox
            {
                Width    = 150,
                Height   = 20,
                FontSize = 15
            };

            Grid.SetColumn(ratingTextBox, 1);
            Grid.SetRow(ratingTextBox, 1);
            popupGrid.Children.Add(ratingTextBox);


            Button addReviewConfirmButton = FrontEndHelper.CreateButton(80, 40, "Submit Review");

            addReviewConfirmButton.Margin = new Thickness(0, 10, 0, 0);

            List <Object> data = new List <Object>();

            data.Add(booking);
            data.Add(reviewTextBox);
            data.Add(ratingTextBox);

            addReviewConfirmButton.Tag    = data;
            addReviewConfirmButton.Click += AddReviewConfirmButton_Click;
            stackPanel.Children.Add(addReviewConfirmButton);


            popup.Owner = GetAdminWindow();
            popup.ShowDialog();
        }
Ejemplo n.º 28
0
 private void AddHotelButton_Click(object sender, RoutedEventArgs e)
 {
     FrontEndHelper.CreateAddhotelPopupWindow();
 }
Ejemplo n.º 29
0
        public override void Initialize()
        {
            double cardWidth = 0.8 * canvas.Width;

            ScrollViewer scrollViewer = new ScrollViewer
            {
                Height = canvas.Height
            };

            canvas.Children.Add(scrollViewer);

            StackPanel roomCardsStackPanel = new StackPanel
            {
                Width = canvas.Width
            };

            scrollViewer.Content = roomCardsStackPanel;

            Button AddButton = FrontEndHelper.CreateButton(120, 60, "Add");

            AddButton.Click += Room_Add_Button_Click;
            AddButton.Margin = new Thickness(0.8 * cardWidth, 20, 0, 0);
            roomCardsStackPanel.Children.Add(AddButton);

            for (int i = 0; i < rooms.Count; i++)
            {
                Room room = rooms[i];

                Border border = new Border
                {
                    Width           = cardWidth,
                    BorderBrush     = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    BorderThickness = new Thickness(3),
                };
                if (i == rooms.Count - 1)
                {
                    border.Margin = new Thickness(0.1 * canvas.Width, 0.1 * canvas.Height, 0.1 * canvas.Width, 25);
                }
                else
                {
                    border.Margin = new Thickness(0.1 * canvas.Width, 0.1 * canvas.Height, 0.1 * canvas.Width, 0);
                }
                roomCardsStackPanel.Children.Add(border);

                StackPanel cardStackPanel = new StackPanel
                {
                    Width = cardWidth
                };
                border.Child = cardStackPanel;

                Grid dataGrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = new GridLength(0.5 * cardWidth)
                        },
                        new ColumnDefinition {
                            Width = new GridLength(0.5 * cardWidth)
                        }
                    },
                    Margin = new Thickness(0, 20, 0, 20)
                };
                cardStackPanel.Children.Add(dataGrid);

                Image roomImage = new Image
                {
                    Source = room.image.GetImage().Source
                };
                roomImage.Width = 0.4 * cardWidth;
                Grid.SetColumn(roomImage, 0);
                dataGrid.Children.Add(roomImage);

                StackPanel dataStackPanel = new StackPanel
                {
                    Width = 0.5 * cardWidth
                };
                Grid.SetColumn(dataStackPanel, 1);
                dataGrid.Children.Add(dataStackPanel);

                Label hotelLabel = new Label
                {
                    Content  = "Hotel : " + room.hotel.name,
                    FontSize = 22
                };
                dataStackPanel.Children.Add(hotelLabel);

                Label roomNumberLabel = new Label
                {
                    Content  = "Room Number : " + room.number,
                    FontSize = 22
                };
                dataStackPanel.Children.Add(roomNumberLabel);

                Label roomTypeLabel = new Label
                {
                    Content  = "Room Type : " + room.type.name,
                    FontSize = 22
                };
                dataStackPanel.Children.Add(roomTypeLabel);

                StackPanel viewsStackPanel = new StackPanel
                {
                    Width = cardWidth
                };
                cardStackPanel.Children.Add(viewsStackPanel);

                Grid buttonsGrid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        }
                    }
                };
                cardStackPanel.Children.Add(buttonsGrid);

                Button changePhotoButton = FrontEndHelper.CreateButton(160, 40, "Change Photo");
                changePhotoButton.Click += ChangePhotoButton_Click;
                changePhotoButton.Tag    = room;
                Grid.SetColumn(changePhotoButton, 0);
                changePhotoButton.Margin = new Thickness(0.55 * cardWidth, 0, 0, 0);
                buttonsGrid.Children.Add(changePhotoButton);

                Button deleteButton = FrontEndHelper.CreateButton(80, 40, "Delete");
                deleteButton.Margin = new Thickness(10, 0, 0, 0);
                deleteButton.Tag    = room;
                deleteButton.Click += DeleteButton_Click;
                Grid.SetColumn(deleteButton, 1);
                buttonsGrid.Children.Add(deleteButton);

                Button addViewbutton = FrontEndHelper.CreateButton(90, 40, "Add view");
                addViewbutton.Margin = new Thickness(10, 0, 0, 0);
                addViewbutton.Click += AddViewbutton_Click;
                addViewbutton.Tag    = new List <object>();
                ((List <object>)addViewbutton.Tag).Add(room);
                Grid.SetColumn(addViewbutton, 2);
                buttonsGrid.Children.Add(addViewbutton);

                //todo : delete view button

                Label title = new Label
                {
                    Content             = "Room Views",
                    FontSize            = 22,
                    FontWeight          = FontWeights.Bold,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                cardStackPanel.Children.Add(title);

                ListBox viewsList = new ListBox
                {
                    Width = cardWidth
                };
                ((List <object>)addViewbutton.Tag).Add(viewsList);
                cardStackPanel.Children.Add(viewsList);

                foreach (RoomView view in room.views)
                {
                    ListBoxItem viewListBoxItem = new ListBoxItem
                    {
                        Content  = "View : " + view.view,
                        FontSize = 22
                    };
                    viewsList.Items.Add(viewListBoxItem);
                }
            }
        }
Ejemplo n.º 30
0
        public static void CreateUpdateWebsitePopupWindow(Website website)
        {
            Window popup = new Window
            {
                Width  = 330,
                Height = 400,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Title = "Update Website"
            };

            StackPanel stackPanel = new StackPanel
            {
                Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                Margin     = new Thickness(10, popup.Height / 4, 10, 10)
            };

            Grid popupGrid = new Grid
            {
                Background        = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            popup.Content = stackPanel;
            stackPanel.Children.Add(popupGrid);

            //
            Label websiteNameLabel = new Label
            {
                Content  = "Website Link : ",
                FontSize = 17
            };

            Grid.SetColumn(websiteNameLabel, 0);
            Grid.SetRow(websiteNameLabel, 0);
            popupGrid.Children.Add(websiteNameLabel);

            //
            Label websiteNameLabel2 = new Label
            {
                Content  = website.name,
                FontSize = 15
            };

            Grid.SetColumn(websiteNameLabel2, 1);
            Grid.SetRow(websiteNameLabel2, 0);
            popupGrid.Children.Add(websiteNameLabel2);

            //
            Label websiteRatingLabel = new Label
            {
                Content  = "Website Rating : ",
                FontSize = 17
            };

            Grid.SetColumn(websiteRatingLabel, 0);
            Grid.SetRow(websiteRatingLabel, 1);
            popupGrid.Children.Add(websiteRatingLabel);

            //
            TextBox websiteRatingTextBox = new TextBox
            {
                Width    = 150,
                Height   = 20,
                FontSize = 15,
                Text     = website.rating.ToString()
            };

            Grid.SetColumn(websiteRatingTextBox, 1);
            Grid.SetRow(websiteRatingTextBox, 1);
            popupGrid.Children.Add(websiteRatingTextBox);


            Button updateWebsiteConfirmButton = FrontEndHelper.CreateButton(80, 40, "Update");

            updateWebsiteConfirmButton.Margin = new Thickness(0, 10, 0, 0);

            List <Object> data = new List <Object>();

            data.Add(website);
            data.Add(websiteRatingTextBox);
            updateWebsiteConfirmButton.Tag = data;

            updateWebsiteConfirmButton.Click += UpdateWebsiteConfirmButton_Click;
            stackPanel.Children.Add(updateWebsiteConfirmButton);


            popup.Owner = GetAdminWindow();
            popup.ShowDialog();
        }