コード例 #1
0
        /// <summary>
        /// Demonstrate submitting a basket and reviewing any missed promotions returned.
        /// </summary>
        private static string Sample_SubmitBasketForMissedPromotions(string companyKey)
        {
            // Create the basket service manager - targeting the evaluation services.
            var basketServiceManager = new BasketServiceManager(ServiceTarget.EvaluationServices);

            // Get the basket request details.
            var basketRequest = SampleRequests.GetBasketRequest(companyKey, true);

            // Submit the request, and get the response.
            var basketResponse = basketServiceManager.SubmitBasket(basketRequest);

            // Now look at the response and display some information in the console.
            if (basketResponse.Summary.ProcessingResult != true)
            {
                // Something went wrong with the validation of the basket, so show the message.
                return(basketResponse.Summary.GetErrorDisplayText());
            }
            else
            {
                // Response received...  Use the LOCAL GetDisplayText and GetMissedPromotionsDisplayText methods to output some details to the console.
                string message = basketResponse.GetDisplayText();
                message += basketResponse.GetMissedPromotionsDisplayText();
                return(message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Demonstrate pushing coupon codes into Promo
        /// </summary>
        /// <param name="companyKey"></param>
        /// <param name="couponImportKey"></param>
        /// <returns>result message</returns>
        private static string Sample_PushCouponCodesToPromo(string companyKey, string couponImportKey)
        {
            var importService = new ImportServiceManager(ServiceTarget.EvaluationServices);

            var couponCodeImportRequest = SampleRequests.GetCouponCodesImportRequest(companyKey, couponImportKey);

            var importResponse = importService.ImportCouponCodes(couponCodeImportRequest);

            if (!importResponse.Summary.ProcessedSuccessfully)
            {
                return(importResponse.Summary.GetErrorDisplayText());
            }
            else
            {
                return(importResponse.GetDisplayText());
            }
        }
コード例 #3
0
        /// <summary>
        /// Demonstrate retriving coupon codes from Promo
        /// </summary>
        /// <param name="companyKey"></param>
        /// <param name="couponImportKey"></param>
        /// <returns>result message</returns>
        private static string Sample_RetrieveCouponCodesFromPromo(string companyKey, string couponImportKey)
        {
            var exportService = new ExportServiceManager(ServiceTarget.EvaluationServices);

            var couponCodeExportRequest = SampleRequests.GetCouponCodesExportRequest(companyKey, couponImportKey);

            var exportResponse = exportService.ExportCouponCodes(couponCodeExportRequest);

            // Now look at the response and display some information in the console.
            if (exportResponse.Summary.ProcessedSuccessfully != true)
            {
                // Something went wrong with the import, so show the message.
                return(exportResponse.Summary.GetErrorDisplayText());
            }
            else
            {
                // Get some display text from the import result.
                return(exportResponse.GetDisplayText());
            }
        }
コード例 #4
0
        private static string Sample_RetrieveBasketPromotionsForDayByProduct(string companyKey)
        {
            // Create the export service manager - targeting the evaluation services.
            var exportService = new ExportServiceManager(ServiceTarget.EvaluationServices);

            // Get the request details.
            var getPromotionsRequest = SampleRequests.GetPromotionDetailsByProductRequest(companyKey);

            // Submit the request and get the response
            var promosResponse = exportService.ExportPromotionsForProducts(getPromotionsRequest);

            // Now look at the response and display some information in the console.
            if (promosResponse.Summary.ProcessingResult != true)
            {
                // Something went wrong, so show the message.
                return(promosResponse.Summary.GetErrorDisplayText());
            }
            else
            {
                // Display the promotion details.
                return(promosResponse.Promotions.GetDisplayText());
            }
        }
コード例 #5
0
        /// <summary>
        /// Attempt to insert a product.  If the product exists, it will just be updated
        /// </summary>
        private static string Sample_CreateUpdateProduct(string companyKey)
        {
            // Create the import service manager - targeting the evaluation services.
            var importService = new ImportServiceManager(ServiceTarget.EvaluationServices);

            // Get the request details.
            var productImportRequest = SampleRequests.GetProductImportRequest(companyKey);

            // Submit the request and get the response.
            var importResponse = importService.ImportProducts(productImportRequest);

            // Now look at the response and display some information in the console.
            if (importResponse.Summary.ProcessedSuccessfully != true)
            {
                // Something went wrong with the import, so show the message.
                return(importResponse.Summary.GetErrorDisplayText());
            }
            else
            {
                // Get some display text from the import result.
                return(importResponse.GetDisplayText());
            }
        }