private void btnSaveBroker_Click(object sender, RoutedEventArgs e) { BusinessLogicLayer.Broker brk = new Broker(); brk.AddBroker(Convert.ToInt16(App.Current.Properties["StlmntBrokerID"]) , txtFirstName.Text, Convert.ToChar(txtMiddleInitial.Text.Substring(0, 1)), txtLastName.Text, txtBrokerage.Text, txtAddress1.Text , txtAddress2.Text, txtAddress3.Text, txtCity.Text, cmbState.SelectedValue.ToString(), txtZip.Text, txtPhone.Text); DataTable dt = new DataTable("Brokers"); brk.FillBrokerDataGrid(ref dt); dgBrokers.ItemsSource = dt.DefaultView; ClearBrokerInputFields(); }
private void btnAddBroker_Click(object sender, RoutedEventArgs e) { BusinessLogicLayer.Broker brk = new Broker(); string firstName = ""; if (!string.IsNullOrEmpty(txtFirstName.Text)) { firstName = txtFirstName.Text; } char middleInitial = ' '; if (!string.IsNullOrEmpty(txtMiddleInitial.Text)) { middleInitial = Convert.ToChar(txtMiddleInitial.Text.Substring(0, 1)); } string lastName = ""; if (!string.IsNullOrEmpty(txtLastName.Text)) { lastName = txtLastName.Text; } string brokerage = ""; if (!string.IsNullOrEmpty(txtBrokerage.Text)) { brokerage = txtBrokerage.Text; } string address1 = ""; if (!string.IsNullOrEmpty(txtAddress1.Text)) { address1 = txtAddress1.Text; } string address2 = ""; if (!string.IsNullOrEmpty(txtAddress2.Text)) { address2 = txtAddress2.Text; } string address3 = ""; if (!string.IsNullOrEmpty(txtAddress3.Text)) { address3 = txtAddress3.Text; } string city = ""; if (!string.IsNullOrEmpty(txtCity.Text)) { city = txtCity.Text; } string zip = ""; if (!string.IsNullOrEmpty(txtCity.Text)) { zip = txtCity.Text; } string phone = ""; if (!string.IsNullOrEmpty(txtPhone.Text)) { phone = txtPhone.Text; } brk.AddBroker(0, firstName, middleInitial, lastName, brokerage, address1, address2, address3 , city, cmbState.SelectedValue.ToString(), zip, phone); DataTable dt = new DataTable("Brokers"); brk.FillBrokerDataGrid(ref dt); dgBrokers.ItemsSource = dt.DefaultView; txtFirstName.Text = ""; txtMiddleInitial.Text = ""; txtLastName.Text = ""; txtBrokerage.Text = ""; txtAddress1.Text = ""; txtAddress2.Text = ""; txtAddress3.Text = ""; txtCity.Text = ""; cmbState.SelectedIndex = 0; txtZip.Text = ""; txtPhone.Text = ""; }