Beispiel #1
0
        protected void BuyJackpotTickets(Member user, Money amount, int tickets, Jackpot jackpot, string from, string transId, string cryptoCurrencyInfo)
        {
            bool successful = false;

            try
            {
                if (amount < (jackpot.TicketPrice * tickets))
                {
                    throw new MsgException("Not enough money sent!");
                }

                JackpotManager.GiveTickets(jackpot, user, tickets);

                successful = true;
            }
            catch (Exception ex)
            {
                successful = false;
                ErrorLogger.Log(ex);
            }

            PaymentProcessor PP = PaymentAccountDetails.GetFromStringType(from);

            CompletedPaymentLog.Create(PP, "Jackpot Tickets", transId, false, user.Name, amount, Money.Zero, successful, cryptoCurrencyInfo);
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyJackpotEnabled);

        var activeJackpotList = JackpotManager.GetJackpots(active: true);

        foreach (var jackpot in activeJackpotList)
        {
            JackpotPlaceHolder.Controls.Add(GetJackpotCode(jackpot, isHistory: false));
        }
        if (activeJackpotList.Count <= 0)
        {
            NoDataPanel1.Visible = true;
            NoDataLiteral1.Text  = L1.NODATA;
        }

        var finishedJackpotList = JackpotManager.GetJackpots(active: false).Take(5).ToList();

        foreach (var jackpot in finishedJackpotList)
        {
            JackpotHistoryPlaceHolder.Controls.Add(GetJackpotCode(jackpot, isHistory: true));
        }
        if (finishedJackpotList.Count <= 0)
        {
            NoDataPanel2.Visible = true;
            NoDataLiteral2.Text  = L1.NODATA;
        }

        Button1.Text = L1.ACTIVE;
        Button2.Text = L1.HISTORY;
    }
Beispiel #3
0
    public void BuyTickets(BalanceType purchaseBalanceType)
    {
        EPanel.Visible = SPanel.Visible = false;

        try
        {
            int numberOfTickets;
            if (!Int32.TryParse(NumberOfTicketsTextBox.Text, out numberOfTickets) || numberOfTickets <= 0)
            {
                throw new MsgException(U5003.INVALIDNUMBEROFTICKETS);
            }

            user = Member.Current;

            JackpotManager.BuyTickets(Jackpot, user, numberOfTickets, purchaseBalanceType);
            NumberOfTicketsTextBox.Text = string.Empty;
            SPanel.Visible = true;
            SText.Text     = U5003.TICKETPURCHASESUCCESS.Replace("%n%", numberOfTickets.ToString());
            this.DataBind();
        }
        catch (Exception ex)
        {
            if (ex is MsgException)
            {
                EPanel.Visible = true;
                EText.Text     = ex.Message;
            }
            else
            {
                ErrorLogger.Log(ex);
            }
        }
    }
Beispiel #4
0
        public ApiJackpot(Jackpot jackpot, int userId)
        {
            id          = jackpot.Id;
            title       = jackpot.Name;
            startDate   = jackpot.StartDate;
            endDate     = jackpot.EndDate;
            ticketPrice = new ApiMoney(jackpot.TicketPrice);
            prize       = GetPrizeText(jackpot);

            participats            = jackpot.NumberOfParticipants.HasValue ? jackpot.NumberOfParticipants.Value : 0;
            allTickets             = jackpot.NumberOfTickets.HasValue ? jackpot.NumberOfTickets.Value : 0;
            yourTickets            = JackpotManager.GetNumberOfUsersTickets(jackpot.Id, userId);
            numberOfWinningTickets = 2; //Temp
        }
Beispiel #5
0
        protected override ApiResultMessage HandleRequest(object args)
        {
            string token  = ((JObject)args)["token"].ToString();
            bool   active = (bool)((JObject)args)["active"];

            int            userId   = ApiAccessToken.ValidateAndGetUserId(token);
            List <Jackpot> jackpots = JackpotManager.GetJackpots(active);

            List <ApiJackpot> apiJackpots = jackpots.Select(elem => new ApiJackpot(elem, userId)).ToList();

            return(new ApiResultMessage
            {
                success = true,
                message = String.Empty,
                data = apiJackpots
            });
        }
        protected override ApiResultMessage HandleRequest(object args)
        {
            string token = ((JObject)args)["token"].ToString();
            ApiJackpotTicketPurchaseData data = ((JObject)args).ToObject <ApiJackpotTicketPurchaseData>();

            int userId = ApiAccessToken.ValidateAndGetUserId(token);

            if (!AppSettings.TitanFeatures.MoneyJackpotEnabled)
            {
                throw new MsgException("Jackpot are disabled.");
            }

            Member  user    = new Member(userId);
            Jackpot jackpot = new Jackpot(data.jackpotId);

            if (data.tickets <= 0)
            {
                throw new MsgException(U5003.INVALIDNUMBEROFTICKETS);
            }

            PurchaseBalances balance       = (PurchaseBalances)data.balance;
            BalanceType      targetBalance = PurchaseOption.GetBalanceType(balance);

            var purchaseOption = PurchaseOption.Get(PurchaseOption.Features.Jackpot);

            if (balance == PurchaseBalances.Purchase && !purchaseOption.PurchaseBalanceEnabled)
            {
                throw new MsgException("You can't purchase with that balance.");
            }

            if (balance == PurchaseBalances.Cash && !purchaseOption.CashBalanceEnabled)
            {
                throw new MsgException("You can't purchase with that balance.");
            }

            JackpotManager.BuyTickets(jackpot, user, data.tickets, targetBalance);

            return(new ApiResultMessage
            {
                success = true,
                message = U5003.TICKETPURCHASESUCCESS.Replace("%n%", data.tickets.ToString()),
                data = null
            });
        }
    void Start()
    {
        //Get database
        databaseHandler = GameObject.Find("Database").GetComponent <DatabaseHandler>();

        //Get other objects
        topBarManager      = GameObject.Find("Interface/TopBar").GetComponent <TopBarManager>();
        blockManager       = GameObject.Find("GlobalManagerContainer").GetComponent <BlockManager>();
        networkManager     = GameObject.Find("GlobalManagerContainer").GetComponent <NetworkManager>();
        expectationManager = GameObject.Find("LocalManagerContainer").GetComponent <ExpectationManager>();
        jackpotManager     = GameObject.Find("LocalManagerContainer").GetComponent <JackpotManager>();
        eletricityManager  = GameObject.Find("LocalManagerContainer").GetComponent <ElectricityManager>();
        miningInfoManager  = GameObject.Find("Interface/MiningInfoContainer").GetComponent <MiningInfoManager>();
        bitcoinManager     = GameObject.Find("GlobalManagerContainer").GetComponent <BitcoinManager>();
        currentPoolManager = GameObject.Find("LocalManagerContainer").GetComponent <CurrentPoolManager>();
        badgeManager       = GameObject.Find("LocalManagerContainer").GetComponent <BadgeManager>();
        questionManager    = GameObject.Find("Interface/QuestionContainer/QuestionPanel").GetComponent <QuestionManager>();

        //Initialize
        curretMonth = dateTime.Month;
    }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {      
        if (!Member.IsLogged)
            Response.Redirect(AppSettings.Site.Url);

        var User = Member.CurrentInCache;

        if ((Member.Current.NumberOfWatchedTrafficAdsToday < AppSettings.TrafficExchange.AmountOfAdsToWatchForcedByAdmin))
            NoEarnAccessPlaceHolder.Visible = true;
        else
            NoEarnAccessPlaceHolder.Visible = false;

        #region Customizations
        if (TitanFeatures.IsRetireYoung)
        {
            var balanceField = new BoundField { HeaderText = U5009.BALANCE, DataField = "Id" };
            var aggregateField = new BoundField { HeaderText = U6010.AGGREGATE, DataField = "Id" };

            HistoryGridView.Columns.Add(balanceField);
            HistoryGridView.Columns.Add(aggregateField);

            HistoryGridView.Columns[1].HeaderText = U6010.CONCEPT;
        }

        if (TitanFeatures.IsTrafficThunder)
            AdPacksPlaceHolder.Visible = false;
        else
            AdPacksPlaceHolder.Visible = AppSettings.RevShare.IsRevShareEnabled && AppSettings.TitanFeatures.AdvertAdPacksEnabled && User.IsEarner;

        #endregion

        LogsGridView.EmptyDataText = L1.NODATA;
        HistoryGridView.EmptyDataText = L1.NODATA;

        //Profiling survey
        if (this.CameStraightAfterLogin && !SkippedProfiling && !ProfilingManager.IsProfiled(User))
            Response.Redirect("~/sites/profiler.aspx");

        if ((this.CameStraightAfterLogin && AppSettings.Site.EnableAfterLoginPopup) && (!AppSettings.Site.ShowQuickStartGuideEnabled
            || (AppSettings.Site.ShowQuickStartGuideEnabled && Member.CurrentInCache.IsQuickGuideViewed)))
            DisplayAfterLoginPopup();

        UserStats.StatTitle = U5001.TOTALPOINTSCREDITEDTOYOU.Replace("%n%", AppSettings.PointsName);


        if (User.ResolveReferralsLimitDate != null && User.MembershipExpires == null)
        {
            WarningMemberExpiresAndReferralsResolvedPlaceHolder.Visible = true;
            ReferralsWillBeResolvedWarningLiteral.Text = U6006.WARNING;
            ReferralsWillBeResolveMessageLiteral.Text = string.Format(U6006.MEMBERSHIPEXPIREDREFERRALSWILLBERESOLVED, User.ResolveReferralsLimitDate.Value.Day - DateTime.Now.Day);
        }

        var jackpotWinners = new StringBuilder();
        if (AppSettings.Addons.ShowLastJackpotsWinnersOnUserDashboard && JackpotManager.GetLastJackpotsWinners(out jackpotWinners))
        {
            LastJakpotsWinnersPlaceHolder.Visible = true;
            JakpotsWinnersLiteral.Text = U6008.LASTJACKPOTWINNERSCONGRATULATIONS;
            JakpotsWinnersDetailsLiteral.Text = jackpotWinners.ToString();
        }

        pointsGraph.Visible = AppSettings.Points.PointsEnabled;
        InstantAccrualChartPlaceHolder.Visible = AppSettings.RevShare.AdPack.InstantAccrualsEnabled;
    }
Beispiel #9
0
    public static void ProceedDailyTasks()
    {
        log = new StringBuilder();

        var Entry = new CronEntry();

        Entry.Date = DateTime.Now;

        try
        {
            Log("Starting CRON procedure");

            //Make sure it runs only once
            if (CanRun())
            {
                AppSettings.IsOffline        = true;
                AppSettings.Misc.LastCRONRun = DateTime.Now;
                AppSettings.Misc.Save();
                stime = DateTime.Now;

                AntiCheatSystem.CRON();
                Log("OK [1] AntiCheatSystem. Elapsed time: " + GetTimeString(stime));

                RentReferralsSystem.CRON();
                Log("OK [2] RentedReferralsSystem. Elapsed time: " + GetTimeString(stime));

                StatisticsManager.CRON();
                Log("OK [3a] StatisticsManager. Elapsed time: " + GetTimeString(stime));

                //MUST BE RUN BEFORE MEMBERMANAGER.CRON() !!!
                CustomFeaturesManager.CRON();
                Log("OK [3b] CustomFeaturesManager. Elapsed time: " + GetTimeString(stime));

                MemberManager.CRON();
                Log("OK [4] Member. Elapsed time: " + GetTimeString(stime));

                SyncedNetworkFactory.SynchronizeAll();
                Log("OK [5] CPA Offers. Elapsed time: " + GetTimeString(stime));

                AppSettings.Payments.CRON();
                Log("OK [6] Payments. Elapsed time: " + GetTimeString(stime));

                ShoutboxManager.CRON();
                Log("OK [7] Shoutbox. Elapsed time: " + GetTimeString(stime));

                CLPManager.CRON();
                Log("OK [8] CLPManager. Elapsed time: " + GetTimeString(stime));

                BannerAuctionManager.CRON();
                Log("OK [10] BannerAuctionManager. Elapsed time: " + GetTimeString(stime));

                PointsLockingManager.CRON();
                Log("OK [11] PointsLockingManager. Elapsed time: " + GetTimeString(stime));

                DBArchiver.CRON();
                Log("OK [12] DBArchiver. Elapsed time: " + GetTimeString(stime));

                RevenueSharesDistributionManager.CRON();
                Log("OK [13] RevenueSharesDistributionManager. Elapsed time: " + GetTimeString(stime));

                CreditLineManager.CRON();
                Log("OK [14] CreditLineManager. Elapsed time: " + GetTimeString(stime));

                PoolRotatorManager.CRON();
                Log("OK [15] PoolRotatorManager. Elapsed time: " + GetTimeString(stime));

                JackpotManager.CRON();
                Log("OK [16] JackpotManager. Elapsed time: " + GetTimeString(stime));

                TrafficExchangeManager.CRON();
                Log("OK [17] TrafficExchangeManager. Elapsed time: " + GetTimeString(stime));

                DailyPoolManager.CRON();
                Log("OK [18] DailyPoolManager. Elapsed time: " + GetTimeString(stime));

                //Matrix
                MatrixBase matrix = MatrixFactory.GetMatrix();
                if (matrix != null)
                {
                    matrix.CRON();
                }
                Log("OK [19] MatrixBase. Elapsed time: " + GetTimeString(stime));

                ApiAccessToken.CRON();
                Log("OK [20] ApiAccessToken. Elapsed time: " + GetTimeString(stime));

                InvestmentPlatformManager.CRON();
                Log("OK [21] InvestmentPlatformManager. Elapsed time: " + GetTimeString(stime));

                MarketplaceBalanceLogManager.CRON();
                Log("OK [22] MarketplaceBalanceLogManager. Elapsed time: " + GetTimeString(stime));

                MiniVideoManager.CRON();
                Log("OK [23] MiniVideoManager. Elapsed time: " + GetTimeString(stime));

                PaidToPromoteManager.CRON();
                Log("OK [24] PaidToPromoteManager. Elapsed time: " + GetTimeString(stime));

                RollDiceLotteryManager.CRON();
                Log("OK [25] RollDiceLotteryManager. Elapsed time: " + GetTimeString(stime));

                WalletManager.CRON();
                Log("OK [26] WalletManager. Elapsed time: " + GetTimeString(stime));

                NewsManager.CRON();
                Log("OK [27] NewsManager. Elapsed time: " + GetTimeString(stime));


                Entry.Type = 1;
                Entry.Text = "Procedure completed successfully (27/27 100%) after " + GetTimeString(stime);
            }
            else
            {
                Entry.Type = 2;
                Entry.Text = "Procedure prevented from multiple run";
            }
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            Log("Fatal error (exception thrown)..");
            Entry.Type = 3;
            Entry.Text = "Fatal error during procedure execution. Check logs for more information";
            Mailer.SendCRONFailureMessage();
        }
        finally
        {
            ErrorLogger.Log(log.ToString(), LogType.CRON);
            AppSettings.IsOffline = false;
            Entry.Save();
            HttpContext.Current.Response.Write(Entry.Text);
        }
    }
Beispiel #10
0
    public override void DataBind()
    {
        base.DataBind();
        user    = Member.CurrentInCache;
        Jackpot = new Jackpot(ObjectID);

        if (IsHistory)
        {
            ParticipantsLiteral.Text        = Jackpot.NumberOfParticipants.ToString();
            TicketsLiteral.Text             = Jackpot.NumberOfTickets.ToString();
            BuyTicketsPlaceholder.Visible   = false;
            UsersTicketsPlaceholder.Visible = false;
            HistoryPlaceholder.Visible      = true;

            var winners        = Jackpot.GetDistinctUserWinnerIds();
            var winningTickets = Jackpot.GetWinningTicketNumbers();

            if (winners.Count > 0 && winningTickets.Count > 0)
            {
                var sb = new StringBuilder();

                for (int i = 0; i < winners.Count; i++)
                {
                    string name = new Member((int)winners.ElementAt(i)).Name;
                    sb.Append(name);

                    if (i != winners.Count - 1)
                    {
                        sb.Append(", ");
                    }
                }

                WinnerLiteral.Text = sb.ToString();
                sb.Clear();

                for (int i = 0; i < winningTickets.Count; i++)
                {
                    string ticket = "#" + winningTickets.ElementAt(i).ToString();
                    sb.Append(ticket);

                    if (i != winningTickets.Count - 1)
                    {
                        sb.Append(", ");
                    }
                }

                WinningTicketLiteral.Text = sb.ToString();
            }
            else
            {
                WinnerLiteral.Text        = "-";
                WinningTicketLiteral.Text = "-";
            }
        }
        else
        {
            UsersTicketsPlaceholder.Visible = true;
            ParticipantsLiteral.Text        = JackpotManager.GetNumberOfParticipants(Jackpot.Id).ToString();
            TicketsLiteral.Text             = JackpotManager.GetNumberOfTickets(Jackpot.Id).ToString();
            BuyTicketsPlaceholder.Visible   = true;
            HistoryPlaceholder.Visible      = false;
            TicketList = JackpotManager.GetUsersTickets(Jackpot.Id, user.Id);
            UsersTicketsLiteral.Text = string.Empty;
            StringBuilder sb = new StringBuilder();
            foreach (var ticket in TicketList)
            {
                sb.Append(string.Format("#{0}, ", ticket.Id.ToString()));
            }
            //remove comma
            if (sb.Length > 2)
            {
                sb.Remove(sb.Length - 2, 2);
            }
            else
            {
                sb.Append("-");
            }
            UsersTicketsLiteral.Text = sb.ToString();

            LangAdder.Add(BuyTicketsFromAdBalanceButton, U6012.PAYVIAPURCHASEBALANCE);
            LangAdder.Add(BuyTicketsFromCashBalanceButton, U6005.PAYVIACASHBALANCE);
            LangAdder.Add(BuyTicketsViaPaymentProcessor, U6005.PAYVIAPAYMENTPROCESSOR);

            NumberOfTicketsLiteral.Text = TicketList.Count.ToString();
        }

        HidePrize();
    }