Example #1
0
        public static void Add(StatisticsType type, int quantity)
        {
            var stats = new Statistics(type);

            stats.AddToData1(quantity);
            stats.Save();
        }
Example #2
0
        public static void AddToCashflow(Money amount)
        {
            var stats = new Statistics(StatisticsType.Cashflow);

            stats.AddToData1(amount);
            stats.Save();
        }
Example #3
0
    protected void ProcceedWithCredit(int Id)
    {
        //Stats
        var targetStatValue = new Prem.PTC.Statistics.Statistics(Prem.PTC.Statistics.StatisticsType.PTCClicks);

        targetStatValue.AddToData1(1);
        targetStatValue.Save();

        if (Member.IsLogged)
        {
            RegisterUserValidationSummary.Visible = true;
            //Anti-cheat: Check if ad is not already watched
            var User = Member.GetLoggedMember(Context);
            if (User.AdsViewed.Contains(Id))
            {
                DisplayInfo(L1.ALREADYWATCHED, false);
            }
            else
            {
                CaptchaPanel.Visible = false;

                var ad = new PtcAdvert(Id);

                //Use Crediter
                PtcCrediter Crediter   = (PtcCrediter)CrediterFactory.Acquire(User, Titan.CreditType.PTC);
                Money       Calculated = Crediter.CreditMember(ad);

                DisplayInfo(L1.YOUVEBEENCREDITED + " <b>" + Calculated.ToString() + "</b> " +
                            L1.AND + " <b>" + User.Membership.AdvertPointsEarnings.ToString() + "</b> " + AppSettings.PointsName + " " + L1.FORTHISAD, true);

                //Display "Feel free with Ad URL" text
                FeelFreeLiteral.Text = ": <a href=\"" + ad.TargetUrl + "\" target=\"_blank\">" + ad.TargetUrl + "</a>";

                //Force notifiaction refresh (Ads)
                NotificationManager.RefreshWithMember(NotificationType.NewAds, User);

                //Modify the ad info
                ad.Click();
                if (ad.ShouldBeFinished)
                {
                    ad.Status = AdvertStatus.Finished;
                    ad.Save();
                }
                else
                {
                    ad.SaveClicks();
                }

                AnimatedHeight = 90;
            }
        }
        else
        {
            //Non-logged in member
            //Just display 'you must login' message
            DisplayInfo(L1.YOUMUSTBELOGGED, false);
        }
        AdInfoContainer.Text = "";
    }