//CARGA DATOS PERSONALES BASICOS public void cargarDatosPersonal(String value, String paramSearch) { if (!value.Equals("")) { main.WorkSpace.IsEnabled = true; tDateNaci.IsEnabled = false;//solo editable por el calendario //btnDateNacimiento.Visibility = Visibility.Hidden; object[] arreglo = new Clases.Personal().findBy(value, paramSearch); List<String> resul = new Clases.Pdf().Leerpaises(); Console.WriteLine(">>>"+arreglo.Length); if (arreglo[0]!=null) { Console.WriteLine("ENTRO"); //Iniciales en mayusculas string nombre = arreglo[1].ToString(); string apellido = arreglo[2].ToString(); string[] nombres = nombre.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries); string[] apellidos = apellido.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries); nombre = apellido = ""; foreach (string x in nombres) { nombre += x.Substring(0, 1).ToUpper() + x.Substring(1, x.Length - 1).ToLower() + " "; } foreach (string x in apellidos) { apellido += x.Substring(0, 1).ToUpper() + x.Substring(1, x.Length - 1).ToLower() + " "; } lName.Content = nombre + apellido; BitmapImage imagenes = new BitmapImage();//Byte[] datas = (byte[])arreglo[0]; imagenes.BeginInit(); MemoryStream stri = new MemoryStream((byte[])arreglo[0], 0, ((byte[])arreglo[0]).Length, false, false); imagenes.StreamSource = stri; imagenes.EndInit(); iPerfil.Source = imagenes; tName.Text = arreglo[1].ToString(); //nombre tSurname.Text = arreglo[2].ToString(); //apellido tRut.Text = arreglo[3].ToString(); //rut tDateNaci.Text = arreglo[4].ToString(); //fecha_nacimiento Tdireccion.Text = arreglo[5].ToString(); // direccion Regi.Items.Clear(); Comu.Items.Clear(); cSalud.Items.Clear(); cDepto.Items.Clear(); cAfp.Items.Clear(); tBank.Items.Clear(); int i = 0; int c = 0; foreach (Salud salud in new Salud().findAll()) { cSalud.Items.Add(salud.name_salud); if (salud.name_salud.Equals(arreglo[7].ToString())) cSalud.SelectedIndex = i; //salud i++; } i = 0; foreach (Departamento dpto in new Departamento().findAll()) { cDepto.Items.Add(dpto.name); if (dpto.name.Equals(arreglo[8].ToString())) cDepto.SelectedIndex = i; //dpto i++; } i = 0; foreach (Afp afp in new Afp().findAll()) { cAfp.Items.Add(afp.nombre_afp); if (afp.nombre_afp.Equals(arreglo[9].ToString())) cAfp.SelectedIndex = i; //afp i++; } i = 0; foreach (Regiones region in new Regiones().findAll()) { Regi.Items.Add(region.nombre); //El region.id_region habia que pasarlo a string ;) if (region.id_region.ToString().Equals(arreglo[11].ToString())) //region_residencia { Regi.SelectedIndex = i; foreach (Comunas comuna in new Comunas().FindByidReg(region.id_region)) { Comu.Items.Add(comuna.nombre_comuna); if (comuna.id_comuna.ToString().Equals(arreglo[6].ToString())) Comu.SelectedIndex = c; //comuna c++;//busqueda de comuna }//fin buscar comuna } i++;//busqueda de region }//fin buscar region tYear.Text = arreglo[10].ToString(); //edad tPhone.Text = arreglo[12].ToString(); //telefono tEmail.Text = arreglo[13].ToString(); //email i = 0; foreach (String paises in resul) { tNacionalidad.Items.Add(paises); if (paises.Equals(arreglo[14].ToString())) tNacionalidad.SelectedIndex = i; //nombre_banco i++; } tCtaBancaria.Text = arreglo[15].ToString(); // cta_bancaria i = 0; foreach (Banco banco in new Banco().findAll()) { tBank.Items.Add(banco.nombre); if (banco.nombre.Equals(arreglo[16].ToString())) tBank.SelectedIndex = i; //nombre_banco i++; } i = 0; } else main.WorkSpace.IsEnabled = false; loadDataContract(this.tRut.Text.Trim()); llenaaHorario(this.tRut.Text.Trim()); } }
//CARGA DATOS PERSONALES BASICOS public void cargarDatosPersonal(String value, String paramSearch) { if (!value.Equals("")) { main.WorkSpace.IsEnabled = true; tDateNaci.IsEnabled = false;//solo editable por el calendario //btnDateNacimiento.Visibility = Visibility.Hidden; object[] arreglo = new Clases.Personal().findBy(value, paramSearch); List <String> resul = new Clases.Pdf().Leerpaises(); Console.WriteLine(">>>" + arreglo.Length); if (arreglo[0] != null) { Console.WriteLine("ENTRO"); //Iniciales en mayusculas string nombre = arreglo[1].ToString(); string apellido = arreglo[2].ToString(); string[] nombres = nombre.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries); string[] apellidos = apellido.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries); nombre = apellido = ""; foreach (string x in nombres) { nombre += x.Substring(0, 1).ToUpper() + x.Substring(1, x.Length - 1).ToLower() + " "; } foreach (string x in apellidos) { apellido += x.Substring(0, 1).ToUpper() + x.Substring(1, x.Length - 1).ToLower() + " "; } lName.Content = nombre + apellido; BitmapImage imagenes = new BitmapImage();//Byte[] datas = (byte[])arreglo[0]; imagenes.BeginInit(); MemoryStream stri = new MemoryStream((byte[])arreglo[0], 0, ((byte[])arreglo[0]).Length, false, false); imagenes.StreamSource = stri; imagenes.EndInit(); iPerfil.Source = imagenes; tName.Text = arreglo[1].ToString(); //nombre tSurname.Text = arreglo[2].ToString(); //apellido tRut.Text = arreglo[3].ToString(); //rut tDateNaci.Text = arreglo[4].ToString(); //fecha_nacimiento Tdireccion.Text = arreglo[5].ToString(); // direccion Regi.Items.Clear(); Comu.Items.Clear(); cSalud.Items.Clear(); cDepto.Items.Clear(); cAfp.Items.Clear(); tBank.Items.Clear(); int i = 0; int c = 0; foreach (Salud salud in new Salud().findAll()) { cSalud.Items.Add(salud.name_salud); if (salud.name_salud.Equals(arreglo[7].ToString())) { cSalud.SelectedIndex = i; //salud } i++; } i = 0; foreach (Departamento dpto in new Departamento().findAll()) { cDepto.Items.Add(dpto.name); if (dpto.name.Equals(arreglo[8].ToString())) { cDepto.SelectedIndex = i; //dpto } i++; } i = 0; foreach (Afp afp in new Afp().findAll()) { cAfp.Items.Add(afp.nombre_afp); if (afp.nombre_afp.Equals(arreglo[9].ToString())) { cAfp.SelectedIndex = i; //afp } i++; } i = 0; foreach (Regiones region in new Regiones().findAll()) { Regi.Items.Add(region.nombre); //El region.id_region habia que pasarlo a string ;) if (region.id_region.ToString().Equals(arreglo[11].ToString())) //region_residencia { Regi.SelectedIndex = i; foreach (Comunas comuna in new Comunas().FindByidReg(region.id_region)) { Comu.Items.Add(comuna.nombre_comuna); if (comuna.id_comuna.ToString().Equals(arreglo[6].ToString())) { Comu.SelectedIndex = c; //comuna } c++; //busqueda de comuna }//fin buscar comuna } i++; //busqueda de region }//fin buscar region tYear.Text = arreglo[10].ToString(); //edad tPhone.Text = arreglo[12].ToString(); //telefono tEmail.Text = arreglo[13].ToString(); //email i = 0; foreach (String paises in resul) { tNacionalidad.Items.Add(paises); if (paises.Equals(arreglo[14].ToString())) { tNacionalidad.SelectedIndex = i; //nombre_banco } i++; } tCtaBancaria.Text = arreglo[15].ToString(); // cta_bancaria i = 0; foreach (Banco banco in new Banco().findAll()) { tBank.Items.Add(banco.nombre); if (banco.nombre.Equals(arreglo[16].ToString())) { tBank.SelectedIndex = i; //nombre_banco } i++; } i = 0; } else { main.WorkSpace.IsEnabled = false; } loadDataContract(this.tRut.Text.Trim()); llenaaHorario(this.tRut.Text.Trim()); } }