Exemple #1
0
        public Llewella(Campaign campaign)
            : base(campaign)
        {
            this.Animation = new LlewellaWalk(campaign);

            this.Interaction += this.OnInteraction;
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="campaignId">Id of the campaign to be updated.</param>
        public void Run(AdWordsUser user, long campaignId)
        {
            // Get the CampaignService.
              CampaignService campaignService =
              (CampaignService)user.GetService(AdWordsService.v201601.CampaignService);

              // Create the campaign.
              Campaign campaign = new Campaign();
              campaign.id = campaignId;
              campaign.status = CampaignStatus.PAUSED;

              // Create the operation.
              CampaignOperation operation = new CampaignOperation();
              operation.@operator = Operator.SET;
              operation.operand = campaign;

              try {
            // Update the campaign.
            CampaignReturnValue retVal = campaignService.mutate((new CampaignOperation[] {operation}));

            // Display the results.
            if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
              Campaign updatedCampaign = retVal.value[0];
              Console.WriteLine("Campaign with name = '{0}' and id = '{1}' was updated.",
              updatedCampaign.name, updatedCampaign.id);
            } else {
              Console.WriteLine("No campaigns were updated.");
            }
              } catch (Exception e) {
            throw new System.ApplicationException("Failed to update campaign.", e);
              }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            loggedInAdmin = Helpers.GetLoggedInAdmin();

            currentCompany = Helpers.GetCurrentCompany();

            currentAdGroup = Helpers.GetCurrentAdGroup();

            currentCampaign = currentAdGroup.campaign_;

            if (!Helpers.IsAuthorizedAdmin(loggedInAdmin, currentAdGroup.campaign_.company_))
            {
                Response.Redirect("/status.aspx?error=notadmin");
            }

            PopuplateBreadcrumbs();

            if (!IsPostBack)
            {
                UpdateAdGroupHyperLink.NavigateUrl = "/manage/AdGroups/UpdateAdGroupDetails.aspx?adgroup_id=" + currentAdGroup.adgroup_id;
                CreateAdMatchesHyperLink.NavigateUrl = "/manage/AdMatches/CreateAdMatches.aspx?adgroup_id=" + currentAdGroup.adgroup_id;
            }

            PopulateDetails();

            ShowAdMatches(currentAdGroup);
        }
    /// <summary>
    /// select the table to show from the db and build the table in the page
    /// </summary>
    protected void ShowCampaignTable()
    {
        Campaign cam = new Campaign();
        List<Campaign> campaigns = cam.GetCampaignList(email);

        foreach (Campaign c in campaigns)
        {
            HtmlTableRow tr = new HtmlTableRow();
            HtmlTableCell tc = new HtmlTableCell();
            HtmlTableCell tc1 = new HtmlTableCell();
            HtmlTableCell tc2 = new HtmlTableCell();
            HtmlTableCell tc3 = new HtmlTableCell();
            HtmlTableCell tc4 = new HtmlTableCell();
            HtmlTableCell tc5 = new HtmlTableCell();
            tc.InnerHtml = c.Name;
            tc1.InnerHtml = c.DateCreated.ToString();
            tc2.InnerHtml = c.Id.ToString();
            tc3.InnerHtml = c.Voucher;
            tc4.InnerHtml = c.ShareCount.ToString();
            if (c.IsActive == true)
                tc5.InnerHtml = "פעיל";
            else
                tc5.InnerHtml = "לא פעיל";
            tr.Cells.Add(tc);
            tr.Cells.Add(tc1);
            tr.Cells.Add(tc2);
            tr.Cells.Add(tc3);
            tr.Cells.Add(tc4);
            tr.Cells.Add(tc5);
            campaignsData.Controls.Add(tr);

        }
    }
    public static void createCampaignBlock(Campaign campaign, int i, Transform parentTransform, Transform Block, SubRingDiskController subRingDiskCtrl)
    {
        Vector3 setRotation = parentTransform.rotation.eulerAngles;
        setRotation.x = -90.0f;

        float posX = (i < 1) ? 1.29f : 1.29f + (i * (1.29f * 0.14f));
        float posY = 0f;

        Transform currentBlock = (Transform)Instantiate(Block, new Vector3(0, 0, 0), Quaternion.identity);
        currentBlock.SetParent(parentTransform);
        currentBlock.localScale = new Vector3(0.5f, 0.5f, 0.5f);
        currentBlock.rotation = Quaternion.Euler(setRotation);
        currentBlock.localPosition = new Vector3(posX, posY, 0f);

        //get an instance of the component.
        Transform blockInstance = currentBlock.GetComponent<Transform>();

        BlockController blockController = blockInstance.GetComponent<BlockController>();

        blockController.speed = campaign.Priority;
        blockController.order = i;

        blockController.objectId = campaign.Id;
        blockController.objectName = campaign.Name;
        blockController.objectType = "Campaign";
        blockController.labels = new string[]{"Type", "Status", "Start Date", "End Date", "Total Leads"};
        blockController.fields = new string[]{campaign.Type, campaign.Status, campaign.StartDate, campaign.EndDate, "" + campaign.NumberOfLeads + ""};
        blockController.description = campaign.Description;
        blockController.parentSubRingDiskController = subRingDiskCtrl;
        blockController.setText ("Campaign");
    }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteSheet"/> class.
 /// </summary>
 /// <param name="campaign">The campaign this sprite sheet belongs to.</param>
 /// <param name="sheetID">The ID of the sprite sheet.</param>
 /// <param name="rows">The amount of rows in the sprite sheet.</param>
 /// <param name="columns">The amount of columns in the sprite sheet.</param>
 public SpriteSheet(Campaign campaign, string sheetID, int rows, int columns)
 {
     this.campaign = campaign;
     this.SheetID = sheetID;
     this.Rows = rows;
     this.Columns = columns;
 }
    /// <summary>
    /// Runs the code example.
    /// </summary>
    /// <param name="user">The AdWords user.</param>
    /// <param name="campaignId">Id of the campaign to be removed.</param>
    public void Run(AdWordsUser user, long campaignId) {
      // Get the CampaignService.
      CampaignService campaignService = (CampaignService) user.GetService(
          AdWordsService.v201509.CampaignService);

      // Create campaign with REMOVED status.
      Campaign campaign = new Campaign();
      campaign.id = campaignId;
      campaign.status = CampaignStatus.REMOVED;

      // Create the operation.
      CampaignOperation operation = new CampaignOperation();
      operation.operand = campaign;
      operation.@operator = Operator.SET;

      try {
        // Remove the campaign.
        CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] {operation});

        // Display the results.
        if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
          Campaign removedCampaign = retVal.value[0];
          Console.WriteLine("Campaign with id = \"{0}\" was renamed to \"{1}\" and removed.",
              removedCampaign.id, removedCampaign.name);
        } else {
          Console.WriteLine("No campaigns were removed.");
        }
      } catch (Exception e) {
        throw new System.ApplicationException("Failed to remove campaign.", e);
      }
    }
        public ActionResult Create([DataSourceRequest] DataSourceRequest request,CampaignVM viewModel)
        {
            try
            {
                if (viewModel != null && ModelState.IsValid)
                {
                    Campaign newviewModel = new Campaign();

                    newviewModel.EndDate = viewModel.EndDate;
                    newviewModel.Name = viewModel.Name;
                    newviewModel.StartDate = viewModel.StartDate;
                    newviewModel.SystemRuleSystemRuleId = viewModel.SystemId;
                    newviewModel.UserUserId = viewModel.GameMasterId;
                    newviewModel.Description = viewModel.Description;

                    db.Campaigns.Add(newviewModel);
                    db.SaveChanges();
                    viewModel.CampaignId = newviewModel.CampaignId;
                    viewModel.System = db.SystemRules.Find(viewModel.SystemId).SystemName;
                    viewModel.GameMaster = db.Users.Find(viewModel.GameMasterId).Name;
                }
            }
            catch (DataException dataEx)
            {
                ModelState.AddModelError(string.Empty, "Data error");
                Elmah.ErrorSignal.FromCurrentContext().Raise(dataEx);
            }

            return Json(new[] { viewModel }.ToDataSourceResult(request, ModelState));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            loggedInAdmin = Helpers.GetLoggedInAdmin();

            currentCompany = Helpers.GetCurrentCompany();

            currentCampaign = Helpers.GetCurrentCampaign();

            if (!Helpers.IsAuthorizedAdmin(loggedInAdmin, currentCompany))
            {
                Response.Redirect("/status.aspx?error=notadmin");
            }

            PopuplateBreadcrumbs();

            CancelHyperLink.NavigateUrl = "/manage/Campaigns/ManageCampaign.aspx?campaign_id=" + currentCampaign.campaign_id;

            if (!IsPostBack)
            {
                TitleTextBox.Text = currentCampaign.title;
                NotesTextBox.Text = currentCampaign.notes;

                StartDateTextBox.Text = currentCampaign.start_datetime.ToShortDateString();
                EndDateTextBox.Text = currentCampaign.end_datetime.ToShortDateString();
            }
        }
        public HttpResponseMessage add(Campaign post)
        {
            // Check for errors
            if (post == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
            }
            else if (Language.MasterPostExists(post.language_id) == false)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist");
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 50);
            post.category_name = AnnytabDataValidation.TruncateString(post.category_name, 50);
            post.image_name = AnnytabDataValidation.TruncateString(post.image_name, 100);
            post.link_url = AnnytabDataValidation.TruncateString(post.link_url, 200);

            // Add the post
            Campaign.Add(post);

            // Return the success response
            return Request.CreateResponse<string>(HttpStatusCode.OK, "The post has been added");

        } // End of the add method
        /// <summary>
        /// Deleted a queued email
        /// </summary>
        /// <param name="campaign">Campaign</param>
        public virtual void DeleteCampaign(Campaign campaign)
        {
            if (campaign == null)
                throw new ArgumentNullException("campaign");

            _campaignRepository.Delete(campaign);
        }
        public HttpResponseMessage update(Campaign post)
        {
            // Check for errors
            if (post == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
            }
            else if (Language.MasterPostExists(post.language_id) == false)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist");
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 50);
            post.category_name = AnnytabDataValidation.TruncateString(post.category_name, 50);
            post.image_name = AnnytabDataValidation.TruncateString(post.image_name, 100);
            post.link_url = AnnytabDataValidation.TruncateString(post.link_url, 200);

            // Get the saved post
            Campaign savedPost = Campaign.GetOneById(post.id);

            // Check if the post exists
            if (savedPost == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The record does not exist");
            }

            // Update the post
            Campaign.Update(post);

            // Return the success response
            return Request.CreateResponse<string>(HttpStatusCode.OK, "The update was successful");

        } // End of the update method
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
              long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

              String campaignName = _T("INSERT_CAMPAIGN_NAME_HERE");
              String landingPageName = _T("INSERT_LANDING_PAGE_NAME_HERE");
              String url = _T("INSERT_LANDING_PAGE_URL_HERE");

              // Create the campaign structure.
              Campaign campaign = new Campaign();
              campaign.Name = campaignName;
              campaign.AdvertiserId = advertiserId;
              campaign.Archived = false;

              // Set the campaign start date. This example uses today's date.
              campaign.StartDate =
              DfaReportingDateConverterUtil.convertToDateString(DateTime.Now);

              // Set the campaign end date. This example uses one month from today's date.
              campaign.EndDate =
              DfaReportingDateConverterUtil.convertToDateString(DateTime.Now.AddMonths(1));

              // Insert the campaign.
              Campaign result =
              service.Campaigns.Insert(campaign, profileId, landingPageName, url).Execute();

              // Display the new campaign ID.
              Console.WriteLine("Campaign with ID {0} was created.", result.Id);
        }
Exemple #14
0
        public Hero(Campaign campaign)
            : base(campaign)
        {
            this.Animation = new HeroWalk(campaign);

            this.Interaction += OnInteraction;
        }
 protected void BtnCreate_Click( object sender, EventArgs e )
 {
     if ( Page.IsValid ) {
     Campaign campaign = new Campaign( StoreId, TxtName.Text );
     campaign.Save();
     Redirect( WebUtils.GetPageUrl( Constants.Pages.EditCampaign ) + "?id=" + campaign.Id + "&storeId=" + campaign.StoreId );
       }
 }
        public void SetUp()
        {
            repository = new FakeCampaignRepository();
            //((FakeCampaignRepository)repository).SetUpRepository();
            campaign = EntityHelpers.GetValidCampaign();
            causeTemplate = EntityHelpers.GetValidCauseTemplate();

            campaign.CauseTemplate = causeTemplate;
        }
        public Campaign getCampaignById(int id) {

            Campaign campaign = new Campaign();

            HttpResponseMessage httpResponseMessage = this.httpGet($"{this.getAPIUri()}/campaign/{id}");
            if (httpResponseMessage.IsSuccessStatusCode) {
                campaign = JsonConvert.DeserializeObject<Campaign>(httpResponseMessage.Content.ReadAsStringAsync().Result);
            }
            return campaign;
        }
Exemple #18
0
 public Fountain(Campaign campaign)
     : base(campaign,
           "Backgrounds/Albion/Fountain",
           "Backgrounds/Albion/FountainWalkArea",
           "Backgrounds/Albion/FountainRegions")
 {
     Character llewella = Campaign.GetCharacter(Llewella.Name);
     llewella.Location = new Point(200, 150);
     this.Characters.Add(llewella);
 }
Exemple #19
0
        public LlewellaWalk(Campaign campaign)
            : base(campaign)
        {
            this.CenterDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.CenterUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.LeftCenterAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.LeftDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.LeftUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.RightCenterAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.RightDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.RightUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/NPCs/Llewella/LlewellaWalkCenterDown",
                1,
                1);

            this.CurrentSprite = this.CenterDownAnimation;
        }
Exemple #20
0
        public HeroWalk(Campaign campaign)
            : base(campaign)
        {
            this.CenterDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkCenterDown",
                1,
                10);

            this.CenterUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkCenterUp",
                1,
                9);

            this.LeftCenterAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkLeftCenter",
                1,
                10);

            this.LeftDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkLeftDown",
                1,
                12);

            this.LeftUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkLeftUp",
                1,
                8);

            this.RightCenterAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkRightCenter",
                1,
                9);

            this.RightDownAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkRightDown",
                1,
                12);

            this.RightUpAnimation = new SpriteSheet(
                campaign,
                "Sprites/Characters/Hero/HeroWalkRightUp",
                1,
                8);

            this.CurrentSprite = this.CenterDownAnimation;
        }
        public object Any(Hello request)
        {
            //Issue 1 
            
            //This now fails. 
            var campaign = new Campaign();
            campaign.TrackingId = 0;
            campaign.CampaignPhone = "none";
            campaign.CostAmount = 0M;
            campaign.EndDate = 0L;
            campaign.StartDate = SystemClock.Instance.Now.Ticks / NodaConstants.TicksPerMillisecond;
            campaign.FixedCost = 0M;
            campaign.IsActive = true;
            campaign.IsRetread = true;
            campaign.IsFactorTrustApp = true;
            campaign.IsFactorTrustLeads = true;
            campaign.IsDuplicate = true;
            campaign.IsEmail = true;
            campaign.MasterId = 0;
            campaign.IsFirmOffer = false;
            campaign.LeadDelCostTypeId = 0;
            campaign.LeadDelRespTypeId = 0;
            campaign.LeadDelTypeId = 0;
            campaign.LeadRoutingTypeId = 0;
            campaign.Name = "Exception Campaign";
            campaign.IsExceptionCampaign = true;
            campaign.IsDefaultCampaign = false;
            campaign.IsActive = true;

            var rowId = Db.Insert(campaign, true);
            


            //Issue 2


            // This is also broken

/*            var campaigns = Db.Dictionary<int, string>(Db.
                    From<Campaign>().
                    Select(x => new { x.Id, x.Name }).
                    Where(x => x.IsActive));*/

            // but yet, this works

            /*var campaigns = Db.Dictionary<int, string>("select id, name from campaign where isactive = 1");*/




            return new HelloResponse { Result = "Hello, {0}!".Fmt(request.Name) };
        }
Exemple #22
0
    public static IQueryable<Campaign> Get(List<Guid> provinceIDList, DateTime? from, DateTime? to, Campaign.TypeX type)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        if (provinceIDList == null || provinceIDList.Count == 0) return null;

        return db.Campaigns.Where(r => provinceIDList.Contains(r.CoopOrg.GeoID1.Value)
            && r.Type == type
            && r.Date != null
            && (from == null || r.Date.Value.Date >= from.Value.Date)
            && (to == null || r.Date.Value.Date <= to.Value.Date)
            );
    }
Exemple #23
0
        public HillOverAlbion(Campaign campaign)
            : base(campaign,
                  "Backgrounds/Albion/HillOverAlbion",
                  "Backgrounds/Albion/HillOverAlbionWalkArea",
                  "Backgrounds/Albion/HillOverAlbionRegions")
        {
            Character hero = Campaign.GetCharacter(Hero.Name);
            hero.Location = new Point(250, 220);
            this.Characters.Add(hero);

            Item bentSword = Campaign.GetItem(BentSword.Name);
            bentSword.Location = new Point(150, 170);
            this.Items.Add(bentSword);
        }
 /// <summary>
 /// Outputs the Campaign.
 /// </summary>
 protected void OutputCampaign(Campaign campaign)
 {
     if (campaign != null)
     {
         OutputStatusMessage(string.Format("BudgetType: {0}", campaign.BudgetType));
         OutputStatusMessage(string.Format("CampaignType: {0}", campaign.CampaignType));
         OutputStatusMessage(string.Format("DailyBudget: {0}", campaign.DailyBudget));
         OutputStatusMessage(string.Format("Description: {0}", campaign.Description));
         OutputStatusMessage("ForwardCompatibilityMap: ");
         if (campaign.ForwardCompatibilityMap != null)
         {
             foreach (var pair in campaign.ForwardCompatibilityMap)
             {
                 OutputStatusMessage(string.Format("Key: {0}", pair.Key));
                 OutputStatusMessage(string.Format("Value: {0}", pair.Value));
             }
         }
         OutputStatusMessage(string.Format("Id: {0}", campaign.Id));
         OutputStatusMessage(string.Format("MonthlyBudget: {0}", campaign.MonthlyBudget));
         OutputStatusMessage(string.Format("Name: {0}", campaign.Name));
         OutputStatusMessage("Settings: \n");
         if (campaign.Settings != null)
         {
             foreach (var setting in campaign.Settings)
             {
                 var shoppingSetting = setting as ShoppingSetting;
                 if (shoppingSetting != null)
                 {
                     OutputStatusMessage("ShoppingSetting: \n");
                     OutputStatusMessage(string.Format("Priority: {0}", shoppingSetting.Priority));
                     OutputStatusMessage(string.Format("SalesCountryCode: {0}", shoppingSetting.SalesCountryCode));
                     OutputStatusMessage(string.Format("StoreId: {0}", shoppingSetting.StoreId));
                 }
             }
         }
         OutputStatusMessage(string.Format("Status: {0}", campaign.Status));
         OutputStatusMessage(string.Format("TrackingUrlTemplate: {0}", campaign.TrackingUrlTemplate));
         OutputStatusMessage("UrlCustomParameters: ");
         if (campaign.UrlCustomParameters != null && campaign.UrlCustomParameters.Parameters != null)
         {
             foreach (var customParameter in campaign.UrlCustomParameters.Parameters)
             {
                 OutputStatusMessage(string.Format("\tKey: {0}", customParameter.Key));
                 OutputStatusMessage(string.Format("\tValue: {0}", customParameter.Value));
             }
         }
         OutputStatusMessage(string.Format("TimeZone: {0}", campaign.TimeZone));
     }
 }
        public void TestGetAllCampaignsMockAndCallServer()
        {
            ServiceSignature mockSignature = MockUtilities.RegisterMockService(user,
              AdWordsService.v201601.CampaignService, typeof(MockCampaignServiceEx));

              CampaignService campaignService = (CampaignService) user.GetService(mockSignature);
              Assert.That(campaignService is MockCampaignServiceEx);

              Campaign campaign = new Campaign();
              campaign.name = "Interplanetary Cruise #" + new TestUtils().GetTimeStamp();
              campaign.status = CampaignStatus.PAUSED;
              campaign.biddingStrategyConfiguration = new BiddingStrategyConfiguration();
              campaign.biddingStrategyConfiguration.biddingStrategyType = BiddingStrategyType.MANUAL_CPC;

              Budget budget = new Budget();
              budget.budgetId = budgetId;

              campaign.budget = budget;

              campaign.advertisingChannelType = AdvertisingChannelType.SEARCH;

              // Set the campaign network options to GoogleSearch and SearchNetwork
              // only. Set ContentNetwork, PartnerSearchNetwork and ContentContextual
              // to false.
              campaign.networkSetting = new NetworkSetting() {
            targetGoogleSearch = true,
            targetSearchNetwork = true,
            targetContentNetwork = false,
            targetPartnerSearchNetwork = false
              };

              // Create operations.
              CampaignOperation operation = new CampaignOperation();
              operation.@operator = Operator.ADD;
              operation.operand = campaign;

              CampaignReturnValue retVal = null;

              Assert.DoesNotThrow(delegate() {
            retVal = campaignService.mutate((new CampaignOperation[] { operation }));
              });

              Assert.NotNull(retVal);
              Assert.NotNull(retVal.value);
              Assert.AreEqual(retVal.value.Length, 1);
              Assert.AreEqual(retVal.value[0].name, campaign.name);
              Assert.AreNotEqual(retVal.value[0].id, 0);
              Assert.True((campaignService as MockCampaignServiceEx).MutateCalled);
        }
Exemple #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Room"/> class.
 /// </summary>
 /// <param name="campaign">The campaign this item belongs to.</param>
 /// <param name="backgroundID">The ID of the room background.</param>
 /// <param name="walkAreaID">The ID of the room walk area.</param>
 /// <param name="hotSpotMaskID">The ID of the room hot spot mask.</param>
 protected Room(
     Campaign campaign,
     string backgroundID,
     string walkAreaID,
     string hotSpotMaskID)
     : base(campaign)
 {
     this.pathfinder = new AStar(2500, (node, neighbor) => 1, this.CalculateOctileHeuristic);
     this.backgroundID = backgroundID;
     this.walkAreaID = walkAreaID;
     this.hotSpotMaskID = hotSpotMaskID;
     this.characters = new List<Character>();
     this.items = new List<Item>();
     this.hotspots = new Dictionary<Color, Hotspot>();
 }
 /// <summary>
 /// insert the campaign into the db
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSaveCampaign_Click(object sender, EventArgs e)
 {
     Campaign campaign = new Campaign();
     campaign.Name = txtCampaignName.Text;
     campaign.Description = txtCampaignDescription.Text;
     campaign.ShareCount = 0;//temporary
     campaign.Voucher = txtVoucher.Text;
     campaign.Expiration = Convert.ToInt32(ddlExpirationTime.SelectedValue);
     campaign.LinkUrl = txtCampaignLink.Text;
     campaign.ImageUrl = InsertPictureToDirectory();
     campaign.DateCreated = DateTime.Now;
     campaign.IsActive = true;
     campaign.insertNewCampaign(campaign,email);
     Response.Redirect("Campaign.aspx");
 }
        public ActionResult Create(Campaign campaign)
        {
            if (ModelState.IsValid)
            {
                _repo
                    .Campaigns
                    .InsertOnSubmit(campaign);
                _repo.SubmitChanges();

                return RedirectToAction("Index");
            }
            else
            {
                return View(campaign);
            }
        }
        // POST api/Campaign
        public HttpResponseMessage PostCampaign(Campaign campaign)
        {
            if (ModelState.IsValid)
            {
                db.Campaigns.Add(campaign);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, campaign);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = campaign.Id }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
Exemple #30
0
    } // End of the constructor

    #endregion

    #region Insert methods

    /// <summary>
    /// Add one campaign
    /// </summary>
    /// <param name="post">A reference to a campaign post</param>
    public static long Add(Campaign post)
    {
        // Create the long to return
        long idOfInsert = 0;

        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "INSERT INTO dbo.campaigns (language_id, name, category_name, image_name, link_url, inactive, click_count) "
            + "VALUES (@language_id, @name, @category_name, @image_name, @link_url, @inactive, @click_count);SELECT SCOPE_IDENTITY();";

        // The using block is used to call dispose automatically even if there is a exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there is a exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add parameters
                cmd.Parameters.AddWithValue("@language_id", post.language_id);
                cmd.Parameters.AddWithValue("@category_name", post.category_name);
                cmd.Parameters.AddWithValue("@name", post.name);
                cmd.Parameters.AddWithValue("@image_name", post.image_name);
                cmd.Parameters.AddWithValue("@link_url", post.link_url);
                cmd.Parameters.AddWithValue("@inactive", post.inactive);
                cmd.Parameters.AddWithValue("@click_count", post.click_count);

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases
                try
                {
                    // Open the connection
                    cn.Open();

                    // Execute the insert
                    idOfInsert = Convert.ToInt64(cmd.ExecuteScalar());

                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }

        // Return the id of the inserted item
        return idOfInsert;

    } // End of the Add method
        public virtual void InsertCampaign(Campaign campaign)
        {
            Guard.NotNull(campaign, nameof(campaign));

            _campaignRepository.Insert(campaign);
        }
Exemple #32
0
 public MarketPlaceViewModel(Campaign campaign, List <CampaignAccount> campaignAccounts, Agency agency)
 {
     Campaign         = campaign;
     CampaignAccounts = campaignAccounts;
     Agency           = agency;
 }
Exemple #33
0
 public void Update(Campaign campaign)
 {
     Console.WriteLine(campaign.Name + "adlı kampanya başarıyla sistemde güncellendi.");
 }
Exemple #34
0
        /// <summary>
        /// Saves Campaign and navigate to Home Page
        /// </summary>
        private void SaveData()
        {
            Campaign  objCampaign  = new Campaign();
            CloneInfo objCloneInfo = new CloneInfo();

            long parentCampaignID = Convert.ToInt64(hdnCampaignId.Value);

            objCampaign.CampaignID       = 0;
            objCampaign.Description      = txtDescription.Text.Trim();
            objCampaign.ShortDescription = txtShortDesc.Text.Trim();
            //objCampaign.FundRaiserDataTracking = chkFundRaiser.Checked;
            //objCampaign.OnsiteTransfer = chkOnSiteCallTransfer.Checked;
            //objCampaign.EnableAgentTraining = chkTraining.Checked;
            //objCampaign.RecordLevelCallHistory = chkRecordLevel.Checked;
            objCampaign.EnableAgentTraining    = true;
            objCampaign.RecordLevelCallHistory = false;
            objCampaign.AllowDuplicatePhones   = chkDuplicatePh.Checked;
            objCampaign.Allow7DigitNums        = chkSevenDigitNums.Checked;
            objCampaign.Allow10DigitNums       = chkTenDigitNums.Checked;

            if (rdoIgnore.Checked)
            {
                objCampaign.DuplicateRule = "I";
            }
            else
            {
                objCampaign.DuplicateRule = "R";
            }

            objCampaign.OutboundCallerID = txtOutboundCallerID.Text.Trim();
            objCampaign.StatusID         = Convert.ToInt64(ConfigurationManager.AppSettings["DefaultStatusID"]);
            objCampaign.IsDeleted        = false;
            string RecordingsPath   = @"C:\recordings\";
            string ismultiboxconfig = ConfigurationManager.AppSettings["IsMultiBoxConfig"];
            string strPath          = objCampaign.ShortDescription;

            /*if (ismultiboxconfig == "yes" || ismultiboxconfig == "Yes" || ismultiboxconfig == "YES")
             * {
             *  RecordingsPath = ConfigurationManager.AppSettings["RecordingsPathMulti"];
             *  strPath = strPath.Trim();
             *  strPath = RecordingsPath + strPath;
             *  Directory.CreateDirectory(Server.MapPath(strPath));
             * }
             * else
             * {*/
            RecordingsPath = ConfigurationManager.AppSettings["RecordingsPath"];
            strPath        = strPath.Trim();
            strPath        = RecordingsPath + strPath;
            Directory.CreateDirectory(strPath);
            //}

            objCloneInfo.RecordingsPath = strPath.EndsWith(@"\") == true?strPath.Trim() : strPath.Trim() + @"\";


            objCloneInfo.ParentCampaignId   = parentCampaignID;
            objCloneInfo.ParentShortDesc    = lblCampaign.Text;
            objCloneInfo.IncludeData        = chkData.Checked;
            objCloneInfo.IncludeResultCodes = chkResultcodes.Checked;
            objCloneInfo.IncludeOptions     = chkOptions.Checked;
            objCloneInfo.IncludeQueries     = chkQueries.Checked;
            objCloneInfo.IncludeFields      = chkFields.Checked;
            objCloneInfo.IncludeScripts     = chkScripts.Checked;

            if (RdoClone.Checked)
            {
                //-----------------------------------------------------
                // Clone all data is checked.
                //-----------------------------------------------------
                objCloneInfo.IncludeData        = true;
                objCloneInfo.IncludeResultCodes = true;
                objCloneInfo.IncludeOptions     = true;
                objCloneInfo.IncludeQueries     = true;
                objCloneInfo.IncludeFields      = true;
                objCloneInfo.IncludeScripts     = true;
                objCloneInfo.FullCopy           = true;
            }
            else
            {
                objCloneInfo.IncludeData        = chkData.Checked;
                objCloneInfo.IncludeResultCodes = chkResultcodes.Checked;
                objCloneInfo.IncludeOptions     = chkOptions.Checked;
                objCloneInfo.IncludeQueries     = chkQueries.Checked;
                objCloneInfo.IncludeFields      = chkFields.Checked;
                objCloneInfo.IncludeScripts     = chkScripts.Checked;
                objCloneInfo.FullCopy           = false;
            }

            CampaignService objCampaignService = new CampaignService();
            XmlDocument     xDocCampaign       = new XmlDocument();
            XmlDocument     xDocCloneInfo      = new XmlDocument();

            try
            {
                xDocCampaign.LoadXml(Serialize.SerializeObject(objCampaign, "Campaign"));
                xDocCloneInfo.LoadXml(Serialize.SerializeObject(objCloneInfo, "CloneInfo"));

                objCampaignService.Timeout = System.Threading.Timeout.Infinite;

                objCampaign = (Campaign)Serialize.DeserializeObject(objCampaignService.CampaignClone(xDocCampaign, xDocCloneInfo), "Campaign");

                Session["Campaign"] = objCampaign;
                Response.Redirect("~/campaign/Home.aspx?CampaignID=" + objCampaign.CampaignID);
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("CampaignDuplicateEntityException") >= 0)
                {
                    PageMessage = "CloneCampaign.aspx SaveData Calling objCampaignService.CampaignClone threw error: " + ex.Message;
                }
                else
                {
                    PageMessage = ex.Message;
                }

                ActivityLogger.WriteException(ex, "Admin");
            }
        }
 public void Add(Campaign campaign)
 {
     Console.WriteLine("Kampanya eklendi: " + campaign.CampaignName + "İndirim oranı:" + campaign.DiscountRate + '\n');
 }
 public void Update(Campaign campaign)
 {
     Console.WriteLine("Campaign was updated: " + campaign.Name);
 }
Exemple #37
0
 public void ApplyDiscountToGame(Game game, Campaign campaign)
 {
     Console.WriteLine("\n%" + campaign.Discount + " indirim " + game.Name + " isimli oyuna uygulandı.");
     Console.WriteLine(game.Name + " isimli oyunun yeni fiyatı: " + (game.Price - (game.Price * campaign.Discount / 100) + "TL."));
 }
 public void Add(Campaign campaign)
 {
     Console.WriteLine("Campaign was added: " + campaign.Name);
 }
Exemple #39
0
 public void Create(IManagable campaign)
 {
     _campaign = (Campaign)campaign;
     _campaigns.Add(_campaign);
     Console.WriteLine("Kampanya oluşturuldu: " + _campaign.Name);
 }
Exemple #40
0
 public void Update(Gamer gamer, Campaign campaign)
 {
     Console.WriteLine(gamer.Id + " Numaralı müşteri " + campaign.CampaignName + " adlı kampanyayı güncelledi. ");
 }
 public void Update(Campaign campaign)
 {
     Console.WriteLine("Kampanya güncellendi: " + campaign.CampaignName + "İndirim oranı:" + campaign.DiscountRate + '\n');
 }
Exemple #42
0
 public void Delete(IManagable campaign)
 {
     _campaign = (Campaign)campaign;
     _campaigns.Remove(_campaign);
     Console.WriteLine("Kampanya silindi: " + _campaign.Name);
 }
Exemple #43
0
        /// <summary>
        ///  Creates a new standard shopping campaign in the specified client account.
        /// </summary>
        /// <param name="client">The Google Ads API client.</param>
        /// <param name="customerId">The client customer ID.</param>
        /// <param name="budgetResourceName">The resource name of the budget for the campaign.
        /// </param>
        /// <param name="merchantCenterAccountId">The Merchant Center account ID.</param>
        /// <returns>Resource name of the newly created campaign.</returns>
        /// <exception cref="GoogleAdsException">Thrown if an API request failed with one or more
        /// service errors.</exception>
        private string AddStandardShoppingCampaign(GoogleAdsClient client, long customerId,
                                                   string budgetResourceName, long merchantCenterAccountId)
        {
            // Get the CampaignService.
            CampaignServiceClient campaignService =
                client.GetService(Services.V1.CampaignService);

            // Configures the shopping settings.
            ShoppingSetting shoppingSetting = new ShoppingSetting()
            {
                // Sets the sales country of products to include in the campaign.
                SalesCountry = "US",

                // Sets the priority of the campaign. Higher numbers take priority over lower
                // numbers. For Shopping Product Ad campaigns, allowed values are between 0 and 2,
                // inclusive.
                CampaignPriority = 0,

                MerchantId = merchantCenterAccountId,

                // Enables local inventory ads for this campaign.
                EnableLocal = true
            };

            // Create the standard shopping campaign.
            Campaign campaign = new Campaign()
            {
                Name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString(),

                // Configures settings related to shopping campaigns including advertising channel
                // type and shopping setting.
                AdvertisingChannelType = AdvertisingChannelType.Shopping,

                ShoppingSetting = shoppingSetting,

                // Recommendation: Set the campaign to PAUSED when creating it to prevent
                // the ads from immediately serving. Set to ENABLED once you've added
                // targeting and the ads are ready to serve
                Status = CampaignStatus.Paused,

                // Sets the bidding strategy to Manual CPC (with eCPC enabled)
                // Recommendation: Use one of the automated bidding strategies for Shopping
                // campaigns to help you optimize your advertising spend. More information can be
                // found here: https://support.google.com/google-ads/answer/6309029
                ManualCpc = new ManualCpc()
                {
                    EnhancedCpcEnabled = true
                },

                // Sets the budget.
                CampaignBudget = budgetResourceName
            };

            // Creates a campaign operation.
            CampaignOperation operation = new CampaignOperation()
            {
                Create = campaign
            };

            // Issues a mutate request to add the campaign.
            MutateCampaignsResponse response =
                campaignService.MutateCampaigns(customerId.ToString(),
                                                new CampaignOperation[] { operation });
            MutateCampaignResult result = response.Results[0];

            Console.WriteLine("Added a standard shopping campaign with resource name: '{0}'.",
                              result.ResourceName);
            return(result.ResourceName);
        }
Exemple #44
0
 public CampaignAccountByAccountViewModel(CampaignAccount campaignAccount, Campaign campaign) : base(campaignAccount)
 {
     AccountChargeAmount = campaign.GetAccountChagreAmount(campaignAccount);
 }
        // Encodes the CallHistoryReport as an HTML document
        //
        // NOTE: This report has not been finished.
        override public string encodeHTMLReport(Campaign campaign,
                                                string startDate,
                                                string endDate,
                                                string startTime,
                                                string endTime)
        {
            string   campaignName = "All Campaigns";
            Agent    agent        = new Agent(campaign, AgentID);
            Agent    summaryAgent = new Agent(campaign, 0);
            Campaign loader       = new Campaign();
            List <CampaignSummary> activeCampaigns = new List <CampaignSummary>();

            if (CampaignID > 0)
            {
                List <RainmakerData> campaigns = loader.GetDataSet("CampaignID=" + CampaignID, null);
                campaign     = (Campaign)campaigns.GetRange(0, 1).ToArray()[0];
                campaignName = campaign.Description;
                CampaignSummary cs = new CampaignSummary(campaign,
                                                         DateTime.Parse(startDate),
                                                         DateTime.Parse(endDate),
                                                         DateTime.Parse(startTime),
                                                         DateTime.Parse(endTime));
                Agent curAgent = Agent.FindAgent(cs.Agents, AgentID);
                if (curAgent != null)
                {
                    summaryAgent = curAgent;
                }
            }
            else
            {
                Campaign [] campaigns = (Campaign [])loader.GetDataSet(null, null).ToArray();
                foreach (Campaign curCampaign in campaigns)
                {
                    CampaignSummary cs = new CampaignSummary(curCampaign,
                                                             DateTime.Parse(startDate),
                                                             DateTime.Parse(endDate),
                                                             DateTime.Parse(startTime),
                                                             DateTime.Parse(endTime));
                    Agent curAgent = Agent.FindAgent(cs.Agents, AgentID);
                    if ((curAgent != null) && curAgent.TotalCalls > 0)
                    {
                        activeCampaigns.Add(cs);
                    }
                    summaryAgent.Add(curAgent);
                }
            }
            error = false;
            string html = "<div class=\"agentDialerResultsReport\">";

            //
            /// Show the report header/information
            //
            html += "<div>";
            html += "  <p id=\"agentDialerResultsReportHeader\">Agent Dialer Results Report By Agent</p>";
            html += "  <div style=\"position: relative; margin-top: 15px;\">";
            html += "    <div style=\"height: 80px; width: 790px;\">";
            html += "      	<div style=\"text-align: left;\">";
            html += "      		<span class=\"agentDialerResultsSecHeader\" style=\"margin-left: 100px; font-size: large; text-decoration: none\">";
            html += "        	For Campaign: &nbsp&nbsp&nbsp "+ campaignName;
            html += "      		</span>";
            html += "      	</div>";
            html += "      	<div style=\"text-align: left;\">";
            html += "      		<span class=\"agentDialerResultsSecHeader\" style=\"margin-left: 100px; font-size: large; text-decoration: none\">";
            html += "        	Agent: &nbsp&nbsp&nbsp "+ agent.AgentName;
            html += "      		</span>";
            html += "      	</div>";
            html += "      	<div style=\"text-align: left;\">";
            html += "      		<span class=\"agentDialerResultsSecHeader\" style=\"margin-left: 100px; font-size: large; text-decoration: none\">";
            html += "        	Total Calls: &nbsp&nbsp&nbsp 0";
            html += "      		</span>";
            html += "      	</div>";
            html += "    </div>";
            html += "    <div style=\"position: absolute; left: 800px; top: -10px; width: 170px; font-weight: bold\">";
            html += "      <div style=\"text-align: right;\">";
            html += "        <p style=\"\">Start Date: " + startDate + "</p>";
            html += "        <p style=\"\">End Date: " + endDate + "</p>";
            html += "      </div>";
            html += "      <p style=\"text-decoration: underline\">Between Times</p>";
            html += "      <div style=\"text-align: right;\">";
            html += "        <p style=\"\">Start Time: " + startTime + " </p>";
            html += "        <p style=\"\">End Time: " + endTime + "</p>";
            html += "      </div>";
            html += "    </div>";
            html += "  </div>";
            html += "</div>";


            // Display the the summary information header
            html += "<div id=\"agentDialerResultsHeaderTop\" style=\"position: relative; height: 20px; margine-bottom: 20px\">";
            html += "  <span style=\"position: absolute; left: 20px; width: 50px; text-align: center\">Agent</span>";
            html += "  <span style=\"position: absolute; left: 70px; width: 200px; text-align: left\">&nbsp</span>";
            html += "  <span style=\"position: absolute; left: 200px; width: 60px; text-align: center\">Leads</span>";
            html += "  <span style=\"position: absolute; left: 280px; width: 60px; text-align: center\">Leads</span>";
            html += "  <span style=\"position: absolute; left: 380px; width: 60px; text-align: center\">&nbsp</span>";
            html += "  <span style=\"position: absolute; left: 460px; width: 60px; text-align: center\">Pres./</span>";
            html += "  <span style=\"position: absolute; left: 550px; width: 60px; text-align: center\">Leads/</span>";
            html += "  <span style=\"position: absolute; left: 670px; width: 90px; text-align: center\">Presentations</span>";
            html += "  <span style=\"position: absolute; left: 800px; width: 140px; text-align: center\">Leads/</span>";
            html += "</div>";

            html += "<div id=\"agentDialerResultsHeaderBottom\" style=\"position: relative; height: 20px; margine-bottom: 20px\">";
            html += "  <span style=\"position: absolute; left: 20px; width: 50px; text-align: center\">ID</span>";
            html += "  <span style=\"position: absolute; left: 70px; width: 200px; text-align: left\">Agent Name</span>";
            html += "  <span style=\"position: absolute; left: 200px; width: 60px; text-align: center\">(Sales)</span>";
            html += "  <span style=\"position: absolute; left: 280px; width: 60px; text-align: center\">(Sales)/hr</span>";
            html += "  <span style=\"position: absolute; left: 380px; width: 60px; text-align: left\">Pres.</span>";
            html += "  <span style=\"position: absolute; left: 460px; width: 60px; text-align: center\">/hr</span>";
            html += "  <span style=\"position: absolute; left: 550px; width: 60px; text-align: center\">Sales %</span>";
            html += "  <span style=\"position: absolute; left: 670px; width: 90px; text-align: center\">%</span>";
            html += "  <span style=\"position: absolute; left: 800px; width: 140px; text-align: center\">Presentations %</span>";
            html += "</div>";
// JMA: End Insert


// JMA: Start Print Campaign Summaries



            // End of document
            html += "</div>\n\n";
            return(html);
        }
Exemple #46
0
 public void Add(Gamer gamer, Campaign campaign)
 {
     Console.WriteLine(gamer.Id + " Numaralı müşteri " + campaign.CampaignName + " adlı kampanyadan yararlandı ");
 }
Exemple #47
0
 public void Delete(Campaign campaign)
 {
     campaignList.Remove(campaign);
     Console.WriteLine(campaign.Name + " adlı kampanya başarıyla sistemden silindi.");
 }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        public void Run(GoogleAdsClient client, long customerId)
        {
            // Get the CampaignService.
            CampaignServiceClient campaignService = client.GetService(Services.V0.CampaignService);

            // Create a budget to be used for the campaign.
            string budget = CreateBudget(client, customerId);

            List <CampaignOperation> operations = new List <CampaignOperation>();

            for (int i = 0; i < NUM_CAMPAIGNS_TO_CREATE; i++)
            {
                // Create the campaign.
                Campaign campaign = new Campaign();
                campaign.Name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString();
                campaign.AdvertisingChannelType = AdvertisingChannelType.Search;

                // Recommendation: Set the campaign to PAUSED when creating it to prevent
                // the ads from immediately serving. Set to ENABLED once you've added
                // targeting and the ads are ready to serve
                campaign.Status = CampaignStatus.Paused;

                // Set the bidding strategy and budget.
                campaign.ManualCpc      = new ManualCpc();
                campaign.CampaignBudget = budget;

                // Set the campaign network options.
                campaign.NetworkSettings = new NetworkSettings
                {
                    TargetGoogleSearch         = true,
                    TargetSearchNetwork        = true,
                    TargetContentNetwork       = false,
                    TargetPartnerSearchNetwork = false
                };

                // Optional: Set the start date.
                campaign.StartDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd");

                // Optional: Set the end date.
                campaign.EndDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd");

                // Create the operation.
                CampaignOperation operation = new CampaignOperation();
                operation.Create = campaign;
                operations.Add(operation);
            }
            try
            {
                // Add the campaigns.
                MutateCampaignsResponse retVal = campaignService.MutateCampaigns(
                    customerId.ToString(), operations.ToArray());

                // Display the results.
                if (retVal.Results.Count > 0)
                {
                    foreach (MutateCampaignResult newCampaign in retVal.Results)
                    {
                        Console.WriteLine("Campaign with resource ID = '{0}' was added.",
                                          newCampaign.ResourceName);
                    }
                }
                else
                {
                    Console.WriteLine("No campaigns were added.");
                }
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
            }
        }
 public void Delete(Campaign campaign)
 {
     Console.WriteLine("Campaign was deleted: " + campaign.Name);
 }
Exemple #50
0
 public void CampaignSale(Frisky frisky, Game game, Campaign campaign)
 {
     Console.WriteLine("'" + frisky.FirstName + " " + frisky.LastName + "'" + " purchased the game named " + "'" + game.Name + "' with " + campaign.Discount + " % discount");
 }
Exemple #51
0
 public void Add(Campaign campaign)
 {
     campaignList.Add(campaign);
     Console.WriteLine("'" + campaign.Name + "' başarıyla eklendi.");
 }
        public virtual int SendCampaign(Campaign campaign)
        {
            Guard.NotNull(campaign, nameof(campaign));

            var totalEmailsSent = 0;
            var pageIndex       = -1;

            int[] storeIds = null;
            int[] rolesIds = null;
            var   alreadyProcessedEmails = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

            if (campaign.LimitedToStores)
            {
                storeIds = _storeMappingService.GetStoreMappings(campaign)
                           .Select(x => x.StoreId)
                           .Distinct()
                           .ToArray();
            }

            if (campaign.SubjectToAcl)
            {
                rolesIds = _aclService.GetAclRecords(campaign)
                           .Select(x => x.CustomerRoleId)
                           .Distinct()
                           .ToArray();
            }

            while (true)
            {
                var subscribers = _newsLetterSubscriptionService.GetAllNewsLetterSubscriptions(null, ++pageIndex, 500, false, storeIds, rolesIds);

                foreach (var subscriber in subscribers)
                {
                    // Create only one message per subscription email.
                    if (alreadyProcessedEmails.Contains(subscriber.Subscription.Email))
                    {
                        continue;
                    }

                    if (subscriber.Customer != null && !subscriber.Customer.Active)
                    {
                        continue;
                    }

                    var result = SendCampaign(campaign, subscriber);
                    if ((result?.Email?.Id ?? 0) != 0)
                    {
                        alreadyProcessedEmails.Add(subscriber.Subscription.Email);

                        ++totalEmailsSent;
                    }
                }

                if (!subscribers.HasNextPage)
                {
                    break;
                }
            }

            return(totalEmailsSent);
        }
 public async Task <Campaign> AddAsync(Campaign campaign)
 {
     return(await this.CreateAsync(campaign).ConfigureAwait(false));
 }
        public virtual void DeleteCampaign(Campaign campaign)
        {
            Guard.NotNull(campaign, nameof(campaign));

            _campaignRepository.Delete(campaign);
        }
 public void Delete(Campaign campaign)
 {
     Console.WriteLine(campaign.CampaignName + "süresi doldugundan kampanya silindi" + '\n');
 }
Exemple #56
0
        public async Task AnswerCampaign(string campaignId, AnswerCampaignRequest request)
        {
            Campaign campaign = await BuildCampaign(campaignId);

            await campaign.AnswerCampaign(request);
        }
 public static CampaignModel ToModel(this Campaign entity)
 {
     return(entity.MapTo <Campaign, CampaignModel>());
 }
        /// <summary>
        /// Creates a test campaign for running further tests.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="channelType">The advertising channel type for this
        /// campaign.</param>
        /// <param name="strategyType">The bidding strategy to be used for
        /// this campaign.</param>
        /// <param name="isMobile">True, if this campaign is mobile-only, false
        /// otherwise.</param>
        /// <returns>The campaign id.</returns>
        public long CreateCampaign(AdWordsUser user, AdvertisingChannelType channelType,
                                   BiddingStrategyType strategyType, bool isMobile)
        {
            CampaignService campaignService =
                (CampaignService)user.GetService(AdWordsService.v201609.CampaignService);

            Campaign campaign = new Campaign()
            {
                name = string.Format("Campaign {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")),
                advertisingChannelType = channelType,

                // Set the test campaign to PAUSED when creating it to prevent the ads from serving.
                status = CampaignStatus.PAUSED,

                biddingStrategyConfiguration = new BiddingStrategyConfiguration()
                {
                    biddingStrategyType = strategyType
                },
                budget = new Budget()
                {
                    budgetId = CreateBudget(user),
                    amount   = new Money()
                    {
                        microAmount = 100000000,
                    },
                    deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD
                }
            };

            if (isMobile)
            {
                switch (campaign.advertisingChannelType)
                {
                case AdvertisingChannelType.SEARCH:
                    campaign.advertisingChannelSubType = AdvertisingChannelSubType.SEARCH_MOBILE_APP;
                    break;

                case AdvertisingChannelType.DISPLAY:
                    campaign.advertisingChannelSubType = AdvertisingChannelSubType.DISPLAY_MOBILE_APP;
                    break;
                }
            }

            List <Setting> settings = new List <Setting>();

            if (channelType == AdvertisingChannelType.SHOPPING)
            {
                // All Shopping campaigns need a ShoppingSetting.
                ShoppingSetting shoppingSetting = new ShoppingSetting()
                {
                    salesCountry     = "US",
                    campaignPriority = 0,
                    merchantId       = (user.Config as AdWordsAppConfig).MerchantCenterId
                };
                settings.Add(shoppingSetting);
            }
            campaign.settings = settings.ToArray();

            CampaignOperation campaignOperation = new CampaignOperation()
            {
                @operator = Operator.ADD,
                operand   = campaign
            };

            CampaignReturnValue retVal =
                campaignService.mutate(new CampaignOperation[] { campaignOperation });

            return(retVal.value[0].id);
        }
 public static Campaign ToEntity(this CampaignModel model, Campaign destination)
 {
     return(model.MapTo(destination));
 }
Exemple #60
0
        public async Task CancelCampaign(string campaignId)
        {
            Campaign campaign = await BuildCampaign(campaignId);

            await campaign.Cancel();
        }