Exemplo n.º 1
0
        public bool scheduleAds(int promotionID, List<int> promotionAdIds, List<String> adEngines,
                                SEMplestConstants.PromotionAdAction actionType)
        {
            var jsonHash = new Dictionary<string, string>();
            jsonHash.Add("promotionID", promotionID.ToString());
            string jsonAdds = JsonConvert.SerializeObject(adEngines, Formatting.Indented);
            jsonHash.Add("adEngines", jsonAdds);
            jsonAdds = JsonConvert.SerializeObject(promotionAdIds, Formatting.Indented);
            jsonHash.Add("promotionAdIds", jsonAdds);

            if (actionType == SEMplestConstants.PromotionAdAction.Add)
                runBooleanMethod(ADENGINESERVICE, "AddAds", JsonConvert.SerializeObject(jsonHash));
            else if (actionType == SEMplestConstants.PromotionAdAction.Delete)
                runBooleanMethod(ADENGINESERVICE, "DeleteAds", JsonConvert.SerializeObject(jsonHash));
            else
                runBooleanMethod(ADENGINESERVICE, "UpdateAds", JsonConvert.SerializeObject(jsonHash));
            return true;
        }
Exemplo n.º 2
0
        public bool schedulePromotion(int promoId, string[] adds,
                                      SEMplestConstants.SchedulePromotionType st)
        {
            var jsonHash = new Dictionary<string, string>();
            jsonHash.Add("promotionID", promoId.ToString());
            string jsonAdds = JsonConvert.SerializeObject(adds, Formatting.Indented);
            jsonHash.Add("adEngines", jsonAdds);
            string jsonstr = JsonConvert.SerializeObject(jsonHash);
            string requestedService;
            switch (st)
            {
                case SEMplestConstants.SchedulePromotionType.Unpause:
                    requestedService = "UnpausePromotion";
                    break;
                case SEMplestConstants.SchedulePromotionType.Pause:
                    requestedService = "PausePromotion";
                    break;
                case SEMplestConstants.SchedulePromotionType.Delete:
                    requestedService = "DeletePromotion";
                    break;
                case SEMplestConstants.SchedulePromotionType.End:
                    requestedService = "EndPromotion";
                    break;
                default:
                    throw new Exception("Invalid Promotion Schedule Type");
                    break;
            }
            return runBooleanMethod(ADENGINESERVICE, requestedService, jsonstr);

        }