Ejemplo n.º 1
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (txtID_Subsistema.Text == "" || txtSubsistema.Text == "")
     {
         errorProvider1.SetError(txtID_Subsistema, "¡Rellenar campo!");
         errorProvider1.SetError(txtSubsistema, "¡Rellenar Campo!");
     }
     else
     {
         try
         {
             //Insertamos los datos
             DBinsert i = new DBinsert();
             i.insertSubsistema(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();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error" + ex.ToString(), "ERROR");
             MainClass.con.Close();
         }
     }
 }
Ejemplo n.º 2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (cbEdificio.Text == "" || cbArea.Text == "" || cbSubsistema.Text == "" || txtDescripcion.Text == "" || txtCantidad.Text == "" || txtCapacidad.Text == "" || txtHorasUso.Text == "" || txtDias.Text == "")
     {
         //Validación de campos
         errorProvider1.SetError(cbEdificio, "¡Rellenar Campo!");
         errorProvider1.SetError(cbArea, "¡Rellenar Campo!");
         errorProvider1.SetError(cbSubsistema, "¡Rellenar Campo!");
         errorProvider1.SetError(txtDescripcion, "¡Rellenar Campo!");
         errorProvider1.SetError(txtCantidad, "¡Rellenar Campo!");
         errorProvider1.SetError(txtCapacidad, "¡Rellenar Campo!");
         errorProvider1.SetError(txtHorasUso, "¡Rellenar Campo!");
         errorProvider1.SetError(txtDias, "¡Rellenar Campo!");
     }
     else
     {
         DBinsert i = new DBinsert();
         i.insertInformacionArea(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();
     }
 }
Ejemplo n.º 3
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (IDareaTxt.Text == "" || nombreAreaTxt.Text == "" || TipoArea.Text == "" || txt_LargoArea.Text == "" || txt_AnchoArea.Text == "" || txtNivel.Text == "" || CantidadPersonas.Text == "" || txtNivel.Text == "")
     {
         //Validación de campos
         errorProvider1.SetError(IDareaTxt, "¡Rellenar Campo!");
         errorProvider1.SetError(nombreAreaTxt, "¡Rellenar Campo!");
         errorProvider1.SetError(TipoArea, "¡Rellenar Campo!");
         errorProvider1.SetError(txt_LargoArea, "¡Rellenar Campo!");
         errorProvider1.SetError(txt_AnchoArea, "¡Rellenar Campo!");
         errorProvider1.SetError(txtNivel, "¡Rellenar Campo!");
         errorProvider1.SetError(CantidadPersonas, "¡Rellenar Campo!");
     }
     else
     {
         //Insertamos datos a la DB
         DBinsert i = new DBinsert();
         i.insertArea(IDareaTxt.Text, nombreAreaTxt.Text, TipoArea.Text, txt_LargoArea.Text, txt_AnchoArea.Text, txt_AreaT.Text, CantidadPersonas.Text, txtNivel.Text);
         //Mostramos los datos en el dataGridView
         r.showArea(dgvArea, IDareaColumn, NombreAreaColumn);
         //Limpiamos campos luego del ingreso de datos
         Limpiar();
     }
 }
Ejemplo n.º 4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //Validacion de los campos para que no queden vacios

            if (txtID_Edificio.Text == "" || txtNombreEdificio.Text == "")
            {
                errorProvider1.SetError(txtID_Edificio, "¡Rellenar Campo!");
                errorProvider1.SetError(txtNombreEdificio, "¡Rellenar Campo!");
            }
            else
            {
                try
                {
                    //Insertamos los datos
                    DBinsert i = new DBinsert();
                    i.insertEdificio(txtID_Edificio.Text, txtNombreEdificio.Text);
                    //Actualizamos datos en el datagrid
                    r.showEdificios(dgvEdificio, ID_edificioGvColumn, NombreEdificioGvColumn);
                    Limpiar();
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
            }
        }