private void cargar_laboratorio() { NG_Laboratorios negocio = new NG_Laboratorios(); DataTable datos = negocio.obtener_laboratorio(id_l); Txt_Nombre.Text = datos.Rows[0]["nombre_lab"].ToString(); Txt_Direccion.Text = datos.Rows[0]["direccion"].ToString(); Txt_Razon_social.Text = datos.Rows[0]["razon_social"].ToString(); }
private void Btn_Guardar_Click(object sender, EventArgs e) { NG_Laboratorios negocio = new NG_Laboratorios(); if (id_l == null) { negocio.guardar_laboratorio(Txt_Nombre.Text.Trim(), Txt_Razon_social.Text.Trim(), Txt_Direccion.Text.Trim()); } else { negocio.modificar_laboratorio(Txt_Nombre.Text.Trim(), Txt_Razon_social.Text.Trim(), Txt_Direccion.Text.Trim(), id_l); } this.Dispose(); }
private void Btn_Eliminar_Click(object sender, EventArgs e) { if (Tbl_Laboratorios.CurrentRow != null) { if (MessageBox.Show("¿Esta seguro de borrar este laboratorio?" , "Importante" , MessageBoxButtons.YesNo , MessageBoxIcon.Question) == DialogResult.Yes) { NG_Laboratorios negocio = new NG_Laboratorios(); negocio.borrar_laboratorio(Tbl_Laboratorios.CurrentRow.Cells["id_lab"].ToString()); } } else { MessageBox.Show("Seleccione primero una fila de la grilla, para modificar" , "Importante", MessageBoxButtons.OK , MessageBoxIcon.Exclamation); } }
private void Btn_Buscar_Click(object sender, EventArgs e) { NG_Laboratorios negocio = new NG_Laboratorios(); DataTable tabla = new DataTable(); tabla = negocio.obtener_datos_tabla(); if (tabla.Rows.Count == 0) { MessageBox.Show("No existe ningun laboratorio"); return; } if (Txt_Nombre.Text != "") { tabla = negocio.obtener_datos_tabla(Txt_Nombre.Text.Trim()); if (tabla.Rows.Count == 0) { MessageBox.Show("No se encontró ningun laboratorio que coincida con \"" + Txt_Nombre.Text.Trim() + "\""); return; } } cargar_grilla(tabla); }