protected void TicketsGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "download") { int index = e.GetSelectedRowIndex() % TicketsGridView.PageSize; GridViewRow row = TicketsGridView.Rows[index]; var ticket = new InvestmentTicket(Convert.ToInt32(row.Cells[0].Text.Trim())); var proof = new HtmlInvestmentProofGenerator(ticket); proof.DownloadPdf(); } }
protected void HistoryGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "download") { int index = e.GetSelectedRowIndex() % HistoryGridView.PageSize; GridViewRow row = HistoryGridView.Rows[index]; var plan = new InvestmentUsersPlans(Convert.ToInt32(row.Cells[0].Text.Trim())); var proof = new HtmlInvestmentProofGenerator(plan); proof.DownloadPdf(); } }
private static void BuyPlan(Member user, PurchaseBalances targetBalance, InvestmentPlatformPlan plan, Money planDiff, Money targetPrice = null) { var price = planDiff == Money.Zero ? plan.Price : planDiff; var note = string.Format("{0} purchase", plan.Name); if (targetPrice != null) { price = targetPrice; } //IF TARGET BALANCE != (AR || CASH) IT MEANS THAT WE BUY/UPGRADE FROM PAYMENT BUTTONS if (targetBalance == PurchaseBalances.Cash || targetBalance == PurchaseBalances.Purchase) { PurchaseOption.ChargeBalance(user, price, PurchaseOption.Features.InvestmentPlatform.ToString(), targetBalance, note, BalanceLogType.InvestmentPlatformPlanPurchase); } else { targetBalance = PurchaseBalances.PaymentProcessor; } if (AppSettings.InvestmentPlatform.LevelsEnabled) { InvestmentLevelsManager.CanUserDepositOnLevel(plan, user); } var userPlan = new InvestmentUsersPlans { PlanId = plan.Id, UserId = user.Id, Price = price, Status = PlanStatus.Active, BalanceBoughtType = targetBalance, PurchaseDate = DateTime.Now, MoneyReturned = Money.Zero, MoneyToReturn = Money.MultiplyPercent(price, plan.Roi), CurrentMonthPayout = Money.Zero }; userPlan.Save(); InvestmentLevelsManager.DepositOnLevel(plan, userPlan.Id, user); if (AppSettings.InvestmentPlatform.ProofsEnabled) { HtmlInvestmentProofGenerator proof; if (AppSettings.InvestmentPlatform.LevelsEnabled) { proof = new HtmlInvestmentProofGenerator(InvestmentTicket.GetTicket(user.Id, userPlan.Id)); } else { proof = new HtmlInvestmentProofGenerator(userPlan); } proof.SendPdfViaEmail(); } MatrixBase.TryAddMemberAndCredit(user, price, AdvertType.InvestmentPlan); InvestmentPlanCrediter Crediter = new InvestmentPlanCrediter(user); Crediter.CreditStructure(price); if (user.HasReferer) { TryToSpeedUpReferrer(user.ReferrerId, price, user.Name); Crediter.CreditReferer(price); } }