示例#1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            string     condicion  = txtBuscar.Text;
            ProductoNE productoNE = new ProductoNE();

            dgvBuscar.DataSource = productoNE.BuscarProducto(condicion);
        }
示例#2
0
        private void FrmProducto_Load(object sender, EventArgs e)
        {
            txtId.Focus();
            ProductoNE productoNE = new ProductoNE();

            dgvBuscar.DataSource = productoNE.BuscarProducto("");
        }
示例#3
0
        public static int EliminarProducto(ProductoNE pNE)
        {
            IDbConnection con = CapaDA.DBComun.Conexion();

            con.Open();
            SqlCommand Comand = new SqlCommand("Delete Producto WHERE IDProducto=@IDProducto", con as SqlConnection);

            Comand.Parameters.Add(new SqlParameter("@IDProducto", pNE.IDProducto));
            Comand.Parameters.Add(new SqlParameter("@Rubro", pNE.Rubro));
            Comand.Parameters.Add(new SqlParameter("@Tipo", pNE.Tipo));
            Comand.Parameters.Add(new SqlParameter("@Marca", pNE.Marca));
            Comand.Parameters.Add(new SqlParameter("@Detalle", pNE.Detalle));
            Comand.Parameters.Add(new SqlParameter("@Sabor", pNE.Sabor));
            Comand.Parameters.Add(new SqlParameter("@Envase", pNE.Envase));
            Comand.Parameters.Add(new SqlParameter("@Medicion", pNE.Medicion));
            Comand.Parameters.Add(new SqlParameter("@Tamaño", pNE.Tamaño));
            Comand.Parameters.Add(new SqlParameter("@PrecioCosto", pNE.PrecioCosto));
            Comand.Parameters.Add(new SqlParameter("@PrecioVenta", pNE.PrecioVenta));
            Comand.Parameters.Add(new SqlParameter("@StockMinimo", pNE.StockMinimo));

            int Resultado = Comand.ExecuteNonQuery();

            con.Close();
            return(Resultado);
        }
示例#4
0
        public static int ModificarProducto(ProductoNE pNE)
        {
            IDbConnection con = CapaDA.DBComun.Conexion();

            con.Open();
            SqlCommand Comand = new SqlCommand("UPDATE Producto SET Rubro= @Rubro, Tipo=@Tipo, Marca=@Marca, Detalle=@Detalle, Sabor=@Sabor, Envase=@Envase, Medicion=@Medicion, Tamaño=@Tamaño, PrecioCosto=@PrecioCosto, PrecioVenta=@PrecioVenta, StockMinimo=@StockMinimo  WHERE IDProducto=@IDProducto", con as SqlConnection);

            Comand.Parameters.Add(new SqlParameter("@IDProducto", pNE.IDProducto));
            Comand.Parameters.Add(new SqlParameter("@Rubro", pNE.Rubro));
            Comand.Parameters.Add(new SqlParameter("@Tipo", pNE.Tipo));
            Comand.Parameters.Add(new SqlParameter("@Marca", pNE.Marca));
            Comand.Parameters.Add(new SqlParameter("@Detalle", pNE.Detalle));
            Comand.Parameters.Add(new SqlParameter("@Sabor", pNE.Sabor));
            Comand.Parameters.Add(new SqlParameter("@Envase", pNE.Envase));
            Comand.Parameters.Add(new SqlParameter("@Medicion", pNE.Medicion));
            Comand.Parameters.Add(new SqlParameter("@Tamaño", pNE.Tamaño));
            Comand.Parameters.Add(new SqlParameter("@PrecioCosto", pNE.PrecioCosto));
            Comand.Parameters.Add(new SqlParameter("@PrecioVenta", pNE.PrecioVenta));
            Comand.Parameters.Add(new SqlParameter("@StockMinimo", pNE.StockMinimo));


            int Resultado = Comand.ExecuteNonQuery();

            con.Close();
            return(Resultado);
        }
 public FormEditarInventario()
 {
     InitializeComponent();
     tienda             = new TiendaNE();
     producto           = new ProductoNE();
     productoInventario = new ProductoInventarioNE();
 }
示例#6
0
        public List <ProductoNE> MostrarProducto()
        {
            IDbConnection con = DBComun.Conexion();

            con.Open();
            SqlCommand        _Command = new SqlCommand("SELECT * From Producto", con as SqlConnection);
            IDataReader       reader   = _Command.ExecuteReader();
            List <ProductoNE> Lista    = new List <ProductoNE>();

            while (reader.Read())
            {
                ProductoNE ObjetoProductoNE = new ProductoNE();
                ObjetoProductoNE.IDProducto  = reader.GetInt32(0);
                ObjetoProductoNE.Rubro       = reader.GetString(1);
                ObjetoProductoNE.Tipo        = reader.GetString(2);
                ObjetoProductoNE.Marca       = reader.GetString(3);
                ObjetoProductoNE.Detalle     = reader.GetString(4);
                ObjetoProductoNE.Sabor       = reader.GetString(5);
                ObjetoProductoNE.Envase      = reader.GetString(6);
                ObjetoProductoNE.Medicion    = reader.GetString(7);
                ObjetoProductoNE.Tamaño      = reader.GetString(8);
                ObjetoProductoNE.PrecioCosto = Convert.ToDouble(reader.GetDouble(9));
                ObjetoProductoNE.PrecioVenta = Convert.ToDouble(reader.GetDouble(10));
                ObjetoProductoNE.StockMinimo = reader.GetInt32(11);

                Lista.Add(ObjetoProductoNE);
            }
            con.Close();
            return(Lista);
        }
示例#7
0
        public static int AgregarProducto(ProductoNE pNE)
        {
            IDbConnection con = CapaDA.DBComun.Conexion();

            con.Open();
            try{
                SqlCommand Comand = new SqlCommand("IF NOT EXISTS (SELECT IDProducto FROM Producto WHERE IDProducto = @IDProducto) INSERT INTO Producto (IDProducto, Rubro, Tipo, Marca, Detalle, Sabor, Envase, Medicion, Tamaño, PrecioCosto, PrecioVenta, StockMinimo) VALUES (@IDProducto, @Rubro, @Tipo, @Marca, @Detalle, @Sabor, @Envase, @Medicion, @Tamaño, @PrecioCosto, @PrecioVenta, @StockMinimo)", con as SqlConnection);
                Comand.Parameters.Add(new SqlParameter("@IDProducto", pNE.IDProducto));
                Comand.Parameters.Add(new SqlParameter("@Rubro", pNE.Rubro));
                Comand.Parameters.Add(new SqlParameter("@Tipo", pNE.Tipo));
                Comand.Parameters.Add(new SqlParameter("@Marca", pNE.Marca));
                Comand.Parameters.Add(new SqlParameter("@Detalle", pNE.Detalle));
                Comand.Parameters.Add(new SqlParameter("@Sabor", pNE.Sabor));
                Comand.Parameters.Add(new SqlParameter("@Envase", pNE.Envase));
                Comand.Parameters.Add(new SqlParameter("@Medicion", pNE.Medicion));
                Comand.Parameters.Add(new SqlParameter("@Tamaño", pNE.Tamaño));
                Comand.Parameters.Add(new SqlParameter("@PrecioCosto", pNE.PrecioCosto));
                Comand.Parameters.Add(new SqlParameter("@PrecioVenta", pNE.PrecioVenta));
                Comand.Parameters.Add(new SqlParameter("@StockMinimo", pNE.StockMinimo));

                int Resultado = Comand.ExecuteNonQuery();
                con.Close();
                return(Resultado);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Error" + ex);
                return(1);
            }
        }
示例#8
0
        public FormAgregarProducto()
        {
            InitializeComponent();

            categoriaNE = new CategoriaNE();
            marcaNE     = new MarcaNE();
            productoNE  = new ProductoNE();
        }
示例#9
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                int id;

                if (txtId.Text.Length == 0)
                {
                    id = 0;
                }
                else
                {
                    id = Convert.ToInt32(txtId.Text);
                }

                string descripcion = txtDescripcion.Text;
                string categoria   = txtCategoria.Text;
                double precio;
                if (txtPrecio.Text.Length == 0)
                {
                    precio = 0;
                }
                else
                {
                    precio = Convert.ToDouble(txtPrecio.Text);
                }

                //Instanciar un objeto CE
                ProductoCE productoCE = new ProductoCE(id, descripcion, categoria, precio);
                //Instanciar un objeto Cn
                ProductoNE productoNE = new ProductoNE();
                //Ejecutar el metodo
                if (id == 0)
                {
                    txtId.Text = productoNE.Nuevo(productoCE).ToString();
                    MessageBox.Show("Se ha creado un nuevo producto", "Titulo");
                }
                else
                {
                    productoNE.Actualizar(productoCE);
                    MessageBox.Show("Se ha actualizado un nuevo producto", "Titulo");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                throw;
            }
        }
示例#10
0
        public List <ProductoNE> TraerUltimoNumeroProducto()
        {
            IDbConnection con = DBComun.Conexion();

            con.Open();
            SqlCommand        _Command = new SqlCommand("SELECT( max(IDProducto)+1) from Producto", con as SqlConnection);
            IDataReader       reader   = _Command.ExecuteReader();
            List <ProductoNE> Lista    = new List <ProductoNE>();

            while (reader.Read())
            {
                ProductoNE ObjetoProductoNE = new ProductoNE();

                ObjetoProductoNE.IDProducto = Convert.ToInt32(reader.GetInt32(0));

                Lista.Add(ObjetoProductoNE);
            }
            con.Close();
            return(Lista);
        }
示例#11
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (txtId.Text.Length > 0)
     {
         if (MessageBox.Show("Deseas Borrar", "ADVERTENCIA", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             //Instanciar un objeto CE
             ProductoCE productoCE = new ProductoCE();
             productoCE.id = Convert.ToInt32(txtId.Text);
             //Instanciar un objeto Cn
             ProductoNE productoNE = new ProductoNE();
             productoNE.Eliminar(productoCE);
             limpiarControles();
         }
     }
     else
     {
         MessageBox.Show("Debera Ingresar un ID");
     }
 }
示例#12
0
 public FormListarProducto()
 {
     InitializeComponent();
     productoNE = new ProductoNE();
 }
示例#13
0
 public int EliminarProducto(ProductoNE pro)
 {
     return(CapaDA.ProductoDA.EliminarProducto(pro));
 }
示例#14
0
 public int ModificarProducto(ProductoNE pro)
 {
     return(CapaDA.ProductoDA.ModificarProducto(pro));
 }
示例#15
0
 public FormProductoPorMarca()
 {
     InitializeComponent();
     marca    = new MarcaNE();
     producto = new ProductoNE();
 }
示例#16
0
 public int AgregarProducto(ProductoNE pro)
 {
     return(CapaDA.ProductoDA.AgregarProducto(pro));
 }
 public FormProductoPorCategoria()
 {
     InitializeComponent();
     categoria = new CategoriaNE();
     producto  = new ProductoNE();
 }
示例#18
0
 public FormTiendaPorProducto()
 {
     InitializeComponent();
     producto = new ProductoNE();
     tienda   = new TiendaNE();
 }