Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (rbInsertarAdicion.Checked)
     {
         if (txtPrecio.Text.Equals("") || txtProducto.Text.Equals(""))
         {
             MessageBox.Show("Llene todos los campos");
         }
         else
         {
             objAdminP.InsertarAdiciones(nombrePizz, txtProducto.Text, Convert.ToDouble(txtPrecio.Text));
             dgCambiarAdiciones.DataSource = objAdminP.TraerAdicionesId(nombrePizz);
             txtProducto.Text = "";
             txtPrecio.Text   = "";
         }
     }
     else if (rbBorrarAdicion.Checked)
     {
         txtProducto.Text = "";
         txtPrecio.Text   = "";
         int id = Convert.ToInt32(dgCambiarAdiciones.CurrentRow.Cells[0].Value);
         objAdminP.EliminarAdicion(id);
         dgCambiarAdiciones.DataSource = objAdminP.TraerAdicionesId(nombrePizz);
     }
     else if (rbModificarAdicion.Checked)
     {
         if (txtPrecio.Text.Equals("") || txtProducto.Text.Equals(""))
         {
             MessageBox.Show("Llene todos los campos");
         }
         else
         {
             int id = Convert.ToInt32(dgCambiarAdiciones.CurrentRow.Cells[0].Value);
             objAdminP.ActualizarAdicion(id, nombrePizz, txtProducto.Text, Convert.ToDouble(txtPrecio.Text));
             dgCambiarAdiciones.DataSource = objAdminP.TraerAdicionesId(nombrePizz);
             txtProducto.Text = "";
             txtPrecio.Text   = "";
         }
     }
     else
     {
         MessageBox.Show("Ingrese una opción", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }