private void btnModificar_Click(object sender, EventArgs e) { if (txtID_Area.Text == "") { errorProvider1.SetError(txtID_Area, "¡Seleccione Area a Modificar!"); } else { try { DialogResult dr = MessageBox.Show("Esta seguro que quiere modificiar el registro?", "Modificar", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { DBupdate u = new DBupdate(); u.updateInformacionArea(Item, txtDescripcion.Text, txtCantidad.Text, txtCapacidad.Text, txtHorasUso.Text, txtDias.Text, txtConsumo.Text, cbEdificio.SelectedValue.ToString(), cbArea.SelectedValue.ToString(), cbSubsistema.SelectedValue.ToString()); r.showInformacionArea(dgvInformacionArea, EdificioColumn, AreaColumn, TipoAreaColumn, CantidadPersonasColumn, SubsistemaColumn, ItemColum, DescripcionColumn, CantidadColumn, CapacidadColumn, HorasColumn, DiasColumn, ConsumoColumn, IDedificioColumn, IDareaColumn, IDsubsistemaColumn); Limpiar(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void btnModificar_Click(object sender, EventArgs e) { if (txtID_Subsistema.Text == "") { errorProvider1.SetError(txtID_Subsistema, "¡Seleccione Subsistema a Modificar!"); } else { try { //Actualizamos los datos DBupdate u = new DBupdate(); u.updateSubsistema(txtID_Subsistema.Text, txtSubsistema.Text); //Mostramos el datagrid con los datos actualizados r.showSubsistema(dgvSubsistema, IDsubsistemaColumn, NombreSubsistemaColumn); //Hacemos uso de la función limpiar para dejar los cambos vacíos. Limpiar(); //Habilitamos el textbox que contiene el ID y el boton de guardar txtID_Subsistema.Enabled = true; btnGuardar.Visible = true; } catch (Exception ex) { MessageBox.Show("Error" + ex.ToString(), "ERROR"); MainClass.con.Close(); } } }
/* private string selectIDfromCb() * { * //string ID; * try * { * string edificioname = this.edificioCb.GetItemText(this.edificioCb.SelectedItem); * string sqlcmmnd = "SELECT ID_edificio FROM Edificios WHERE NombreDeEdificio ='" + edificioname + "'"; * SqlCommand cmds = new SqlCommand(sqlcmmnd, MainClass.con); * * MainClass.con.Open(); * cmds.ExecuteNonQuery(); * SqlDataReader reader = cmds.ExecuteReader(); * if (reader.Read()) * { * return reader.GetString(0); * } * MainClass.con.Close(); * * } * catch (Exception ex) * { * MainClass.ShowMSG(ex.Message, "Error...", "Error"); * } * finally * { * MainClass.con.Close(); * } * return null; * }*/ private void btnModificar_Click(object sender, EventArgs e) { if (IDareaTxt.Text == "") { errorProvider1.SetError(IDareaTxt, "¡Seleccione Area a Modificar!"); } else { try { //Actualizamos los datos DBupdate u = new DBupdate(); u.updateArea(IDareaTxt.Text, nombreAreaTxt.Text, TipoArea.Text, txt_LargoArea.Text, txt_AnchoArea.Text, txt_AreaT.Text, CantidadPersonas.Text, txtNivel.Text); //Mostramos el datagrid con los datos actualizados r.showArea(dgvArea, IDareaColumn, NombreAreaColumn); //Hacemos uso de la función limpiar para dejar los cambos vacíos. Limpiar(); //Habilitamos el textbox que contiene el ID y el boton de guardar IDareaTxt.Enabled = true; btnGuardar.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void btnModificar_Click(object sender, EventArgs e) { if (txtID_Edificio.Text == "") { errorProvider1.SetError(txtID_Edificio, "¡Seleccione Edificio a Modificar!"); } else { try { DBupdate u = new DBupdate(); //Actualizamos los datos u.updateEdificio(txtID_Edificio.Text, txtNombreEdificio.Text); //Mostramos el datagrid con los datos actualizados. r.showEdificios(dgvEdificio, ID_edificioGvColumn, NombreEdificioGvColumn); //Hacemos uso de la función limpiar para dejar los cambos vacíos. Limpiar(); //Habilitamos el textbox que contiene el ID y el boton de guardar. txtID_Edificio.Enabled = true; btnGuardar.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }