protected void OfferHeaderRowBound(GridViewRow row) { row.Cells[2].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(true)); row.Cells[3].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(false)); row.Cells[4].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(false)); row.Cells[5].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(true)); }
protected void DetailHeaderRowBound(GridViewRow row, bool isAsk) { row.Cells[0].Text += " #"; row.Cells[2].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(true)); row.Cells[3].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(false)); row.Cells[4].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(true)); row.Cells[5].Text += String.Format("({0})", InternalExchangeManager.GetBalanceSign(false)); }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.InternalExchangeTradingHistoryEnabled); if (!IsPostBack) { SignOfStock = InternalExchangeManager.GetBalanceSign(true); SignOfPurchaseBalance = InternalExchangeManager.GetBalanceSign(false); LangAdders(); DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.InternalExchangeEnabled); SignOfStock = InternalExchangeManager.GetBalanceSign(true); SignOfPurchaseBalance = InternalExchangeManager.GetBalanceSign(false); if (!IsPostBack) { NotVisibleChartData.Text = AppSettings.IsDemo ? InternalExchangeManager.GetTestChartData() : new InternalExchangeCache().Get().ToString(); HideMessagges(); FillData(); LangAdders(); NumberOfStockTextBox.Attributes.Add("onkeyup", "updatePrice();"); ValueOfStockTextBox.Attributes.Add("onkeyup", "updatePrice();"); TotalValueTextBox.Attributes.Add("onkeyup", "updatePriceFromTotal();"); MinimalPriceLabel.Visible = AppSettings.InternalExchange.ICOInternalExchangeMinimalStockPrice == Decimal.Zero ? false : true; } }
protected void UserCurrentAsksAndBids_RowCommand(object sender, GridViewCommandEventArgs e) { var commands = new[] { "finishBid", "finishAsk", "tradeBid", "tradeAsk" }; if (commands.Contains(e.CommandName)) { GridView gridView = (GridView)sender; var index = e.GetSelectedRowIndex() % gridView.PageSize; var row = gridView.Rows[index]; switch (e.CommandName) { case "finishAsk": try { var askId = Int32.Parse(row.Cells[0].Text.Trim()); var currentAsk = new InternalExchangeAsk(askId); if (currentAsk != null) { currentAsk.Withdraw(); SuccessMessageLiteral.Text = String.Format("{0}{1} {2}", InternalExchangeManager.GetBalanceSign(true), FormatDecimal(currentAsk.AskAmount), U6012.RETURNEDTOYOURBALANCE.ToLower()); SuccessMessagePanel.Visible = true; } else { throw new MsgException("Unexpected error: current offer not exist anymore"); } } catch (MsgException ex) { ErrorMessagePanel.Visible = true; ErrorMessageLiteral.Text = ex.Message; } catch (DbException ex) { ErrorMessagePanel.Visible = true; ErrorMessageLiteral.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex.Message); throw ex; } finally { DataBind(); } break; case "finishBid": try { var bidId = Int32.Parse(row.Cells[0].Text.Trim()); var currentBid = new InternalExchangeBid(bidId); if (currentBid != null) { currentBid.Withdraw(); SuccessMessageLiteral.Text = String.Format("{0}{1} {2}", InternalExchangeManager.GetBalanceSign(false), FormatDecimal(currentBid.BidAmount * currentBid.BidValue), U6012.RETURNEDTOYOURBALANCE.ToLower()); SuccessMessagePanel.Visible = true; } else { throw new MsgException("Unexpected error: current offer not exist anymore"); } } catch (MsgException ex) { ErrorMessagePanel.Visible = true; ErrorMessageLiteral.Text = ex.Message; } catch (DbException ex) { ErrorMessagePanel.Visible = true; ErrorMessageLiteral.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex.Message); throw ex; } finally { DataBind(); } break; case "tradeAsk": case "tradeBid": int tradeDetailIndex = (int)ViewState[tradeDetailIndexString]; string tradeDetailGrid = ViewState[tradeDetailGridString].ToString(); if (tradeDetailIndex == index && tradeDetailGrid == gridView.ID) { ViewState[tradeDetailIndexString] = -1; ViewState[tradeDetailGridString] = String.Empty; } else { ViewState[tradeDetailIndexString] = index; ViewState[tradeDetailGridString] = gridView.ID; } DataBind(); break; } } }
protected void AskButton_Click(object sender, EventArgs e) { decimal CurrentMultiplier = AppSettings.InternalExchange.InternalExchangeAskCommissionPercent / 100m; currentMultiplier.Text = CurrentMultiplier.ToString(); decimal dailySellLimit = AppSettings.InternalExchange.InternalExchangePeriodMaxSellAmount; dailySellLimit -= Member.Current.GetInternalExchangeDayAskAmount(); if (dailySellLimit <= 0) { dailySellLimit = 0.0m; SellAmountLimitDescriptionTextBox.Text = U6013.STOCKSELLLIMITREACHED; Amount_RangeValidator.MinimumValue = FormatDecimal(dailySellLimit); } else { SellAmountLimitDescriptionTextBox.Text = U6013.STOCKSELLLIMIT + " " + FormatDecimal(dailySellLimit) + InternalExchangeManager.GetBalanceSign(true); SellAmountLimitDescriptionTextBox.Visible = true; } Decimal CurrentStockWallet = Decimal.Parse(Member.CurrentInCache.GetClearStringBalance(AppSettings.InternalExchange.InternalExchangeStockType)); if (CurrentStockWallet > AppSettings.InternalExchange.InternalExchangeMinimalSellAmount) { Amount_RangeValidator.MaximumValue = CurrentStockWallet < dailySellLimit?FormatDecimal(CurrentStockWallet) : FormatDecimal(dailySellLimit); } else { Amount_RangeValidator.MaximumValue = FormatDecimal(dailySellLimit); } Amount_RangeValidator.Text = "<br/>" + U6013.STOCKSELLERROR; BidButton.CssClass = "TabButton IeOfferNotSelected"; AskButton.CssClass = "TabButton IeOfferSelected"; PricePerStockLabel.Text = String.Format("{0} {1}:", U6012.ASK, String.Format("({0} {1})", Member.CurrentInCache.GetClearStringBalance(AppSettings.InternalExchange.InternalExchangePurchaseVia), U4200.AVAILABLE.ToLower())); }