Example #1
0
        private void DeleteHostingUnitButton_Click(object sender, RoutedEventArgs e)
        {
            Window DeleteHostingUnitWindow = new DeleteHostingUnitWindow();

            DeleteHostingUnitWindow.Show();
            this.Close();
        }
        private void deleteHostingUnitButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (hostingunitComboBox.SelectedItem == null)
                {
                    throw new NullReferenceException("please select hosting unit to delete");
                }
                unit = this.hostingunitComboBox.SelectedValue as BE.HostingUnit;

                this.DataContext = unit;
                bl.DeleteHostingUnit(unit);
                unit = new BE.HostingUnit();

                MessageBoxResult result = MessageBox.Show("Your Hosting Unit has been deleted. Would you like to delete another hosting unit?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Question);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    this.Close();
                    Window DeleteHostingUnitWindow = new DeleteHostingUnitWindow();
                    DeleteHostingUnitWindow.Show();
                    break;

                case MessageBoxResult.No:
                    this.Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }