protected void BuyOrUpgradePlan(PurchaseBalances balance) { try { var plan = new InvestmentPlatformPlan(int.Parse(PlansDropDownList.SelectedValue)); var activePlans = CurrentMode == InvestmentPlatformMode.Levels ? 0 : userActivePlans.Count; if (AppSettings.InvestmentPlatform.LevelsEnabled) { InvestmentLevelsManager.CanUserDepositOnLevel(plan, User); } if (plan.MaxPrice > Money.Zero) { if (AppSettings.InvestmentPlatform.InvestmentPlatformPlansPolicy == PlansPolicy.OneUpgradedPlan) { throw new MsgException(U6012.CANTUPGRADERANGEPLAN); } var targetPrice = Money.Parse(RangePriceTextBox.Text); if (plan.CheckPlanPrice(targetPrice)) { InvestmentPlatformManager.BuyOrUpgradePlan(Member.Current, balance, plan, targetPrice); } else { throw new MsgException(U6012.TYPECORRECTPRICE); } } else { InvestmentPlatformManager.BuyOrUpgradePlan(Member.Current, balance, plan); } //IF activePlans = 1, MEANS THAT WE UPGRADE PLAN (ON PlansPolicy.OneUpgradedPlan) if (AppSettings.InvestmentPlatform.InvestmentPlatformPlansPolicy == PlansPolicy.OneUpgradedPlan && activePlans == 1) { SuccessTextLiteral.Text = string.Format(U6011.SUCCESSUPGRADEPLAN, plan.Name); } else { SuccessTextLiteral.Text = string.Format(U6006.SUCCESBOUGHTPLAN, plan.Name); } SuccessPanel.Visible = true; availablePlans = InvestmentPlatformManager.GetAllAvailablePlansForUser(User.Id); InitBuyViewControls(); InitPlans(); } catch (Exception ex) { ErrorPanel.Visible = true; ErrorTextLiteral.Text = ex.Message; if (!(ex is MsgException)) { ErrorLogger.Log(ex); } } }
private void InitManageViewControls() { //TO DO LATER //WithdrawAllMoneyFromSystem.Visible = !AppSettings.InvestmentPlatform.InvestmentPlatformDailyLimitsEnabled; UserPlanDetailsPlaceHolder.Controls.Clear(); InformationLiteral.Text = string.Format("{0}: {1}", U6006.MINAMOUNTTOPAYOUT, User.Membership.InvestmentPlatformMinAmountToCredited); MoneyInSystemLabel.Text = string.Format("{0}: {1}", U6006.MONEYINSYSTEM, InvestmentUsersPlans.GetMoneyInSystemFromFinishedPlans(User.Id)); var userPlans = InvestmentPlatformManager.GetUserActivePlans(User.Id); if (userPlans.Count > 0) { NoPlansPlaceHolder.Visible = false; InformationPanel.Visible = true; UsersPlanPlaceHolder.Visible = true; if (AppSettings.InvestmentPlatform.InvestmentPlatformPlansPolicy == PlansPolicy.OneUpgradedPlan) { var currentPlan = new InvestmentPlatformPlan(userPlans[0].PlanId); UserPlanDetailsPlaceHolder.Controls.Add(GetAdHTML(currentPlan, true, userPlans[0])); ManageDescription.Text = string.Format("{0}:", U6006.YOURPLAN); } else { userPlans.Sort(Comparison); foreach (var plan in userPlans) { var mainPlan = new InvestmentPlatformPlan(plan.PlanId); UserPlanDetailsPlaceHolder.Controls.Add(GetAdHTML(mainPlan, true, plan)); } ManageDescription.Text = string.Format("{0}s:", U6006.YOURPLAN); } } else { InformationPanel.Visible = false; UsersPlanPlaceHolder.Visible = false; NoPlansPlaceHolder.Visible = true; NoPlansLabel.Text = U6006.YOUDONTHAVEANYPLAN; } }
protected void BuyInvestmentPlatformPlan(Member user, Money amount, InvestmentPlatformPlan plan, string from, string transId, string cryptoCurrencyInfo) { bool successful = false; try { if (plan.MaxPrice > Money.Zero) { if (!plan.CheckPlanPrice(amount)) { throw new MsgException("Not enough money sent!"); } InvestmentPlatformManager.BuyOrUpgradePlan(user, PurchaseBalances.PaymentProcessor, plan, amount); successful = true; } else { var price = plan.Price; if (AppSettings.InvestmentPlatform.LevelsEnabled) { price += plan.LevelFee; } if (amount < price) { throw new MsgException("Not enough money sent!"); } InvestmentPlatformManager.BuyOrUpgradePlan(user, PurchaseBalances.PaymentProcessor, plan); successful = true; } } catch (Exception ex) { successful = false; ErrorLogger.Log(ex); } PaymentProcessor PP = PaymentAccountDetails.GetFromStringType(from); CompletedPaymentLog.Create(PP, "Investment Plan", transId, false, user.Name, amount, Money.Zero, successful, cryptoCurrencyInfo); }
private void InitPlans() { switch (CurrentMode) { case InvestmentPlatformMode.Standard: InvestmentPlatformPlaceHolder.Visible = true; InvestmentsPlansPlaceHolder.Controls.Clear(); if (availablePlans.Count == 0) { NoContetntPlaceHolder.Visible = true; BuyOptionsPlaceHolder.Visible = false; InvestmentPlatformPlaceHolder.Visible = false; NoContentLiteral.Text = U6011.NOINVESTMENTPLANS; return; } userActivePlans = InvestmentPlatformManager.GetUserActivePlans(User.Id); var isUpgrade = AppSettings.InvestmentPlatform.InvestmentPlatformPlansPolicy == PlansPolicy.OneUpgradedPlan && userActivePlans.Count > 0; if (isUpgrade) { PurchaseDescriptionLabel.Text = U6011.PLANUPGRADE; } else { PurchaseDescriptionLabel.Text = U6011.PLANBUY; } foreach (var plan in availablePlans) { InvestmentsPlansPlaceHolder.Controls.Add(GetAdHTML(plan)); } break; case InvestmentPlatformMode.Levels: LevelsPlaceHolder.Visible = true; break; } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.InvestmentPlatform.InvestmentPlatformEnabled); if (TitanFeatures.IsRofrique) { BuyOptionsPlaceHolder.Visible = false; } availablePlans = InvestmentPlatformManager.GetAllAvailablePlansForUser(User.Id); if (Request.QueryString["m"] != null) { MenuButton_Click(ManageButton, null); } SuccessPanel.Visible = false; ErrorPanel.Visible = false; InitManageViewControls(); if (!Page.IsPostBack) { InitBuyViewControls(); if (CurrentMode == InvestmentPlatformMode.Levels) { LevelsGridView.Columns[0].HeaderText = U5007.LEVELS.ToUpper(); LevelsGridView.Columns[1].HeaderText = U4200.DEPOSIT; LevelsGridView.Columns[2].HeaderText = U4000.EARNINGS; LevelsGridView.Columns[3].HeaderText = U6012.FEEFOREACHDEPOSIT; LevelsGridView.Columns[4].HeaderText = U6012.MAXIMUMTIMESADAY; LevelsGridView.Columns[5].HeaderText = U6013.AVAILABLEFROM; LevelsGridView.Columns[6].HeaderText = U6013.AVAILABLEWITHPP; } } InitPlans(); }
//TO DO protected void WithdrawAllMoneyFromSystem_Click(object sender, EventArgs e) { try { var userPlans = InvestmentPlatformManager.GetUserActivePlans(User.Id); foreach (var plan in userPlans) { plan.TryToWidthdrawlMoneyFromSystem(true); } SuccessPanel.Visible = true; SuccessTextLiteral.Text = U6010.INVPLATFORMMASSTRANSFERSUCCESS; } catch (MsgException mex) { ErrorPanel.Visible = true; ErrorTextLiteral.Text = mex.Message; } catch (Exception ex) { ErrorLogger.Log(ex); } }
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); } }