private void btnEliminar_Click(object sender, EventArgs e)
        {
            string info = DeleteParameters.DeletewhitString(Program.conexion, "Producto", "idproducto", "producto", txtIProducto.Text);

            if (info.Substring(0, 12) == "ERROR: 23503")
            {
                MessageBox.Show("Este producto ya esta en una transaccion(venta, devolucion, movimiento), por lo que no es posible borrarlo");
            }
            else
            {
                Tools.setBoxemptys(Controls);
                btnEliminar.Enabled    = false;
                btnmodificar.Enabled   = false;
                txtIProducto.Enabled   = true;
                txtDetalles.Enabled    = false;
                txtIdProveedor.Enabled = false;
                txtNombre.Enabled      = false;
                txtPrecioList.Enabled  = false;
                txtIProducto.Focus();
            }
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string info = DeleteParameters.DeletewhitString(Program.conexion, "Proveedor", "idproveedor", "proveedor", txtID.Text);

            if (info.Substring(0, 12) == "ERROR: 23503")
            {
                MessageBox.Show("Este proveedor ya tiene productos registrados, para borrarlo, modifique sus productos y cambielos de proveedor. si ya ha echo pedidos a este proveedor, no es posible Eliminarlo");
            }
            else
            {
                Tools.setBoxemptys(Controls);
                btnEliminar.Enabled      = false;
                btnmodificar.Enabled     = false;
                txtID.Enabled            = true;
                txtCiudad.Enabled        = false;
                txtDireccion.Enabled     = false;
                txtEstado.Enabled        = false;
                txtNombre.Enabled        = false;
                txtTelefono.Enabled      = false;
                txtTiempoentrega.Enabled = false;
                txtID.Focus();
            }
        }
예제 #3
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string info = DeleteParameters.DeletewhitString(Program.conexion, "sucursal", "idsucursal", "Sucursal", txtID.Text);

            if (info == "OK")
            {
                Tools.setBoxemptys(Controls);
                btnmodificar.Enabled = false;
                btnEliminar.Enabled  = false;
                txtID.Enabled        = true;
                txtCiudad.Enabled    = false;
                txtDireccion.Enabled = false;
                txtEstado.Enabled    = false;
                txtTelefono.Enabled  = false;
                txtID.Focus();
            }
            else if (info == "NO")
            {
            }
            else if (info.Substring(0, 12) == "ERROR: 23503")
            {
                MessageBox.Show("Esta sucursal ya tiene empleados registrados, para eliminarla, edite todos los empleados y cambielos de sucursal");
            }
            else
            {
                Tools.setBoxemptys(Controls);
                btnmodificar.Enabled = false;
                btnEliminar.Enabled  = false;
                txtID.Enabled        = true;
                txtCiudad.Enabled    = false;
                txtDireccion.Enabled = false;
                txtEstado.Enabled    = false;
                txtTelefono.Enabled  = false;
                txtID.Focus();
            }
        }