protected void CurrentUserBuyOfferGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[1].Text = L1.DATEADDED; e.Row.Cells[2].Text = L1.PRICE; e.Row.Cells[3].Text = U6010.TRANSACTIONVALUE; e.Row.Cells[4].Text = U6010.AMOUNTTOBUY; e.Row.Cells[5].Text = U6010.AMOUNTLEFT; e.Row.Cells[6].Text = L1.STATUS; } if (e.Row.RowType == DataControlRowType.DataRow) { var CurrentOffer = new CryptocurrencyTradeOffer(Int32.Parse(e.Row.Cells[0].Text)); CryptocurrencyOfferStatus Status = (CryptocurrencyOfferStatus)Convert.ToInt32(e.Row.Cells[6].Text); e.Row.Cells[2].Text = String.Format("{0} / {1}", Money.Parse(e.Row.Cells[2].Text).ToString(), AppSettings.CryptocurrencyTrading.CryptocurrencyCode); e.Row.Cells[3].Text = String.Format("{0} - {1}", CurrentOffer.MinOfferValue, CurrentOffer.MaxOfferValue); e.Row.Cells[4].Text = CryptocurrencyMoney.Parse(e.Row.Cells[4].Text).ToString(); e.Row.Cells[5].Text = CryptocurrencyMoney.Parse(e.Row.Cells[5].Text).ToString(); e.Row.Cells[6].Text = HtmlCreator.GetColoredStatus(Status); if (Status != CryptocurrencyOfferStatus.Paused) { e.Row.Cells[7].Text = " "; } if (Status != CryptocurrencyOfferStatus.Active) { e.Row.Cells[8].Text = " "; } } }
public static string GetColoredStatus(CryptocurrencyOfferStatus status) { if (status == CryptocurrencyOfferStatus.Active) { return("<span style=\"color:#519a06\">" + L1.ACTIVE + "</span>"); } if (status == CryptocurrencyOfferStatus.Paused) { return("<span style=\"color:#CC9933\">" + L1.PAUSED + "</span>"); } if (status == CryptocurrencyOfferStatus.Deleted) { return("<span style=\"color:#CC0000\">" + U6010.REMOVED + "</span>"); } if (status == CryptocurrencyOfferStatus.Finished) { return("<span style=\"color:#660099\">" + L1.FINISHED + "</span>"); } return(""); //for compilator }