コード例 #1
0
        public void Sandbox()
        {
            log4net.Config.XmlConfigurator.Configure();
            PostCreationService.Clear();
            TaxonomyCreationService.Clear();
            TaxonomyCreationService.Initialize();
            var user = UserCreationService.CreateOrUpdate("couponer", "$P$BWJW/XnJo3sQg6CNqsrt1zHYMo4H7b1");

            Provider.GetDeals(user);
        }
コード例 #2
0
        /* Public Methods. */

        public static void Save(wp_user user, params DailyOffer[] offers)
        {
            foreach (var offer in offers)
            {
                if (!PostCreationService.Contains(offer.DatabaseIdentifier))
                {
                    var terms        = offer.GetTerms();
                    var customFields = offer.GetCustomFields();

                    var id = PostCreationService.CreatePost(user, offer.Title, offer.DatabaseIdentifier, offer.Description, "code");

                    PostCreationService.CreatePostMetadata(id, customFields);
                    PostCreationService.CreatePostTaxonomy(id, terms);

                    log.DebugFormat("Created daily offer with ID <{0}> for merchant <{1}>.", offer.UniqueId, offer.Merchant);
                }
                else
                {
                    log.DebugFormat("Skipping daily offer with ID <{0}> for merchant <{1}>.", offer.UniqueId, offer.Merchant);
                }
            }
        }
コード例 #3
0
        public static void Save(wp_user user, params Shop[] shops)
        {
            if (shops != null)
            {
                foreach (var shop in shops)
                {
                    if (!Contains(shop))
                    {
                        var id = PostCreationService.CreatePost(user, shop.Title, shop.DatabaseIdentifier, shop.Description, "shop");

                        PostCreationService.CreatePostMetadata(id, shop.GetCustomFields());
                        PostCreationService.CreatePostTaxonomy(id, new[] { new wp_term_relationship {
                                                                               term_taxonomy_id = TaxonomyCreationService.GetGeography(shop.Geography)
                                                                           } });

                        log.DebugFormat("Created shop with ID <{0}> for source <{1}>.", shop.UniqueId, shop.Source);
                    }
                    else
                    {
                        log.DebugFormat("Skipping shop with ID <{0}> for source <{1}>.", shop.UniqueId, shop.Source);
                    }
                }
            }
        }
コード例 #4
0
        /* Public Methods. */

        public static bool Contains(Shop shop)
        {
            return(PostCreationService.Contains(shop.DatabaseIdentifier));
        }