public List <ComboArticulos_Articulos> GetArticulos(int id_caja)
        {
            try
            {
                List <ComboArticulos_Articulos> listCombo = new List <ComboArticulos_Articulos>();
                OpenConnection();
                NpgsqlCommand cmdSel = new NpgsqlCommand("select c.id_herramienta,c.cantidad, h.nombre, h.stock from caja_herramienta_herramientas c " +
                                                         "inner join articulos h on h.id = c.id_herramienta" +
                                                         " where id_caja = @id", npgsqlConn);
                cmdSel.Parameters.Add("@id", NpgsqlTypes.NpgsqlDbType.Integer).Value = id_caja;
                NpgsqlDataReader drCombos = cmdSel.ExecuteReader();
                while (drCombos.Read())
                {
                    ComboArticulos_Articulos comb = new ComboArticulos_Articulos();
                    comb.Id_articulo       = (string)drCombos["id_herramienta"];
                    comb.Nombre_articulo   = (string)drCombos["nombre"];
                    comb.Cantidad_articulo = (int)drCombos["cantidad"];
                    comb.Stock             = (int)drCombos["stock"];
                    listCombo.Add(comb);
                }

                return(listCombo);
            }
            finally { CloseConnection(); }
        }
        public List <ComboArticulos_Articulos> GetArticulosCombos()
        {
            try
            {
                List <ComboArticulos_Articulos> listCombo = new List <ComboArticulos_Articulos>();
                OpenConnection();
                NpgsqlCommand cmdSel = new NpgsqlCommand("select c.id_caja,c.cantidad,c.id_herramienta " +
                                                         "from caja_herramienta_herramientas c " +
                                                         "inner join caja_herramienta h on h.id_caja = c.id_caja" +
                                                         " where h.activa = true order by h.id_caja ", npgsqlConn);

                NpgsqlDataReader drCombos = cmdSel.ExecuteReader();
                while (drCombos.Read())
                {
                    ComboArticulos_Articulos comb = new ComboArticulos_Articulos();
                    comb.Id_combo          = (int)drCombos["id_caja"];
                    comb.Cantidad_articulo = (int)drCombos["cantidad"];
                    comb.Id_articulo       = (string)drCombos["id_herramienta"];

                    listCombo.Add(comb);
                }

                return(listCombo);
            }
            finally { CloseConnection(); }
        }
        public void InsertarArticulosAPromo(ComboArticulos_Articulos ca_a)
        {
            try
            {
                this.OpenConnection();

                NpgsqlCommand cmdSave = new NpgsqlCommand("insert into caja_herramientas_promocion(id_caja,id_producto,cant_producto_promocional) " +
                                                          "values(@id_caja,@id_herramienta,@cantidad)", npgsqlConn);
                cmdSave.Parameters.Add("@id_caja", NpgsqlTypes.NpgsqlDbType.Integer).Value     = ca_a.Id_combo;
                cmdSave.Parameters.Add("@id_herramienta", NpgsqlTypes.NpgsqlDbType.Text).Value = ca_a.Id_articulo;
                cmdSave.Parameters.Add("@cantidad", NpgsqlTypes.NpgsqlDbType.Integer).Value    = ca_a.Cantidad_articulo;
                cmdSave.ExecuteNonQuery();
            }
            finally { CloseConnection(); }
        }