コード例 #1
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);
                }
            }
        }
コード例 #2
0
        /* Public Methods. */

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