Exemplo n.º 1
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            _proveedores.AgregarProveedor();
            listaProveedoresBindingSource.MoveLast();

            DeshabilitarHabilitarBotones(false);
        }
Exemplo n.º 2
0
        private void bGuardar_Click_1(object sender, EventArgs e)
        {
            try
            {//Trim sirve para borrar espacios si es que existen hOLA ZURY
                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 (strNombreProveedor.Equals("") || strDomicilio.Equals("") || strTelefono.Equals("") || strRFC.Equals("") || strCuentaBancaria.Equals("") || strProductoSurtir.Equals("") || strLimiteCredito.Equals(""))
                {
                    MessageBox.Show("Parece que olvidaste llenar todos los campos", "¡Cuidado!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    _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);
                    int Resultado = proveedoresBL.AgregarProveedor(_enProveedores);
                    dGProveedores.Refresh();
                    dGProveedores.DataSource = proveedoresBL.MostrarProveedor();

                    if (Resultado == 1)
                    {
                        MessageBox.Show("Se agrego el nuevo proveedor correctamente", "¡Éxito!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        Limpiar();
                    }
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Hubo un error al agregar el proveedor", "¡Alerta!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }