public override void DataBind() { Button1.Text = U5007.BORROW; base.DataBind(); CreditLineLoan loan = CreditLineManager.GetUsersLoans(user.Id, false).FirstOrDefault(); if (loan == null) { RepayBorrowDescriptionLiteral.Text = string.Format(U5007.MAXBORROW, CreditLineManager.GetMaxPossibleRequest(user).ToString()); BorrowButton.Visible = true; BorrowButton.Text = U5007.BORROW; RepayButton.Visible = false; RepayPlaceHolder.Visible = false; } else { RepayPlaceHolder.Visible = true; RepayBorrowDescriptionLiteral.Text = string.Format(U5007.CANTBORROWUNTIL, loan.Loaned - loan.Repaid); FirstDateLiteral.Text = loan.FirstDeadline.ToShortDateString(); SecondDateLiteral.Text = loan.SecondDeadline.ToShortDateString(); FinalDateLiteral.Text = loan.FinalDeadline.ToShortDateString(); FirstRepayLiteral.Text = loan.AmounBeforeFirstDeadline.ToString(); SecondRepayLiteral.Text = loan.AmounBeforeSecondDeadline.ToString(); FinalRepayLiteral.Text = loan.Loaned.ToString(); RepayButton.Visible = true; RepayButton.Text = U5007.PAYBACK; BorrowButton.Visible = false; RepayPlaceHolder.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyCreditLineEnabled); user = Member.Current; DataBind(); CreditLineManager.CRON(); }
public static void ValidatePayoutNotConnectedToAmount(Member user) { //Check the status if (user.Status == MemberStatus.VacationMode) { throw new MsgException(U4000.YOUAREINVACATIONMODE); } //Account verification if (AppSettings.Authentication.IsDocumentVerificationEnabled && user.VerificationStatus != VerificationStatus.Verified) { throw new MsgException(U5006.ACCOUNTNOTVERIFIED); } if (user.NumberOfPayoutsToday + 1 > user.Membership.MaxDailyPayouts) { throw new MsgException(string.Format(U6000.TOOMANYWITHDRAWSTODAY, user.Membership.MaxDailyPayouts)); } //Payout Days if (!AppSettings.Representatives.RepresentativesIgnoreWitdrawalRules || !user.IsRepresentative()) { PayoutManager.CheckPayoutsDays(); } //Check negative balance if (user.IsAnyBalanceIsNegative()) { throw new MsgException(U6012.NEGATIVEBALANCEWITHDRAWAL); } //Validate Credit Loans if (CreditLineManager.UserHasUnpaidLoans(user.Id)) { throw new MsgException(U6008.REPAYCREDITLINETOWITHDRAW); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && CPAOffer.CheckCollectedLevelsAmount(user.Name) < 20) { throw new MsgException(String.Format("You didn't collect enaugh CPA/GPT offers from different levels yet. You have already collected and confirmed {0} levels.", CPAOffer.CheckCollectedLevelsAmount(user.Name))); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && user.CashoutsProceed > 0) { throw new MsgException("You already did one payout. You can't do more."); } //Check days restriction between each withdrawals var lastWidthdrawalDate = user.GetLastWithdrawalDate(); if (lastWidthdrawalDate != null && lastWidthdrawalDate > AppSettings.ServerTime.AddDays(-user.Membership.BlockPayoutDays)) { throw new MsgException(string.Format(U6013.TIMEBETWEENPAYOUTERROR, user.Membership.BlockPayoutDays)); } }
protected void RepayBorrow(object sender, EventArgs e) { try { SuccMessagePanel.Visible = false; ErrorMessagePanel.Visible = false; Money amount = Money.Parse(RepayBorrowAmountTextBox.Text); if (amount <= Money.Zero) { throw new MsgException("Amount must be greater than 0."); } int commandArgument = Int32.Parse(((Button)sender).CommandArgument); if (commandArgument == 1) { CreditLineManager.TrySendRequest(user, amount); SuccMessagePanel.Visible = true; SuccMessage.Text = string.Format(U5007.MONEYAFTERAPPROVAL, U6012.PURCHASEBALANCE); } else if (commandArgument == 2) { var realAmount = Money.Zero; CreditLineManager.TryRepayDebt(amount, user, out realAmount); SuccMessagePanel.Visible = true; SuccMessage.Text = string.Format(U5007.SUCCREPAID, realAmount.ToString()); } this.DataBind(); } catch (Exception ex) { if (ex is MsgException) { ErrorMessagePanel.Visible = true; ErrorMessage.Text = ex.Message; } else { ErrorLogger.Log(ex); } } }
private void ValidatePayout() { if (amountToPayout > user.CommissionBalance) { throw new MsgException(L1.NOTENOUGHFUNDS); } if (user.Status == MemberStatus.VacationMode) { throw new MsgException(U4000.YOUAREINVACATIONMODE); } //Validate Credit Loans if (CreditLineManager.UserHasUnpaidLoans(user.Id)) { throw new MsgException(U6008.REPAYCREDITLINETOWITHDRAW); } if (user.NumberOfCommissionPayoutsToday + 1 > user.Membership.MaxCommissionPayoutsPerDay) { throw new MsgException(string.Format(U6000.TOOMANYWITHDRAWSTODAY, user.Membership.MaxCommissionPayoutsPerDay)); } }
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); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyPayoutEnabled); User = Member.Current; if (CreditLineManager.UserHasUnpaidLoans(User.Id)) { CashoutButton.Enabled = CashoutButtonConfirm.Enabled = WithdrawCryptocurrencyButton.Enabled = WithdrawCryptocurrencyConfirmButton.Enabled = CommissionCashoutButton.Enabled = false; UnpaidCreditLineInfo.Visible = true; } if (!Page.IsPostBack) { AppSettings.Reload(); #region Langs & Texts WithdrawCryptocurrencyButton.Text = L1.CASHOUT; WithdrawCryptocurrencyConfirmButton.Text = L1.CONFIRM; CashoutButtonConfirm.Text = L1.CONFIRM; SendWithdrawViaRepresentativeButton.Text = U6010.SENDTRANSFERMESSAGE; ProportionsGridView.EmptyDataText = U5004.NOPAYOUTHISTORY; MainBalanceButton.Text = L1.MAINBALANCE; MaxWithdrawalsButton.Text = U5004.MAXIMUMWITHDRAWAL; CommissionButton.Text = U5004.COMMISSIONBALANCE; WithdrawHistoryButton.Text = L1.HISTORY; CashoutButton.Text = CommissionCashoutButton.Text = L1.CASHOUT; MainBalanceLiteral.Text = User.MainBalance.ToString(); CommissionBalanceLiteral.Text = User.CommissionBalance.ToString(); WithdrawHistoryGridView.EmptyDataText = L1.NODATA; LangAdder.Add(RegularExpressionValidator3, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator1, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator2, L1.ER_BADPIN, true); LangAdder.Add(WithdrawViaRepresentativeButton, U6010.WITHDRAWVIAREPRESENTATIVE); LangAdder.Add(RequiredFieldValidator2, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator4, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator6, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator1, L1.REQ_PP, true); LangAdder.Add(RequiredFieldValidator3, L1.REQ_PP, true); LangAdder.Add(RequiredFieldValidator7, U2502.INVALIDMONEYFORMAT, true); LangAdder.Add(BtcCodeValidator, U6000.INVALIDSECURITYCODE, true); LangAdder.Add(FiatCodeValidator, U6000.INVALIDSECURITYCODE, true); LangAdder.Add(REValidator, U3500.ILLEGALCHARS); #endregion PINDiv1.Visible = PINDiv2.Visible = BtcPinDiv.Visible = AppSettings.Registration.IsPINEnabled; var BtcCryptocurrency = CryptocurrencyFactory.Get <BitcoinCryptocurrency>(); var XrpCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>(); var TokenCryptocurrency = CryptocurrencyFactory.Get <ERC20TokenCryptocurrency>(); //Check if user has some manual payouts waiting var UnpaidRequests = User.GetUnpaidPayoutRequests(); WarningPanel.Visible = UnpaidRequests.exists; WarningLiteral.Text = UnpaidRequests.text; //Generate proper Cashout options RadioFrom.Items.AddRange(GenerateHTMLButtons.CashoutFromItems); if (TitanFeatures.IsRofriqueWorkMines && !CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons()) { RadioFrom.Items.Add(new ListItem("", "BTC")); } CommissionRadioFrom.Items.AddRange(GenerateHTMLButtons.CashoutFromItems); if (RadioFrom.Items.Count < 1) { PayoutPlaceHolder.Visible = false; WarningPanel.Visible = true; WarningLiteral.Text = U5006.PAYOUTUNAVAILABLE; } if (CommissionRadioFrom.Items.Count < 1) { CommissionPayoutPlaceHolder.Visible = false; CommissionWarningPanel.Visible = true; CommissionWarningLiteral.Text = U5006.PAYOUTUNAVAILABLE; } CommissionButton.Visible = AppSettings.Payments.CommissionBalanceWithdrawalEnabled; WithdrawViaRepresentativeButton.Visible = AppSettings.Representatives.RepresentativesHelpWithdrawalEnabled; //Lang CashoutButton.Text = CommissionCashoutButton.Text = L1.CASHOUT; LangAdder.Add(RegularExpressionValidator3, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator1, L1.ER_BADPIN, true); LangAdder.Add(RegularExpressionValidator2, L1.ER_BADPIN, true); LangAdder.Add(WithdrawViaRepresentativeButton, U6010.WITHDRAWVIAREPRESENTATIVE); LangAdder.Add(RequiredFieldValidator2, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator4, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator6, L1.REG_REQ_PIN, true); LangAdder.Add(RequiredFieldValidator1, L1.REQ_PP, true); LangAdder.Add(RequiredFieldValidator3, L1.REQ_PP, true); LangAdder.Add(RequiredFieldValidator7, U2502.INVALIDMONEYFORMAT, true); LangAdder.Add(BtcCodeValidator, U6000.INVALIDSECURITYCODE, true); LangAdder.Add(FiatCodeValidator, U6000.INVALIDSECURITYCODE, true); //Pre-selected tab if (Request.QueryString["b"] != null) { var button = (Button)MenuButtonPlaceHolder.FindControl(Request.QueryString["b"] + "Button"); MenuButton_Click(button, null); } bool PercentOfInvestmentWIthdrawalEnabled = User.Membership.MaxWithdrawalAllowedPerInvestmentPercent < 1000000000; MaxWithdrawalsButton.Visible = AppSettings.Payments.ProportionalPayoutLimitsEnabled || PercentOfInvestmentWIthdrawalEnabled; if (PercentOfInvestmentWIthdrawalEnabled) { MaxWithdrawalAllowedPerInvestmentPercentPlaceHolder.Visible = true; PaymentProportionsManager ppm = new PaymentProportionsManager(User); Money invested = ppm.TotalPaidIn; Money withdrawn = ppm.TotalPaidOut; Money canwithdraw = Money.MultiplyPercent(invested, User.Membership.MaxWithdrawalAllowedPerInvestmentPercent); TotalPaidInLiteral.Text = invested.ToString(); TotalCashoutLiteral.Text = withdrawn.ToString(); HowmuchMoreCanBeWithdrawnLiteral.Text = String.Format(U6005.YOUCANWITHDRAWOFINVESTED, NumberUtils.FormatPercents(User.Membership.MaxWithdrawalAllowedPerInvestmentPercent), canwithdraw.ToString(), "<b>" + (canwithdraw - withdrawn).ToString() + "</b>"); } //Pre-selected tab if (Request.QueryString["b"] != null) { var button = (Button)MenuButtonPlaceHolder.FindControl(Request.QueryString["b"] + "Button"); MenuButton_Click(button, null); } BTCWithdrawalButton.Visible = BtcCryptocurrency.WithdrawalEnabled; XRPWithdrawalButton.Visible = XrpCryptocurrency.WithdrawalEnabled; ERC20TokenButton.Visible = TokenCryptocurrency.WithdrawalEnabled; BTCWithdrawalButton.Text = "BTC"; ERC20TokenButton.Text = String.Format("{0} ({1})", TokenCryptocurrency.Name, TokenCryptocurrency.Code); XRPWithdrawalButton.Text = "XRP"; if (RadioFrom.Items.Count < 1)//No payment processors, let's move to BTC/XRP/ETH tab on start { MainBalanceButton.Visible = false; if (BtcCryptocurrency.WithdrawalEnabled) { MenuButton_Click(BTCWithdrawalButton, null); } else if (XrpCryptocurrency.WithdrawalEnabled) { MenuButton_Click(XRPWithdrawalButton, null); } else if (TokenCryptocurrency.WithdrawalEnabled) { MenuButton_Click(ERC20TokenButton, null); } else { MainBalanceButton.Visible = true; } if (TitanFeatures.IsClickmyad) { MenuButton_Click(XRPWithdrawalButton, null); } } RadioFrom.SelectedIndex = 0; SetProcessorValues(); } SetDropdownItemsValues(RadioFrom); if (TitanFeatures.IsClickmyad) { BTCWithdrawalButton.Visible = false; } if (TitanFeatures.IsTrafficThunder) { MainBalanceButton.Visible = false; MaxWithdrawalsButton.Visible = false; } }