Esempio n. 1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Llenado.cargarCBPais(new Paises(), cbPais);
     Llenado.cargarCBEstado(new Estados(), cbEstado);
     Llenado.cargarCBGrupoCliente(new GrupoClientes(), cbGrupoCliente);
     if (lID == 0)
     {
         btnRegistrar.Visibility = Visibility.Visible;
         Llenado.seleccionarDefaultPais(cbPais);
     }
     else if (lID != 0)
     {
         btnModificar.Visibility = Visibility.Visible;
         TDAService.TDAServiceClient tda = new TDAService.TDAServiceClient();
         var resultado = tda.BuscarClienteID(lID);
         tda.Close();
         foreach (var r in resultado)
         {
             if (r.Tipo == true)
             {
                 rbMoral.IsChecked = true;
             }
             else
             {
                 txtApellidoPaterno.Text = r.Apellido;
                 txtApellidoMaterno.Text = r.Apellido2;
             }
             txtNombre.Text = r.Nombre;
             txtRFC.Text = r.RFC;
             Llenado.seleccionarComboBoxUid(r.Pais.ToString(), cbPais);
             Llenado.seleccionarComboBoxUid(r.Estado.ToString(), cbEstado);
             txtCiudad.Text = r.Ciudad;
             if (r.Localidad != null)
             {
                 txtLocalidad.Text = r.Localidad;
             }
             txtCalle.Text = r.Calle;
             if (r.NumeroExterior != null)
             {
                 txtNumeroExterior.Text = r.NumeroExterior;
             }
             if (r.NumeroInterior != null)
             {
                 txtNumeroInterior.Text = r.NumeroInterior;
             }
             if (r.Colonia != null)
             {
                 txtColonia.Text = r.Colonia;
             }
             txtCP.Text = r.CP.ToString();
             txtTelefono.Text = r.Telefono;
             if (r.Email != null)
             {
                 txtEmail.Text = r.Email;
             }
             if (r.GrupoCliente != null)
             {
                 Llenado.seleccionarComboBoxUid(r.GrupoCliente.ToString(), cbGrupoCliente);
             }
         }
     }
 }