public CampaignData GetCampaignData(decimal conversions)
        {
            decimal amount        = (decimal)_random.Next(14, 47);
            decimal percent       = amount / 100;
            decimal initialAmount = (conversions * percent);
            decimal remaining     = conversions - initialAmount;

            int halfOfConversions = Convert.ToInt32(conversions / 2);

            CampaignData returnValue = new CampaignData();

            int doBranch = _random.Next(1, 100);

            if (doBranch > 50)
            {
                returnValue.Email      = Convert.ToInt32(initialAmount);
                returnValue.Banners    = Convert.ToInt32(remaining * .75m);
                returnValue.PPC        = Convert.ToInt32(remaining * .125m);
                returnValue.ThirdParty = Convert.ToInt32(remaining * .125m);
            }
            else
            {
                returnValue.PPC        = Convert.ToInt32(initialAmount);
                returnValue.ThirdParty = Convert.ToInt32(remaining * .75m);
                returnValue.Email      = Convert.ToInt32(remaining * .125m);
                returnValue.Banners    = Convert.ToInt32(remaining * .125m);
            }

            returnValue.EmailTarget      = halfOfConversions;
            returnValue.BannersTarget    = halfOfConversions;
            returnValue.PPCTarget        = halfOfConversions;
            returnValue.ThirdPartyTarget = halfOfConversions;

            return(returnValue);
        }
예제 #2
0
        public static SummaryData Create(SummaryDataRepository repository)
        {
            int          conversions    = repository.GetConversions();
            int          sessions       = repository.GetSessions();
            decimal      conversionRate = ((decimal)conversions / (decimal)sessions) * 100;
            CampaignData data           = repository.GetCampaignData(conversions);

            SummaryData returnValue = new SummaryData()
            {
                Sessions = sessions,

                Conversions = conversions,

                Spend = repository.GetSpend(),

                ConversionCosts = repository.GetConversionCosts(),

                ReferringDomains = repository.GetReferringDomains(),

                BrandedSearches = repository.GetBrandedSearches(),

                SocialTrend = repository.GetSocialTrend(),

                ConversionRate = conversionRate,

                OnlineSales = repository.GetOnlineSales(),

                Users = sessions,

                PPC       = data.PPC,
                PPCTarget = data.PPCTarget,

                Banners       = data.Banners,
                BannersTarget = data.BannersTarget,

                Email       = data.Email,
                EmailTarget = data.EmailTarget,

                ThirdParty       = data.ThirdParty,
                ThirdPartyTarget = data.ThirdPartyTarget,

                TopPages = repository.GetPageList(),
                Keywords = repository.GetWordList(),

                TrafficStats = repository.GetTrafficStats(sessions, conversions)
            };

            return(returnValue);
        }