Ejemplo n.º 1
0
        private void btnRegistrarProveedor_Click(object sender, EventArgs e)
        {
            var proveedor = new PROVEEDOR();

            proveedor.PROVEEDOR_ID = Convert.ToInt32(txtProveedorID.Text);
            proveedor.NOMBRE       = txtNombreProveedor.Text;
            proveedor.DIRECCION    = txtDireccion.Text;
            proveedor.TELEFONO     = txtTelefono.Text;
            proveedor.RFC          = txtRFC.Text;
            proveedor.EMAIL        = txtCorreo.Text;

            V.BRegistrarProovedor(txtNombreProveedor, txtDireccion, txtTelefono, txtRFC, txtCorreo, ErrorP1);
            if (V.VRegistrarProvedor(txtNombreProveedor, txtDireccion, txtTelefono, txtRFC, txtCorreo, ErrorP1))
            {
                using (var donJuan = new DonJuan_Inventario.BD_DONJUANEntities())
                {
                    donJuan.PROVEEDORs.Add(proveedor);
                    donJuan.SaveChanges();
                    MessageBox.Show("Se agrego una Proveedor!");
                    txtCorreo.Clear();
                    txtDireccion.Clear();
                    txtNombreProveedor.Clear();
                    txtProveedorID.Clear();
                    txtRFC.Clear();
                    txtTelefono.Clear();
                    txtNombreProveedor.Focus();
                    con.idproveedor(txtProveedorID);
                }
            }
        }
        public ConsultarInventario()
        {
            InitializeComponent();

            using (var donJuan = new DonJuan_Inventario.BD_DONJUANEntities())
            {
                productos = donJuan.INVENTARIOs.Include("PRODUCTO").ToList();
                dtginventario.DataSource = productos;
            }
        }
Ejemplo n.º 3
0
        private void ListarProveedores()
        {
            using (var donJuan = new DonJuan_Inventario.BD_DONJUANEntities())
            {
                prove = donJuan.PROVEEDORs.ToList();
                dtgProveedores.DataSource = prove;

                //prove = donJuan.PROVEEDORs.ToList();
                //dtgProveedores2.Columns[1].DataPropertyName = "Proveedor_ID";
            }
        }
Ejemplo n.º 4
0
        private void btnRegistrarCategoria_Click(object sender, EventArgs e)
        {
            var categoria = new CATEGORIA();

            V.BRegistrarCategoria(txtNomCategoria, ErrorP1);
            if (V.VRegistrarCategoria(txtNomCategoria, ErrorP1))
            {
                categoria.CATEGORIA_ID = Convert.ToInt32(txtCategoriaID.Text);
                categoria.NOMBRE       = txtNomCategoria.Text;
                using (var donJuan = new DonJuan_Inventario.BD_DONJUANEntities())
                {
                    donJuan.CATEGORIAs.Add(categoria);
                    donJuan.SaveChanges();
                    MessageBox.Show("Se agrego una categoria!");
                }
            }
        }
Ejemplo n.º 5
0
        private void btnRegistrarProducto_Click(object sender, EventArgs e)
        {
            var producto = new PRODUCTO();



            V.BRegistrarProducto(txtNombreProducto, txtPrecio, txtCostoProducto, txtMarcaProducto, ErrorP1);
            if (V.VRegistrarProducto(txtNombreProducto, txtPrecio, txtCostoProducto, txtMarcaProducto, ErrorP1))
            {
                producto.PRODUCTO_ID  = Convert.ToInt32(txtProductoID.Text);
                producto.NOMBRE       = txtNombreProducto.Text;
                producto.CODIGO       = txtProductCode.Text;
                producto.PRECIO       = Convert.ToDecimal(txtPrecio.Text);
                producto.COSTO        = Convert.ToDecimal(txtCostoProducto.Text);
                producto.UNIDAD       = cmbUnidad.Text;
                producto.MARCA        = txtMarcaProducto.Text;
                producto.PROVEEDOR_ID = Convert.ToInt32(provee);
                producto.CATEGORIA_ID = Convert.ToInt32(categ);

                using (var donJuan = new DonJuan_Inventario.BD_DONJUANEntities())
                {
                    donJuan.PRODUCTOes.Add(producto);

                    var inventoryItem = new INVENTARIO();

                    int initialInv;

                    inventoryItem.PRODUCTO = producto;
                    inventoryItem.CANTIDAD = Int32.TryParse(txtInitialInv.Text, out initialInv) ? initialInv : 0;

                    donJuan.INVENTARIOs.Add(inventoryItem);

                    donJuan.SaveChanges();
                    MessageBox.Show("Se agrego una Producto!");
                    txtProductoID.Clear();
                    txtNombreProducto.Clear();
                    txtPrecio.Clear();
                    txtMarcaProducto.Clear();
                    txtCostoProducto.Clear();
                    txtNombreProducto.Focus();
                    con.idproducto(txtProductoID);
                }
            }
        }