private void updateUnitButton_Click(object sender, RoutedEventArgs e) { Window updateUnitWindow = new updeletebyunit(user); updateUnitWindow.Show(); this.Close(); }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { if (this.UpdatePrivateNameTextBox.Text != "" && this.UpdateKey.Text != "") { MessageBox.Show("please enter only one field, by name or by key."); Window UpdateDeleteByWindow = new updeletebyunit(username); UpdateDeleteByWindow.Show(); this.Close(); } else if (this.UpdatePrivateNameTextBox.Text != "") { try { //sends to a window with a scroll box and then the user updates the gs he wants to update Window UpdateByNameChooseWindow = new updateHostWindow(bl.GetHostingUnitByName(this.UpdatePrivateNameTextBox.Text), username); UpdateByNameChooseWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("units for this host don't exist"); } } else if (this.UpdateKey.Text != "") { try { Window UpdateHostWindow = new updateHostWindow(bl.GetHostingUnitByKey(long.Parse(this.UpdateKey.Text)), username); UpdateHostWindow.Show(); this.Close(); } catch (Exception) { MessageBox.Show("unit with this key does not exist"); } } else { MessageBox.Show("unit does not exist, " + "or you entered info into wrong fields"); } }