Example #1
0
 public override void Hide()
 {
     canvas.Children.Clear();
     FrontEndHelper.GetAdminWindow().currentCanvas = null;
     canvas.Visibility = Visibility.Hidden;
     IsInitialized     = false;
 }
Example #2
0
 public override void Show()
 {
     if (!IsInitialized)
     {
         Initialize();
         IsInitialized = true;
     }
     FrontEndHelper.GetAdminWindow().currentCanvas = this;
     canvas.Visibility = Visibility.Visible;
 }
Example #3
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());
        }
Example #4
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());
            }
        }
Example #5
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");
            }
        }