private void button1_Click(object sender, EventArgs e) { Console.WriteLine(comboBox1.SelectedIndex); if (comboBox1.SelectedIndex == 0) { SearchNaturalClient snc = new SearchNaturalClient(); this.Hide(); snc.ShowDialog(); this.Show(); NaturalClient nc = snc.ClientSelected; if (nc != null) { textBox1.Text = nc.Dni; textBox3.Text = nc.Name + " " + nc.Surname; } } else { Console.WriteLine("Searching Legal Client"); SearchLegalClient slc = new SearchLegalClient(); this.Hide(); slc.ShowDialog(); this.Show(); LegalClient lc = slc.SelectedClient; if (lc != null) { textBox1.Text = lc.RUC; textBox3.Text = lc.CompanyName; } } }
private void button1_Click_2(object sender, EventArgs e) { Console.WriteLine(comboBox1.SelectedIndex); if (comboBox1.SelectedIndex == 0) { SearchNaturalClient snc = new SearchNaturalClient(); this.Hide(); snc.ShowDialog(); this.Show(); NaturalClient nc = snc.ClientSelected; if (nc != null) { textBox1.Text = nc.Dni; textBox3.Text = nc.Name + " " + nc.Surname; pointsTextBox.Text = nc.Points.ToString(); nc.IdPerson = naturalClientBL.searchNaturalClient(nc.Dni); idClient = nc.IdPerson; Console.WriteLine("ID del cliente natural: " + nc.IdPerson); } } else { Console.WriteLine("Searching Legal Client"); SearchLegalClient slc = new SearchLegalClient(); this.Hide(); slc.ShowDialog(); this.Show(); LegalClient lc = slc.SelectedClient; if (lc != null) { textBox1.Text = lc.RUC; textBox3.Text = lc.CompanyName; pointsTextBox.Text = lc.Points.ToString(); lc.IdPerson = legalClientBL.searchLegalClient(lc.RUC); idClient = lc.IdPerson; Console.WriteLine("ID del cliente legal: " + lc.IdPerson); } } }