Exemplo n.º 1
0
        private void bModificar_Click(object sender, EventArgs e)
        {
            string strIdProveedor     = txtID.Text.ToString().Trim();
            string strNombreProveedor = txtNombreCompleto.Text.ToString().Trim();
            string strDomicilio       = txtDomicilio.Text.ToString().Trim();
            string strTelefono        = txtTelefono.Text.ToString().Trim();
            string strRFC             = txtRFC.Text.ToString().Trim();
            string strCuentaBancaria  = txtCuentaBancaria.Text.ToString().Trim();
            string strProductoSurtir  = txtProductoSurtir.Text.ToString().Trim();
            string strLimiteCredito   = txtLimiteCredito.Text.ToString().Trim();

            if (strIdProveedor != "" && strNombreProveedor != "")
            {
                _enProveedores.FiIdProveedor       = long.Parse(txtID.Text);
                _enProveedores.FcNombreProveedor   = txtNombreCompleto.Text;
                _enProveedores.FcDireccion         = txtDomicilio.Text;
                _enProveedores.FiTelefono          = txtTelefono.Text;
                _enProveedores.FcRFC               = txtRFC.Text;
                _enProveedores.FcCuentaBancaria    = txtCuentaBancaria.Text;
                _enProveedores.FcProductosSurtidos = txtProductoSurtir.Text;
                _enProveedores.FdLimiteCredito     = decimal.Parse(txtLimiteCredito.Text);

                if (proveedoresBL.ModificarProveedor(_enProveedores) > 0)
                {
                    MessageBox.Show("El registro se modificó correctamente", "¡Éxito!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    dGProveedores.Refresh();
                    dGProveedores.DataSource = proveedoresBL.MostrarProveedor();
                    Limpiar();
                }

                else
                {
                    MessageBox.Show("Ocurrio un problema, no se pudo modificar", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Seleccione un registro", "¡Advertencia!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }