private bool validarExistencias()
        {
            bool existe = false;

            List <string> campos = new List <string>();

            campos.Add("tipo_descuento");
            List <string> valores = new List <string>();

            valores.Add(txtDescuento.Text);

            des = new conexiones_BD.clases.descuentos(campos, valores);

            if (Modificar)
            {
                if (des.validarCamposcondicorORActu(true, 1) > 1)
                {
                    existe = true;
                }
            }
            else
            {
                if (des.validarCamposcondicorOR(true) > 0)
                {
                    existe = true;
                }
            }

            return(existe);
        }
 private void eliminar()
 {
     if (iddescuento != null)
     {
         if (MessageBox.Show("¿Desea eliminar este registro?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
         {
             des = new conexiones_BD.clases.descuentos(iddescuento);
             if (des.eliminar(true, false) > 0)
             {
                 habilitar(false);
                 vaciarDatos();
                 cargarTablas();
             }
         }
     }
 }
 private void modifica()
 {
     if (!validar())
     {
         if (!validarExistencias())
         {
             Double desc = Convert.ToInt32(descuento.Value.ToString());
             Double aux  = desc / 100;
             des = new conexiones_BD.clases.descuentos(iddescuento, txtDescuento.Text, aux.ToString());
             if (des.modificar(true, false) > 0)
             {
                 habilitar(false);
                 vaciarDatos();
                 cargarTablas();
             }
         }
     }
 }
 private void guardar()
 {
     if (!validar())
     {
         if (!validarExistencias())
         {
             Double desc = Convert.ToInt32(descuento.Value.ToString());
             Double aux  = desc / 100;
             des = new conexiones_BD.clases.descuentos(txtDescuento.Text, aux.ToString());
             if (des.guardar(true, false) > 0)
             {
                 vaciarDatos();
                 cargarTablas();
                 txtDescuento.Focus();
             }
         }
     }
 }