Beispiel #1
0
        public static CampaignTrackingMetricDetailVm[] FromCampaignTracking(Campaign campaign, CampaignTracking campaignTracking)
        {
            var urls = new List <CampaignTrackingMetricDetailVm>();

            var proDatas = campaign.ProDatas
                           .Where(x => x.OrderNumber == campaignTracking.OrderNumber && x.SegmentNumber == campaignTracking.SegmentNumber)
                           .OrderByDescending(x => x.ClickCount);

            int index = 1;

            foreach (var proData in proDatas)
            {
                var model = new CampaignTrackingMetricDetailVm
                {
                    SFD_ID          = campaign.Assets.SFDClientId,
                    Client_ID       = SfidLookup.GetCampaignName(campaign.Assets.SFDClientId),
                    Campaign_Name   = campaign.Approved.CampaignName,
                    From_Line       = campaign.Approved.FromLine,
                    Subject_Line    = campaign.Approved.SubjectLine,
                    Deployment_Date = campaign.Approved.DeployDate?.ToString(StringConstants.DateFormatSlashes),

                    URLS          = proData.Destination_URL,
                    Total_Clicks  = proData.ClickCount, //string.Format("{0:n0}", proData.ClickCount),
                    Unique_Clicks = proData.UniqueCnt,
                    Mobile_Clicks = proData.MobileCnt,
                    ID            = index++
                };

                urls.Add(model);
            }
            return(urls.ToArray());
        }
        public static CampaignTrackingMetricVm[] FromCampaignTracking(Campaign campaign, CampaignTracking campaignTracking)
        {
            string filePathLive = $"{S3FileManager.ServerPrefix}{campaign.Assets.OpenModelImageFile}";

            var metrics = new CampaignTrackingMetricVm[1]
            {
                new CampaignTrackingMetricVm
                {
                    SFD_ID           = campaign.Assets.SFDClientId,
                    Client_ID        = SfidLookup.GetCampaignName(campaign.Assets.SFDClientId),
                    Campaign_Name    = campaign.Approved.CampaignName,
                    From_Line        = campaign.Approved.FromLine,
                    Subject_Line     = campaign.Approved.SubjectLine,
                    Deployment_Date  = campaign.Approved.DeployDate?.ToString(StringConstants.DateFormatSlashes),
                    Delivered        = campaignTracking.Quantity,
                    Open_Rate        = campaignTracking.OpenedPercentage,
                    Total_Opens      = campaignTracking.Opened,
                    Total_Clicks     = campaignTracking.Clicked,
                    Click_Percentage = campaignTracking.ClickedPercentage,
                    HTML_CTR         = campaignTracking.ClickToOpenPercentage,
                    Mobile           = campaignTracking.Mobile,
                    Desktop          = campaignTracking.Desktop,
                    Image_URL        = filePathLive
                }
            };

            return(metrics);
        }