private void btn_Buscar_Click(object sender, EventArgs e) { if (this.txt_Dni.Text == "") { MessageBox.Show("El DNI está vacío \n Ingrese un valor para buscar..", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } else { int num = int.Parse(txt_Dni.Text.Trim()); hu.ID_Tipo_Documento = int.Parse(cbo_tipoDocumento.SelectedValue.ToString()); tabla = this.hu.Buscar_por_NumeroDNI(num); if (tabla.Rows.Count == 0) { MessageBox.Show("No se ha encontrado ningún Huesped con ese Dni ", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); this.blanquear_objetos(); return; } this.txt_Id_TipoDocumento.Text = tabla.Rows[0]["id_tipoDoc"].ToString(); this.txt_Dni.Text = tabla.Rows[0]["num_doc"].ToString(); this.txt_Nombre.Text = tabla.Rows[0]["nombre_huesped"].ToString(); this.txt_Apellido.Text = tabla.Rows[0]["apellido_huesped"].ToString(); this.txt_numTarjeta.Text = tabla.Rows[0]["num_tarjeta"].ToString(); //LASOLUCION MAGICA FUE ESTA //ahora hace una consulta buscando por el id que esta en el txt int id = int.Parse(txt_Id_TipoDocumento.Text); //convierto a int DataTable tablaTipo = new DataTable(); tablaTipo = td.Buscar_tipoDocumento_X_Id(id); //realiza la consulta this.cbo_tipoDocumento.Text = tablaTipo.Rows[0]["desc_tipo_servicio"].ToString(); this.btn_Buscar_Logo.Enabled = false; this.btn_Limpiar.Enabled = true; this.btn_Actualizar.Enabled = true; this.btn_Eliminar.Enabled = true; this.btn_Guardar.Enabled = false; this.blanquear_objetos(); //if (this.btn_Buscar_Logo.Visible == true) //{ // this.txt_Descripcion.Enabled = false; // this.txt_IdServicio.Enabled = false; // this.btn_Buscar_Logo.Visible= false; //} } }
private void btn_Buscar_Click(object sender, EventArgs e) { if (this.txt_Id_Tipo.Text == "") { MessageBox.Show("El id está vacío \n Ingrese un valor para buscar..", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } else { int id = int.Parse(txt_Id_Tipo.Text); tabla = tipo.Buscar_tipoDocumento_X_Id(id); if (tabla.Rows.Count == 0) { MessageBox.Show("No se ha encontrado ningún tipo de Documento con ese Id", "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); this.blanquear_objetos(); return; } txt_Id_Tipo.Text = tabla.Rows[0]["id_tipoD"].ToString(); txt_TipoDocumento.Text = tabla.Rows[0]["descripcion_tipoDoc"].ToString(); this.btn_Buscar_Logo.Enabled = false; this.btn_Limpiar.Enabled = true; this.btn_Actualizar.Enabled = true; this.btn_Eliminar.Enabled = true; this.btn_Guardar.Enabled = false; txt_Id_Tipo.Focus(); } }