private void Button_Click_1(object sender, RoutedEventArgs e) { try { int value; BankBranch temp = new BankBranch(); try { value = int.Parse(this.bankNumTextBox.Text); value = int.Parse(this.branchNumTextBox.Text); value = int.Parse(this.accountTextBox.Text); temp = CheckBranch(int.Parse(this.bankNumTextBox.Text), int.Parse(this.branchNumTextBox.Text)); unit.owner.bankBranchDetails.bankName = temp.bankName; unit.owner.bankBranchDetails.branchAddress = temp.branchAddress; unit.owner.bankBranchDetails.branchCity = temp.branchCity; } catch (Exception ex) { MessageBox.Show(" הקלט לא תקין--" + ex.Message); return; } int key; key = bl.AddHostUnit(unit); MessageBox.Show("The Hosting Unit has been successfully added and the unit key code is: " + key); new HostingUnitWindow().Show(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }