private void PersonalAreaClick(object sender, RoutedEventArgs e)
        {
            Window HostingUnitPasswordWindow = new HostingUnitPasswordWindow();

            HostingUnitPasswordWindow.ShowDialog();
            if (HostingUnitPasswordWindow.DialogResult == true)
            {
                this.Close();
                Window PersonnalAreaWindow = new PersonnalAreaWindow();
                PersonnalAreaWindow.Show();
            }
        }
        private void exitButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure that you are finished?", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Question);

            switch (result)
            {
            case MessageBoxResult.Yes:
                this.Close();
                break;

            case MessageBoxResult.No:
                Window window = new PersonnalAreaWindow();
                window.Show();
                break;
            }
        }
Ejemplo n.º 3
0
        private void updatehostingunitButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (PoolComboxBox.SelectedItem == null || PublicTransportationComboxBox.SelectedItem == null || JacuzziComboxBox.SelectedItem == null || SmokingComboxBox.SelectedItem == null ||
                    RoomServiceComboxBox.SelectedItem == null || GardenComboxBox.SelectedItem == null || ChildrensAttractionComboxBox.SelectedItem == null || WifiComboxBox.SelectedItem == null ||
                    TvComboxBox.SelectedItem == null || SnackBarComboxBox.SelectedItem == null || sizeTextBox.Text == "" ||
                    floorsTextBox.Text == "" || HostingUnitNameTextBox.Text == "" || collectionclearanceComboBox.SelectedItem == null)
                {
                    throw new NullReferenceException("please fill out all of the fields");
                }
                if (!Regex.IsMatch(this.sizeTextBox.Text.ToString(), @"^\d+$"))
                {
                    throw new InvalidOperationException("invaild size");
                }
                if (!Regex.IsMatch(this.floorsTextBox.Text.ToString(), @"^\d+$"))
                {
                    throw new InvalidOperationException("invaild number of floors");
                }
                unit = (BE.HostingUnit) this.HostingUnitKeyComboBox.SelectedItem;
                var x = (from hostingunit in bl.GetHostingUnitList()
                         where hostingunit.HostingUnitKey == unit.HostingUnitKey
                         select hostingunit).FirstOrDefault();
                unit.HostingUnitName           = this.HostingUnitNameTextBox.Text;
                unit.Owner                     = x.Owner;
                unit.Owner.CollectionClearance = (BE.PaymentClearance)collectionclearanceComboBox.SelectedIndex;
                unit.jacuzzi                   = (BE.Jacuzzi) this.JacuzziComboxBox.SelectedItem;
                unit.pool                 = (BE.Pool) this.PoolComboxBox.SelectedItem;
                unit.snackBar             = (BE.SnackBar) this.SnackBarComboxBox.SelectedItem;
                unit.wifi                 = (BE.Wifi) this.WifiComboxBox.SelectedItem;
                unit.tv                   = (BE.Television) this.TvComboxBox.SelectedItem;
                unit.garden               = (BE.Garden) this.GardenComboxBox.SelectedItem;
                unit.roomService          = (BE.RoomService) this.RoomServiceComboxBox.SelectedItem;
                unit.childrensAttractions = (BE.ChildrensAttractions) this.ChildrensAttractionComboxBox.SelectedItem;
                unit.publicTransportation = (BE.PublicTransportation) this.PublicTransportationComboxBox.SelectedItem;
                unit.smoking              = (BE.Smoking) this.SmokingComboxBox.SelectedItem;
                unit.Size                 = int.Parse(sizeTextBox.Text);
                unit.Floors               = int.Parse(floorsTextBox.Text);
                this.DataContext          = unit;

                bl.UpdateHostingUnit(unit);
                unit = new BE.HostingUnit();
                MessageBoxResult result = MessageBox.Show("Thank You, your unit has been updated. Would you like to update another unit?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Question);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    this.Close();
                    Window UpdateHostingUnitWindow = new UpdateHostingUnitWindow();
                    UpdateHostingUnitWindow.Show();
                    break;

                case MessageBoxResult.No:
                    this.Close();
                    Window window = new PersonnalAreaWindow();
                    window.Show();
                    break;
                }
            }


            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }