예제 #1
0
 private void InsertarPaquete()
 {
     try
     {
         foreach (DataGridViewRow dr in dgvPaquetes.Rows)
         {
             Paquete pa = new Paquete();
             pa.IDProducto       = p.ID;
             pa.Precio           = (decimal)dr.Cells[1].Value;
             pa.CantidadPaquetes = (int)dr.Cells[2].Value;
             if (!(bool)dr.Cells[3].Value)
             {
                 pa.Insertar();
             }
             else if ((bool)dr.Cells[4].Value)
             {
                 pa.ID = (int)dr.Cells[0].Value;
                 pa.Editar();
             }
         }
     }
     catch (MySqlException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }