Ejemplo n.º 1
0
        public Campaign ToCampaign()
        {
            var c = new Campaign();

            c.Id               = Id;
            c.AdvertiserId     = AdvertiserId;
            c.SalespersonId    = SalespersonId;
            c.Name             = Name;
            c.IsDeleted        = IsDeleted;
            c.IsActive         = IsActive;
            c.Price            = Price;
            c.CustomFieldsJson = CustomFieldsJson;

            c.StartDate = AdzerkDateTimeHelpers.ParseAdzerkDate(StartDate);
            if (EndDate != null)
            {
                c.EndDate = AdzerkDateTimeHelpers.ParseAdzerkDate(EndDate);
            }

            if (Flights == null)
            {
                c.Flights = new List <Flight>();
            }
            else
            {
                c.Flights = Flights.Select(f => f.ToFlight());
            }

            return(c);
        }
Ejemplo n.º 2
0
 public Ad ToAd()
 {
     return(new Ad()
     {
         Id = Id,
         CampaignId = CampaignId,
         FlightId = FlightId,
         SiteId = SiteId,
         ZoneId = ZoneId,
         Iframe = Iframe,
         PublisherAccountId = PublisherAccountId,
         Impressions = Impressions,
         Percentage = Percentage,
         DistributionType = (DistributionType)DistributionType,
         IsDeleted = IsDeleted,
         IsActive = IsActive,
         CustomTargeting = CustomTargeting,
         FreqCap = FreqCap,
         FreqCapDuration = FreqCapDuration,
         FreqCapType = (FreqCapType)FreqCapType,
         StartDate = !string.IsNullOrWhiteSpace(StartDate) ? (DateTime?)AdzerkDateTimeHelpers.ParseAdzerkDate(StartDate) : null,
         EndDate = !string.IsNullOrWhiteSpace(EndDate) ? (DateTime?)AdzerkDateTimeHelpers.ParseAdzerkDate(EndDate) : null,
         GoalType = (GoalType)GoalType,
         Goal = Goal,
         IsGoalOverride = IsGoalOverride,
         IsStartDateOverride = IsStartDateOverride,
         ActiveKeywords = ActiveKeywords,
         RtbCustomFields = RtbCustomFields,
         Creative = Creative
     });
 }
Ejemplo n.º 3
0
        public Flight ToFlight()
        {
            var f = new Flight();

            f.Id         = Id;
            f.CampaignId = CampaignId;
            f.PriorityId = PriorityId;
            f.Name       = Name;

            f.StartDate = AdzerkDateTimeHelpers.ParseAdzerkDate(StartDate);
            if (!NoEndDate && EndDate != null)
            {
                f.EndDate = AdzerkDateTimeHelpers.ParseAdzerkDate(EndDate);
            }
            f.NoEndDate = NoEndDate;

            f.Price       = Price;
            f.Impressions = Impressions;

            f.IsUnlimited = IsUnlimited;
            f.IsDeleted   = IsDeleted;
            f.IsActive    = IsActive;
            f.IsCompanion = IsCompanion;

            f.Keywords          = (Keywords ?? "").Split(',').Select(k => k.Trim());
            f.UserAgentKeywords = (UserAgentKeywords ?? "").Split(',').Select(k => k.Trim());

            f.GoalType = (GoalType)GoalType;

            if (RateType.HasValue)
            {
                f.RateType = (RateType)RateType;
            }

            if (CapType.HasValue)
            {
                f.CapType = (CapType)CapType;
            }
            f.DailyCapAmount    = DailyCapAmount;
            f.LifetimeCapAmount = LifetimeCapAmount;

            f.IsFreqCap = IsFreqCap;

            f.FreqCap         = FreqCap;
            f.FreqCapDuration = FreqCapDuration;
            f.FreqCapType     = (FreqCapType)FreqCapType;

            f.DatePartingStartTime = DatePartingStartTime;
            f.DatePartingEndTime   = DatePartingEndTime;

            f.IsSunday    = IsSunday;
            f.IsMonday    = IsMonday;
            f.IsTuesday   = IsTuesday;
            f.IsWednesday = IsWednesday;
            f.IsThursday  = IsThursday;
            f.IsFriday    = IsFriday;
            f.IsSaturday  = IsSaturday;

            f.GeoTargeting      = GeoTargeting;
            f.SiteZoneTargeting = SiteZoneTargeting;
            f.CustomTargeting   = CustomTargeting;

            f.IsECPMOptimized       = IsECPMOptimized;
            f.ECPMOptimizePeriod    = ECPMOptimizePeriod;
            f.ECPMMultiplier        = ECPMMultiplier;
            f.FloorECPM             = FloorECPM;
            f.CeilingECPM           = CeilingECPM;
            f.DefaultECPM           = DefaultECPM;
            f.ECPMBurnInImpressions = ECPMBurnInImpressions;

            f.DeliveryStatus = (DeliveryStatus)DeliveryStatus;

            f.CustomFieldsJson = CustomFieldsJson;

            f.IsNoDuplicates = IsNoDuplicates;
            f.DuplicateMode  = (DuplicateMode?)DuplicateMode;

            return(f);
        }