Esempio n. 1
0
 protected void dgvInsumos_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         InsumoNegocio InsumoNeg = new InsumoNegocio();
         long          id        = Convert.ToInt64(dgvInsumos.DataKeys[e.RowIndex].Value.ToString());
         if (InsumoNeg.ContarRegistros(Convert.ToInt32(id)) == true)
         {
             lblCorrecto.Visible = true;
             lblCorrecto.Text    = "NO SE PUEDE ELIMINAR EL INSUMO. TIENE PRODUCTOS ASIGNADOS. ";
             lblIncorrecto.Text  = "";
         }
         else
         {
             InsumoNeg.ModificarEstado(id);
             lblCorrecto.Text   = "Elminado correctamente.";
             lblIncorrecto.Text = "";
             Response.Redirect("insumos.aspx");
         }
     }
     catch (Exception ex)
     {
         lblCorrecto.Text   = "";
         lblIncorrecto.Text = ex.Message;
     }
 }
Esempio n. 2
0
 protected void dgvMarcas_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         InsumoNegocio insNeg = new InsumoNegocio();
         long          id     = Convert.ToInt64(dgvMarcas.DataKeys[e.RowIndex].Value.ToString());
         if (insNeg.ContarRegistros(id) == true)
         {
             lblCorrecto.Visible = true;
             lblCorrecto.Text    = "NO SE PUEDE ELIMINAR LA MARCA. TIENE PRODUCTOS ASIGNADOS. ";
             lblIncorrecto.Text  = "";
         }
         else
         {
             insNeg.ModificarEstado(id);
             lblCorrecto.Text   = "Elminado correctamente.";
             lblIncorrecto.Text = "";
             Cargardgv();
         }
     }
     catch (Exception ex)
     {
         lblCorrecto.Text   = "";
         lblIncorrecto.Text = ex.Message;
     }
 }