protected void AddCommentButton_OnClick(object sender, EventArgs e) { if (Request.Params.Get("foid") != null) { int FinishedTransactionId = Convert.ToInt32(Request.Params.Get("foid")); var FinishedTransaction = new CryptocurrencyFinishedTradeOffer(Convert.ToInt32(FinishedTransactionId)); FinishedTransaction.BuyerComment = AddCommentTextBox.Text; FinishedTransaction.Save(); Response.Redirect("~/user/cctrading/buy.aspx?SelectedTab=3"); } }
public static void CreateNewTemplate(int offerId, int buyerID, int sellerId, CryptocurrencyMoney cryptocurrencyAmount) { CryptocurrencyFinishedTradeOffer NewFinishedTrade = new CryptocurrencyFinishedTradeOffer() { OfferId = offerId, BuyerId = buyerID, SellerId = sellerId, Rating = CryptocurrencyOfferRating.Null, CCAmount = cryptocurrencyAmount, BuyerComment = String.Empty, SellerComment = String.Empty }; NewFinishedTrade.Save(true); }
protected void CurrentUserTransactionsGridView_RowCommand(object sender, GridViewCommandEventArgs e) { var commands = new[] { "ConfirmReceived" }; if (commands.Contains(e.CommandName)) { var index = e.GetSelectedRowIndex() % CurrentUserTransactionsGridView.PageSize; var row = CurrentUserTransactionsGridView.Rows[index]; var TransactionId = (row.Cells[0].Text.Trim()); var Transaction = new CryptocurrencyTradeTransaction(Convert.ToInt32(TransactionId)); var CurrentTradeOffer = new CryptocurrencyTradeOffer(Transaction.OfferId); switch (e.CommandName) { case "ConfirmReceived": int ClientWithCash = -1; if (Transaction.ClientId != Member.CurrentId) { ClientWithCash = Transaction.ClientId; } else { ClientWithCash = CurrentTradeOffer.CreatorId; } var BuyerWithCash = new Member(ClientWithCash); BuyerWithCash.AddToCryptocurrencyBalance(CryptocurrencyType.BTC, Transaction.CCAmount.ToDecimal(), "Cryptocurrency trade", BalanceLogType.CryptocurrencyTrade); Transaction.PaymentStatus = CryptocurrencyTransactionStatus.Finished; Transaction.Save(); CryptocurrencyFinishedTradeOffer.CreateNewTemplate(Transaction.OfferId, ClientWithCash, Member.CurrentId, Transaction.CCAmount); break; } CurrentUserTransactionsGridView.DataBind(); } }
protected void OfferHistoryGridView_DataSource_Init(object sender, EventArgs e) { OfferHistoryGridView_DataSource.SelectCommand = CryptocurrencyFinishedTradeOffer.GetGridViewStringForUserHistory(Member.CurrentId, CryptocurrencyOfferType.Buy); }