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 = ""; }
private static void GetChartProperties(StatisticsType Type, List <int> dataIntList = null, List <Money> dataMoneyList = null) { var sb = new StringBuilder(); Statistics stat; switch (Type) { case StatisticsType.PTCClicks: //ADMIN case StatisticsType.FacebookClicks: //ADMIN case StatisticsType.BannerClicks: //ADMIN case StatisticsType.NewMembers: //ADMIN case StatisticsType.AvailableReferrals: //ADMIN case StatisticsType.NormalRentedReferrals: //ADMIN case StatisticsType.BotRentedReferrals: //ADMIN case StatisticsType.PointsExchanged: //ADMIN case StatisticsType.PointsGenerated: //ADMIN case StatisticsType.PointsInSystem: //ADMIN case StatisticsType.SearchesMade: //ADMIN case StatisticsType.VideosWatched: //ADMIN StatisticsManager.CheckAndUpdateStatistics(Type); switch (Type) { case StatisticsType.NewMembers: YName = "New Members"; break; case StatisticsType.AvailableReferrals: YName = "Available referrals"; break; case StatisticsType.NormalRentedReferrals: YName = "Normal referrals"; break; case StatisticsType.BotRentedReferrals: YName = "Bots"; break; case StatisticsType.PointsExchanged: case StatisticsType.PointsInSystem: case StatisticsType.PointsGenerated: YName = AppSettings.PointsName; break; case StatisticsType.VideosWatched: YName = "Videos"; break; case StatisticsType.SearchesMade: YName = "Searches"; break; } stat = new Statistics(Type); AddValuesToArray(TableHelper.GetIntListFromString(stat.Data1), JsonArray); break; case StatisticsType.User_AllCreditedMoney: //USER case StatisticsType.Referrals_AllCreditedMoney: //USER case StatisticsType.Referrals_AdPacks: //USER case StatisticsType.User_CashLinksMoney: //USER case StatisticsType.Referrals_CashLinksMoney: //USER case StatisticsType.User_ArticleSharesMoney: //USER YName = L1.AMOUNT; AddValuesToArray(dataMoneyList, JsonArray); break; //3000 case StatisticsType.User_AllClicks: case StatisticsType.User_Clicks: //USER case StatisticsType.User_PointsEarned: case StatisticsType.User_AllPointsCredited: //USER case StatisticsType.DRClicks: //USER case StatisticsType.RRClicks: case StatisticsType.Referrals_AllCreditedPoints: //USER case StatisticsType.User_ArticleSharesReads: //USER //Check if Points instead of Clicks if (Type == StatisticsType.User_AllPointsCredited || Type == StatisticsType.User_PointsEarned) { YName = AppSettings.PointsName; } if (Type == StatisticsType.User_ArticleSharesReads) { YName = U6012.READS; } AddValuesToArray(dataIntList, JsonArray); break; case StatisticsType.PopularUpgrades: XName = "Upgrade packs"; YName = "Copies bought"; AddValuesToArray(StatisticsManager.GetPopularUpgradesData(), JsonArray); break; case StatisticsType.TotalMembersCount: //ADMIN YName = "Members"; StatisticsManager.CheckAndUpdateStatistics(Type); stat = new Statistics(Type); var list1 = TableHelper.GetIntListFromString(stat.Data1); var list2 = TableHelper.GetIntListFromString(stat.Data2); //Data1 AddValuesToArray(list1, JsonArray, true); Data1Def = "All active members"; //Data2 AddValuesToArray(list2, JsonArray2, true); Data2Def = "Upgraded members"; break; case StatisticsType.Cashflow: //ADMIN YName = "Cashflow"; StatisticsManager.CheckAndUpdateStatistics(Type); stat = new Statistics(Type); var list3 = TableHelper.GetMoneyListFromString(stat.Data1); var list4 = TableHelper.GetMoneyListFromString(stat.Data2); //Data1 AddValuesToArray(list3, JsonArray, true); Data1Def = "Income"; //Data2 AddValuesToArray(list4, JsonArray2, true); Data2Def = "Outcome"; break; case StatisticsType.MembersPerCountry: //ADMIN AddValuesToArray(StatisticsManager.GetMembersPerCountryData(), JsonArray); break; case StatisticsType.AvailableFunds: //ADMIN StatisticsManager.CheckAndUpdateStatistics(Type); YName = "Available funds"; var gatlist = TableHelper.SelectRows <Statistics>(TableHelper.MakeDictionary("Type", (int)Type)); if (gatlist.Count > 0) { //Generate gateways list int index; string name; foreach (var elem in gatlist) { var thelist = TableHelper.GetMoneyListFromString(elem.Data2); var array = new JArray(); AddValuesToArray(thelist, array, true); var jObject = new JObject(); name = elem.Data1; index = name.IndexOf(":", StringComparison.Ordinal); if (index > 0) { name = name.Substring(0, index); } jObject["key"] = name; jObject["values"] = array; jContainer.Add(jObject); } } break; case StatisticsType.Null: break; case StatisticsType.AdPackClicks: break; case StatisticsType.MoneyDistributedPerAdPack: break; } }