예제 #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtId.Text == "")
            {
                Proveedor c = new Proveedor();

                c.Nombres   = txtNombre.Text;
                c.Direccion = txtDireccion.Text;
                c.Ruc       = txtRuc.Text;
                c.Telefono  = txtTelefono.Text;
                c.Email     = txtEmail.Text;

                /* c.Departamento = txtDepartamento.Text;
                 * c.Provincia = txtProvincia.Text;
                 * c.Distrito = txtDistrito.Text;*/

                if (radActivo.Enabled == true)
                {
                    c.Estado = true;
                }
                else if (radInactivo.Enabled == true)
                {
                    c.Estado = false;
                }

                //ClienteNEG bl = new ClienteNEG();
                // if (bl.Guardar(c) == true)
                if (ProveedorNEG.Instancia().Guardar(c) == true)
                {
                    MessageBox.Show("El Proveedor se grabó correctamente");
                    this.Dispose();
                }
            }
            else
            {
                Proveedor c = new Proveedor();
                c.idProveedor = Convert.ToInt32(txtId.Text);

                c.Nombres   = txtNombre.Text;
                c.Direccion = txtDireccion.Text;
                c.Ruc       = txtRuc.Text;
                c.Telefono  = txtTelefono.Text;
                c.Email     = txtEmail.Text;
                if (radActivo.Enabled == true)
                {
                    c.Estado = true;
                }
                else if (radInactivo.Enabled == true)
                {
                    c.Estado = false;
                }

                //ClienteNEG bl = new ClienteNEG();
                if (ProveedorNEG.Instancia().Modificar(c) == true)
                {
                    MessageBox.Show("Los datos del Proveedor se actualizaron correctamente");
                    this.Dispose();
                }
            }
        }
        private void txtRucProveedor_TextChanged(object sender, EventArgs e)
        {
            Proveedor c = new Proveedor();

            c.Nombres = txtNombreProveedor.Text;
            c.Ruc     = txtRucProveedor.Text;
            //dgvCliente.DataSource = bl.Buscar(c);
            dgvProveedor.DataSource = ProveedorNEG.Instancia().Buscar(c);
        }
예제 #3
0
        private void txtRuc_TextChanged(object sender, EventArgs e)
        {
            //ClienteNEG bl = new ClienteNEG();
            Proveedor c = new Proveedor();

            c.Nombres = txtNombre_Busqueda.Text;
            c.Ruc     = txtRuc_Busqueda.Text;
            //dgvClientes.DataSource = bl.Buscar(c);
            dgvProveedores.DataSource = ProveedorNEG.Instancia().Buscar(c);
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Proveedor p = new Proveedor();

            dgvProveedor.DataSource = ProveedorNEG.Instancia().Listar(p);
        }