コード例 #1
0
    protected void CurrentUserTransactionsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Cells[1].Text = L1.AMOUNT;
            e.Row.Cells[2].Text = U6010.EXECUTIONTIME;
            e.Row.Cells[3].Text = L1.STATUS;
            e.Row.Cells[5].Text = U4200.TIMELEFT;
            e.Row.Cells[6].Text = L1.DESCRIPTION;
        }

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //Loading data for addiotional info
            var CurrentTransaction = new CryptocurrencyTradeTransaction(Int32.Parse(e.Row.Cells[0].Text));
            var CurrentOffer       = new CryptocurrencyTradeOffer(CurrentTransaction.OfferId);

            e.Row.Cells[1].Text = CryptocurrencyMoney.Parse(e.Row.Cells[1].Text).ToString();

            if ((CryptocurrencyTransactionStatus)Int32.Parse(e.Row.Cells[3].Text) == CryptocurrencyTransactionStatus.AwaitingPaymentConfirmation)
            {
                e.Row.Cells[6].Visible = true;
            }
            else
            {
                e.Row.Cells[6].Visible = false;
            }
            e.Row.Cells[3].Text = HtmlCreator.GetColoredTransactionStatus((CryptocurrencyTransactionStatus)Int32.Parse(e.Row.Cells[3].Text));

            //Count Time Left in Escrow
            DateTime ExecutionTime   = DateTime.Parse(e.Row.Cells[2].Text);
            TimeSpan TimeLeft        = AppSettings.ServerTime - ExecutionTime;
            int      TimeLeftMinutes = CurrentOffer.EscrowTime - (int)TimeLeft.TotalMinutes;
            if (TimeLeftMinutes < 0)
            {
                TimeLeftMinutes = 0;
            }

            Label OfferTimeLeftToPayTextBox = new Label();
            OfferTimeLeftToPayTextBox.Text = HtmlCreator.GetColoredTime(TimeLeftMinutes);
            e.Row.Cells[5].Controls.Add(OfferTimeLeftToPayTextBox);

            //Load Description for this offerAddToCryptocurrencyBalance
            Label OfferDescriptionTextBox = new Label();

            //If seller description have data, that means that it is 100% buy offer and tehre is no desc, we have to load seller's description
            if (String.IsNullOrEmpty(CurrentTransaction.SellerDescription) || String.IsNullOrWhiteSpace(CurrentTransaction.SellerDescription))
            {
                OfferDescriptionTextBox.Text = CurrentOffer.Description;
            }
            else
            {
                OfferDescriptionTextBox.Text = CurrentTransaction.SellerDescription;
            }

            OfferDescriptionTextBox.CssClass = "description-column displaynone";
            e.Row.Cells[4].Controls.Add(OfferDescriptionTextBox);
        }
    }