Exemple #1
0
 public StockList.StockInformation this[string stockSymbol]
 {
     [MethodImpl(MethodImplOptions.NoInlining)]
     get
     {
         StockList.StockInformation result;
         if (this.itemsName.ContainsKey(stockSymbol))
         {
             result = this.items[this.itemsName[stockSymbol]];
         }
         else
         {
             result = new StockList.StockInformation
             {
                 Number = -1,
                 Symbol = "#NONE"
             };
         }
         return result;
     }
 }
 private void ViewOddLotSetNewStock(string stockSymbol, bool isForce)
 {
     try
     {
         if (stockSymbol != string.Empty && (this._stockInfoSET == null || isForce || (this._stockInfoSET != null && stockSymbol != this._stockInfoSET.Symbol)))
         {
             StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[stockSymbol + "_ODD"];
             if (stockInformation.Number > 0)
             {
                 this._seriesInfoTFEX = null;
                 this._stockInfoSET = stockInformation;
                 ApplicationInfo.CurrentSymbol = stockSymbol;
                 this.ViewOddLotReloadData();
             }
             else
             {
                 this._stockInfoSET = null;
                 this._seriesInfoTFEX = null;
                 this.intzaLS.ClearAllText();
                 this.intzaViewOddLot.ClearAllText();
                 this.intzaViewOddLotInfo.ClearAllText();
                 this.intzaLS.Redraw();
                 this.intzaViewOddLot.Redraw();
                 this.intzaViewOddLotInfo.Redraw();
             }
         }
         if (this.tscbStock.Text != ApplicationInfo.CurrentSymbol)
         {
             this.tscbStock.Text = ApplicationInfo.CurrentSymbol;
         }
         this.tscbStock.Focus();
         this.tscbStock.SelectAll();
     }
     catch (Exception ex)
     {
         this.ShowError("ViewOddLotSetNewStock", ex);
     }
 }
 private void StockInPlay_SetNewStock(string symbol, bool isForce)
 {
     try
     {
         if (symbol != string.Empty && (isForce || symbol != this._currentSymbol))
         {
             StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[symbol];
             if (stockInformation.Number > 0)
             {
                 this._stockInfoSET = stockInformation;
                 this._seriesInfoTFEX = null;
                 this.intzaInfo.Visible = true;
                 this.intzaInfoTFEX.Visible = false;
                 ApplicationInfo.CurrentSymbol = this._stockInfoSET.Symbol;
                 this._currentSymbol = this._stockInfoSET.Symbol;
                 this.StockInPlayReloadData(0m, "", this._stockInfoSET.Number);
             }
             else
             {
                 SeriesList.SeriesInformation seriesInformation = ApplicationInfo.SeriesInfo[symbol];
                 if (seriesInformation.Symbol != string.Empty)
                 {
                     this._isNewStock = true;
                     this._currentSymbol = seriesInformation.Symbol;
                     this._seriesInfoTFEX = seriesInformation;
                     this._stockInfoSET = null;
                     this.intzaInfoTFEX.Visible = true;
                     this.intzaInfo.Visible = false;
                     ApplicationInfo.CurrentSymbol = seriesInformation.Symbol;
                     this.StockInPlayReloadData_TFEX(seriesInformation.Symbol, seriesInformation.SeriesType, seriesInformation.TickSize, 0m, "");
                 }
             }
         }
         if (this.tscbStock.Text != ApplicationInfo.CurrentSymbol)
         {
             this.tscbStock.Text = ApplicationInfo.CurrentSymbol;
         }
         this.tscbStock.Focus();
         this.tscbStock.SelectAll();
     }
     catch (Exception ex)
     {
         this.ShowError("StockInPlaySetNewStock", ex);
     }
 }
 private void SaleByTime_SetNewStock(string stockSymbol, bool isForce)
 {
     try
     {
         if (stockSymbol != string.Empty)
         {
             if (stockSymbol != string.Empty && (this._stockInfoSET == null || isForce || (this._stockInfoSET != null && stockSymbol != this._stockInfoSET.Symbol)))
             {
                 StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[stockSymbol];
                 if (stockInformation.Number > 0)
                 {
                     this._seriesInfoTFEX = null;
                     this._stockInfoSET = stockInformation;
                     this.intzaInfo.Visible = true;
                     this.intzaInfoTFEX.Visible = false;
                     ApplicationInfo.CurrentSymbol = this._stockInfoSET.Symbol;
                     this._saleByTimePageNo = 1;
                     this.SaleByTimeReloadData();
                 }
                 else
                 {
                     SeriesList.SeriesInformation seriesInformation = ApplicationInfo.SeriesInfo[stockSymbol];
                     if (seriesInformation != null && seriesInformation.Symbol != string.Empty)
                     {
                         this._stockInfoSET = null;
                         this._seriesInfoTFEX = seriesInformation;
                         this.intzaInfoTFEX.Visible = true;
                         this.intzaInfo.Visible = false;
                         ApplicationInfo.CurrentSymbol = this._seriesInfoTFEX.Symbol;
                         this._saleByTimePageNo = 1;
                         this.SaleByTimeReloadData();
                     }
                 }
             }
         }
         if (this.tscbStock.Text != ApplicationInfo.CurrentSymbol)
         {
             this.tscbStock.Text = ApplicationInfo.CurrentSymbol;
         }
         this.tscbStock.Focus();
         this.tscbStock.SelectAll();
     }
     catch (Exception ex)
     {
         this.ShowError("SaleByTimeSetNewStock", ex);
     }
 }
Exemple #5
0
 private void LoadStockInfomation(DataSet dsInvestor)
 {
     try
     {
         if (dsInvestor.Tables.Contains("StockInformation") && dsInvestor.Tables["StockInformation"].Rows.Count > 0)
         {
             ApplicationInfo.StockInfo.ResetData();
             foreach (DataRow dataRow in dsInvestor.Tables["StockInformation"].Rows)
             {
                 StockList.StockInformation stockInformation = new StockList.StockInformation();
                 int num;
                 int.TryParse(dataRow["security_number"].ToString(), out num);
                 stockInformation.Number = num;
                 stockInformation.Symbol = dataRow["security_symbol"].ToString().Trim();
                 decimal num2;
                 decimal.TryParse(dataRow["ceiling"].ToString(), out num2);
                 stockInformation.Ceiling = num2;
                 decimal.TryParse(dataRow["floor"].ToString(), out num2);
                 stockInformation.Floor = num2;
                 decimal.TryParse(dataRow["prior_close_price"].ToString(), out num2);
                 stockInformation.PriorPrice = num2;
                 decimal.TryParse(dataRow["high_price"].ToString(), out num2);
                 stockInformation.HighPrice = num2;
                 decimal.TryParse(dataRow["low_price"].ToString(), out num2);
                 stockInformation.LowPrice = num2;
                 decimal.TryParse(dataRow["last_sale_price"].ToString(), out num2);
                 stockInformation.LastSalePrice = num2;
                 stockInformation.BidPrice1 = dataRow["bid_price1"].ToString();
                 stockInformation.OfferPrice1 = dataRow["offer_price1"].ToString();
                 int.TryParse(dataRow["sector_number"].ToString(), out num);
                 stockInformation.SectorNumber = num;
                 int.TryParse(dataRow["board_lot"].ToString(), out num);
                 stockInformation.BoardLot = num;
                 stockInformation.SecurityType = dataRow["security_type"].ToString();
                 stockInformation.DisplayFlag = dataRow["display_flag"].ToString();
                 stockInformation.MarketId = dataRow["market_id"].ToString();
                 stockInformation.IsOddLot = (dataRow["sIsOdd"].ToString() == "Y");
                 stockInformation.IsCheckSpread = (dataRow["check_spread"].ToString() == "Y");
                 if (stockInformation.IsOddLot)
                 {
                     StockList.StockInformation expr_2AD = stockInformation;
                     expr_2AD.Symbol += "_ODD";
                 }
                 ApplicationInfo.StockInfo.AddItem(stockInformation);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void SetCurrentSymbol(string symbol)
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new ucSendNewOrder.SetCurrentSymbolCallBack(this.SetCurrentSymbol), new object[]
         {
             symbol
         });
     }
     else
     {
         this._stockInfo = ApplicationInfo.StockInfo[symbol];
         if (this._stockInfo.Number > -1)
         {
             if (Settings.Default.MainBottomStyle == 5)
             {
                 this.cbMMStock.Text = this._stockInfo.Symbol;
                 if (!this.cbMMStock.Items.Contains(symbol))
                 {
                     this.cbMMStock.Items.Add(symbol);
                 }
                 this.cbMMPrice.Text = string.Empty;
                 this.tbMMStopPrice.Text = string.Empty;
                 this.tbMMGiveUp.Text = string.Empty;
             }
             else
             {
                 this.cbStock.Text = this._stockInfo.Symbol;
                 if (!this.cbStock.Items.Contains(symbol))
                 {
                     this.cbStock.Items.Add(symbol);
                 }
                 this.chbNVDR.Checked = false;
                 this.cbDepCollateral.Text = "";
                 this.cbCondition.Text = string.Empty;
                 this.cbPrice.Text = string.Empty;
             }
         }
         else
         {
             this._seriesInfoTfex = ApplicationInfo.SeriesInfo[symbol];
             if (this._seriesInfoTfex.Symbol != string.Empty)
             {
                 this.tbSeries.Text = this._seriesInfoTfex.Symbol;
             }
         }
         if (this._isActive)
         {
             this.StartTimerLoadCredit();
         }
     }
 }
        private void cbStock_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                Keys keyCode = e.KeyCode;
                if (keyCode != Keys.Return)
                {
                    switch (keyCode)
                    {
                    case Keys.End:
                    case Keys.Home:
                    case Keys.Down:
                        e.SuppressKeyPress = true;
                        goto IL_377;
                    case Keys.Left:
                        if (Settings.Default.MainBottomStyle == 1)
                        {
                            this.cbSide.Focus();
                        }
                        e.SuppressKeyPress = true;
                        goto IL_377;
                    case Keys.Up:
                        goto IL_377;
                    case Keys.Right:
                        break;
                    default:
                        goto IL_377;
                    }
                }
                if (this.cbStock.Text.Trim() != string.Empty)
                {
                    StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[this.cbStock.Text.Trim()];
                    if (stockInformation.Number > 0)
                    {
                        this._stockInfo = stockInformation;
                        TemplateManager.Instance.SendSymbolLink(this, SymbolLinkSource.StockSymbol, this._stockInfo.Symbol);
                        ApplicationInfo.CurrentSymbol = this._stockInfo.Symbol;

                        if (Settings.Default.BSBoxDefaultPrice == 1)
                        {
                            decimal priceBuff = this._stockInfo.LastSalePrice > 0m ? this._stockInfo.LastSalePrice : this._stockInfo.PriorPrice;
                            this.cbPrice.Text = Utilities.PriceFormat(priceBuff);

                            //Do volumn calcualation
                            if (this._showSide == "B" || this._showSide == "C")
                            {
                                this.tbVolume.Text = Utilities.VolumeFormat(ConvertPricetoVolumn(Convert.ToDecimal(priceBuff)), true);
                            }
                            else if (this._showSide == "S" || this._showSide == "H")
                            {
                                this.ReloadCredit();
                                this.tbVolume.Text = Utilities.VolumeFormat(this.GetOnHand(), true);
                            }

                        }
                        else if (Settings.Default.BSBoxDefaultPrice == 2)
                        {
                            if (this._showSide == "B" || this._showSide == "C")
                            {
                                this.cbPrice.Text = Utilities.PriceFormat(this._stockInfo.OfferPrice1);
                                //Do volumn calcualation
                                this.tbVolume.Text = Utilities.VolumeFormat(ConvertPricetoVolumn(Convert.ToDecimal(this._stockInfo.OfferPrice1)), true);
                            }
                            else if (this._showSide == "S" || this._showSide == "H")
                            {
                                this.cbPrice.Text = Utilities.PriceFormat(this._stockInfo.BidPrice1);
                                //Do volumn calcualation
                                this.ReloadCredit();
                                this.tbVolume.Text = Utilities.VolumeFormat(this.GetOnHand(), true);
                            }
                        }

                        if (Settings.Default.MainBottomStyle == 2 || Settings.Default.MainBottomStyle == 4)
                        {
                            this.btnSendOrder.Focus();
                        }
                        else if (Settings.Default.BSBoxEntryTTF)
                        {
                            this.chbNVDR.Focus();
                        }
                        else
                        {
                            this.tbVolume.Focus();
                        }
                    }
                    else
                    {
                        this.cbStock.Text = this._stockInfo.Symbol;
                        this.cbStock.Focus();
                        this.cbStock.SelectAll();
                    }
                }
                e.SuppressKeyPress = true;
            IL_377: ;
            }
            catch (Exception ex)
            {
                this.ShowError("cbStock_KeyDown", ex);
            }
        }
 private void panelAutoTradeMM_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (sender == this.cbMMStock)
         {
             Keys keyCode = e.KeyCode;
             if (keyCode != Keys.Return)
             {
                 switch (keyCode)
                 {
                 case Keys.End:
                 case Keys.Home:
                 case Keys.Left:
                 case Keys.Down:
                     e.SuppressKeyPress = true;
                     goto IL_251;
                 case Keys.Up:
                     goto IL_251;
                 case Keys.Right:
                     break;
                 default:
                     goto IL_251;
                 }
             }
             if (this.cbMMStock.Text.Trim() != string.Empty)
             {
                 StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[this.cbMMStock.Text.Trim()];
                 if (stockInformation.Number > 0)
                 {
                     this._stockInfo = stockInformation;
                     TemplateManager.Instance.SendSymbolLink(this, SymbolLinkSource.StockSymbol, this._stockInfo.Symbol);
                     ApplicationInfo.CurrentSymbol = this._stockInfo.Symbol;
                     if (this.cbMMPrice.Text == string.Empty)
                     {
                         if (Settings.Default.BSBoxDefaultPrice == 1)
                         {
                             this.cbMMPrice.Text = ((this._stockInfo.LastSalePrice > 0m) ? Utilities.PriceFormat(this._stockInfo.LastSalePrice) : Utilities.PriceFormat(this._stockInfo.PriorPrice));
                         }
                         else if (Settings.Default.BSBoxDefaultPrice == 2)
                         {
                             if (this._showSide == "B")
                             {
                                 this.cbMMPrice.Text = Utilities.PriceFormat(this._stockInfo.OfferPrice1);
                             }
                             else if (this._showSide == "S")
                             {
                                 this.cbMMPrice.Text = Utilities.PriceFormat(this._stockInfo.BidPrice1);
                             }
                         }
                     }
                     this.cbMMPrice.Focus();
                 }
                 else
                 {
                     this.cbMMStock.Text = this._stockInfo.Symbol;
                     this.cbMMStock.Focus();
                     this.cbMMStock.SelectAll();
                 }
             }
             e.SuppressKeyPress = true;
             IL_251:;
         }
         else if (sender == this.cbMMPrice)
         {
             Keys keyCode = e.KeyCode;
             if (keyCode != Keys.Return)
             {
                 switch (keyCode)
                 {
                 case Keys.Left:
                     this.cbMMStock.Focus();
                     e.SuppressKeyPress = true;
                     goto IL_391;
                 case Keys.Up:
                     this.cbMMPrice.Text = Utilities.PriceFormat(this.GetPrice(this.cbMMPrice, true));
                     this.cbMMPrice.SelectAll();
                     e.SuppressKeyPress = true;
                     goto IL_391;
                 case Keys.Right:
                     break;
                 case Keys.Down:
                     this.cbMMPrice.Text = Utilities.PriceFormat(this.GetPrice(this.cbMMPrice, false));
                     this.cbMMPrice.SelectAll();
                     e.SuppressKeyPress = true;
                     goto IL_391;
                 default:
                     goto IL_391;
                 }
             }
             if (this.IsValidPrice(this.cbMMPrice.Text, true, this.cbMMPrice))
             {
                 if (this._showSide == "B")
                 {
                     this.tbMMStopPrice.Focus();
                 }
                 else
                 {
                     this.tbMMGiveUp.Focus();
                 }
             }
             e.SuppressKeyPress = true;
             IL_391:;
         }
         else if (sender == this.tbMMStopPrice)
         {
             Keys keyCode = e.KeyCode;
             if (keyCode != Keys.Return)
             {
                 switch (keyCode)
                 {
                 case Keys.Left:
                     this.cbMMPrice.Focus();
                     e.SuppressKeyPress = true;
                     goto IL_4A4;
                 case Keys.Up:
                     this.tbMMStopPrice.Text = Utilities.PriceFormat(this.GetPrice(this.tbMMStopPrice, true));
                     this.tbMMStopPrice.SelectAll();
                     e.SuppressKeyPress = true;
                     goto IL_4A4;
                 case Keys.Right:
                     break;
                 case Keys.Down:
                     this.tbMMStopPrice.Text = Utilities.PriceFormat(this.GetPrice(this.tbMMStopPrice, false));
                     this.tbMMStopPrice.SelectAll();
                     e.SuppressKeyPress = true;
                     goto IL_4A4;
                 default:
                     goto IL_4A4;
                 }
             }
             if (this.IsValidPrice(this.tbMMStopPrice.Text, true, this.tbMMStopPrice))
             {
                 this.tbMMGiveUp.Focus();
             }
             e.SuppressKeyPress = true;
             IL_4A4:;
         }
         else if (sender == this.tbMMGiveUp)
         {
             Keys keyCode = e.KeyCode;
             if (keyCode != Keys.Return)
             {
                 switch (keyCode)
                 {
                 case Keys.Left:
                     this.tbMMStopPrice.Focus();
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Up:
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Right:
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Down:
                     e.SuppressKeyPress = true;
                     break;
                 }
             }
             else
             {
                 if (FormatUtil.Isnumeric(this.tbMMGiveUp.Text))
                 {
                     if (this.tbMMPin.Text.Trim() == string.Empty)
                     {
                         this.tbMMPin.Focus();
                     }
                     else
                     {
                         this.btnMMSend.PerformClick();
                     }
                 }
                 e.SuppressKeyPress = true;
             }
         }
         else if (sender == this.tbMMPin)
         {
             Keys keyCode = e.KeyCode;
             if (keyCode != Keys.Return)
             {
                 switch (keyCode)
                 {
                 case Keys.Left:
                     this.tbMMGiveUp.Focus();
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Up:
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Right:
                     e.SuppressKeyPress = true;
                     break;
                 case Keys.Down:
                     e.SuppressKeyPress = true;
                     break;
                 }
             }
             else
             {
                 if (this.tbMMPin.Text.Trim() == string.Empty)
                 {
                     this.tbMMPin.Focus();
                 }
                 else
                 {
                     this.btnMMSend.PerformClick();
                 }
                 e.SuppressKeyPress = true;
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError("panelAutoTradeMM_KeyDown", ex);
     }
 }
 public void SetSmartOneClick(string side, string stock, string price, bool isDeposit)
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new ucSendNewOrder.SetSmartOneClickCallBack(this.SetSmartOneClick), new object[]
         {
             side,
             stock,
             price,
             isDeposit
         });
     }
     else
     {
         try
         {
             if (Settings.Default.MainBottomStyle == 5)
             {
                 this.btnStyle_Click(this.btnStyle2, null);
             }
             this._stockInfo = ApplicationInfo.StockInfo[stock];
             if (this._stockInfo.Number > -1)
             {
                 this.SetColorBySide(side);
                 this.StartTimerLoadCredit();
                 this.cbStock.Text = stock;
                 this.chbNVDR.Checked = false;
                 this.cbPrice.Enabled = true;
                 this.cbPrice.Text = price;
                 this.cbDepCollateral.Text = "";
                 this.cbCondition.Text = string.Empty;
                 if (Settings.Default.SmartClickVolume > -1L)
                 {
                     this.tbVolume.Text = Settings.Default.SmartClickVolume.ToString();
                     this.btnSendOrder.PerformClick();
                 }
                 else
                 {
                     this.tbVolume.Focus();
                 }
             }
         }
         catch (Exception ex)
         {
             this.ShowError("SetSmartOnClick", ex);
         }
     }
 }
 private void UpdateToOrderGrid(DataSet ds)
 {
     try
     {
         this.sortGrid1.ClearAllText();
         int num = 0;
         this.sortGrid1.Rows = 50;
         decimal d = 0m;
         decimal d2 = 0m;
         this._TotAmount = 0m;
         string text = string.Empty;
         foreach (DataRow dataRow in ds.Tables[0].Rows)
         {
             this._stockInfo = null;
             long num2 = 0L;
             long num3 = 0L;
             if (num >= this.sortGrid1.Rows)
             {
                 break;
             }
             RecordItem recordItem = this.sortGrid1.Records(num);
             text = dataRow["Side"].ToString().ToUpper();
             if (text == "BUY")
             {
                 text = "B";
             }
             else if (text == "SELL")
             {
                 text = "S";
             }
             else if (text == "COVER")
             {
                 text = "C";
             }
             else if (text == "SHORT")
             {
                 text = "H";
             }
             recordItem.Fields("side").Text = text;
             recordItem.Fields("stock").Text = dataRow["Stock"].ToString().ToUpper();
             recordItem.Fields("ttf").Text = ((dataRow["NVDR"].ToString().Trim() == "0") ? "" : dataRow["NVDR"].ToString().Trim());
             recordItem.Fields("volume").Text = FormatUtil.VolumeFormat(dataRow["Volume"], true);
             recordItem.Fields("price").Text = FormatUtil.PriceFormat(dataRow["Price"].ToString().Trim(), 2, 0);
             recordItem.Fields("pubvol").Text = FormatUtil.VolumeFormat(FormatUtil.Isnumeric(dataRow["PublishVol"]) ? dataRow["PublishVol"] : dataRow["Volume"], true);
             recordItem.Fields("condition").Text = dataRow["Validity"];
             recordItem.Fields("deposit").Text = "";
             recordItem.Fields("processstatus").Text = "";
             recordItem.Fields("checkbox").Text = 0;
             this._stockInfo = ApplicationInfo.StockInfo[dataRow["Stock"].ToString().Trim()];
             if (this._stockInfo != null && this._stockInfo.Number > -1)
             {
                 if (dataRow["Volume"].ToString().Replace(",", "").IndexOf(".") > 0)
                 {
                     long.TryParse(dataRow["Volume"].ToString().Replace(",", "").Substring(0, dataRow["Volume"].ToString().Replace(",", "").IndexOf(".")), out num2);
                 }
                 else
                 {
                     long.TryParse(dataRow["Volume"].ToString().Replace(",", ""), out num2);
                 }
                 if (dataRow["PublishVol"].ToString().Replace(",", "").IndexOf(".") > 0)
                 {
                     long.TryParse(dataRow["PublishVol"].ToString().Replace(",", "").Substring(0, dataRow["PublishVol"].ToString().Replace(",", "").IndexOf(".")), out num3);
                 }
                 else
                 {
                     long.TryParse(dataRow["PublishVol"].ToString().Replace(",", ""), out num3);
                 }
                 if (num3 <= 0L)
                 {
                     num3 = num2;
                 }
                 recordItem.Fields("pubvol").Text = FormatUtil.VolumeFormat(num3.ToString(), true);
                 if (dataRow["Price"].ToString() == "ATO" || dataRow["Price"].ToString() == "ATC" || dataRow["Price"].ToString() == "MP")
                 {
                     if (text == "B" || text == "C")
                     {
                         d = this._stockInfo.Ceiling;
                     }
                     else if (text == "S" || text == "H")
                     {
                         d = this._stockInfo.Floor;
                     }
                 }
                 else
                 {
                     decimal.TryParse(dataRow["Price"].ToString().Replace(",", ""), out d);
                 }
                 d2 = num2 * d;
                 this._TotAmount += d2;
             }
             recordItem.Fields("amount").Text = FormatUtil.PriceFormat(d2.ToString());
             if (text == "B")
             {
                 recordItem.Fields("side").FontColor = Color.Lime;
             }
             else if (text == "S")
             {
                 recordItem.Fields("side").FontColor = Color.Red;
             }
             else if (text == "C")
             {
                 recordItem.Fields("side").FontColor = Color.Cyan;
             }
             else if (text == "H")
             {
                 recordItem.Fields("side").FontColor = Color.Pink;
             }
             else
             {
                 recordItem.Fields("side").FontColor = Color.White;
             }
             recordItem.Fields("amount").FontColor = Color.Cyan;
             recordItem.Changed = true;
             num++;
         }
         this.tslbTotAmount.Text = Utilities.PriceFormat(this._TotAmount);
         this._stockInfo = null;
         this.sortGrid1.Redraw();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void calAmountPerRow()
 {
     try
     {
         long value = 0L;
         decimal d = 0m;
         decimal num = 0m;
         this._TotAmount = 0m;
         int i = this.sortGrid1.FocusItemIndex;
         if (i > -1)
         {
             RecordItem recordItem = this.sortGrid1.Records(i);
             this._stockInfo = null;
             this._stockInfo = ApplicationInfo.StockInfo[recordItem.Fields("stock").Text.ToString().Trim()];
             if (this._stockInfo != null && this._stockInfo.Number > -1)
             {
                 if (recordItem.Fields("volume").Text.ToString().Replace(",", "").IndexOf(".") > 0)
                 {
                     long.TryParse(recordItem.Fields("volume").Text.ToString().Replace(",", "").Substring(0, recordItem.Fields("volume").Text.ToString().Replace(",", "").IndexOf(".")), out value);
                 }
                 else
                 {
                     long.TryParse(recordItem.Fields("volume").Text.ToString().Replace(",", ""), out value);
                 }
                 if (recordItem.Fields("price").Text.ToString() == "ATO" || recordItem.Fields("price").Text.ToString() == "ATC" || recordItem.Fields("price").Text.ToString() == "MP" || recordItem.Fields("price").Text.ToString() == "MO" || recordItem.Fields("price").Text.ToString() == "ML")
                 {
                     string text = recordItem.Fields("side").Text.ToString().Trim();
                     if (text != null)
                     {
                         if (!(text == "B") && !(text == "C"))
                         {
                             if (text == "S" || text == "H")
                             {
                                 d = this._stockInfo.Floor;
                             }
                         }
                         else
                         {
                             d = this._stockInfo.Ceiling;
                         }
                     }
                 }
                 else
                 {
                     decimal.TryParse(recordItem.Fields("price").Text.ToString().Replace(",", ""), out d);
                 }
                 num = value * d;
                 recordItem.Fields("amount").Text = num.ToString();
                 recordItem.Fields("amount").FontColor = Color.Cyan;
                 if (num > 0m)
                 {
                     recordItem.Fields("checkbox").Text = "0";
                 }
                 else
                 {
                     recordItem.Fields("checkbox").Text = "";
                 }
                 this.sortGrid1.Redraw();
             }
         }
         this._TotAmount = 0m;
         for (i = 0; i < this.sortGrid1.Rows; i++)
         {
             RecordItem recordItem = this.sortGrid1.Records(i);
             decimal.TryParse(recordItem.Fields("amount").Text.ToString(), out num);
             this._TotAmount += num;
         }
         this.tslbTotAmount.Text = Utilities.PriceFormat(this._TotAmount);
     }
     catch (Exception ex)
     {
         this.ShowError("calAmountPerRow", ex);
     }
 }
 private void SetNewStock_Info(string stockSymbol, bool isFocus)
 {
     if (this.tStripMenu.InvokeRequired)
     {
         this.tStripMenu.Invoke(new frmMarketWatch.SetNewStockInfoCallBack(this.SetNewStock_Info), new object[]
         {
             stockSymbol,
             isFocus
         });
     }
     else
     {
         try
         {
             if (!this.IsInfoLoading)
             {
                 if ((stockSymbol != string.Empty && stockSymbol != this._currentStock) || ApplicationInfo.IsResumeState)
                 {
                     StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[stockSymbol];
                     if (stockInformation.Number > 0)
                     {
                         this._stockInfoSET = stockInformation;
                         this._seriesInfoTFEX = null;
                         ApplicationInfo.CurrentSymbol = this._stockInfoSET.Symbol;
                         ApplicationInfo.CurrStockInMktWatch = this._stockInfoSET.Symbol;
                         this._currentStock = this._stockInfoSET.Symbol;
                         TemplateManager.Instance.SendSymbolLink(this, SymbolLinkSource.SmartStock, this._currentStock);
                         this.intzaInfo.Visible = true;
                         this.intzaInfoTFEX.Visible = false;
                         this.tStripBBO.SuspendLayout();
                         this.tsSectorName.Visible = true;
                         this.tsSectorIndex.Visible = true;
                         this.tsbtnHChart.Visible = true;
                         this.tsbtnSETNews.Visible = true;
                         this.tsbtnVolAs.Visible = true;
                         this.tslbTfexHigh.Visible = false;
                         this.tstbTfexHigh.Visible = false;
                         this.tslbTfexLow.Visible = false;
                         this.tstbTfexLow.Visible = false;
                         this.tStripBBO.ResumeLayout();
                         this._currentIsSET = true;
                         this.ReloadData();
                     }
                     else
                     {
                         SeriesList.SeriesInformation seriesInformation = ApplicationInfo.SeriesInfo[stockSymbol];
                         if (seriesInformation != null & seriesInformation.Symbol != string.Empty)
                         {
                             this._stockInfoSET = null;
                             this._currentIsSET = false;
                             this._seriesInfoTFEX = seriesInformation;
                             ApplicationInfo.CurrentSymbol = seriesInformation.Symbol;
                             this._currentStock = seriesInformation.Symbol;
                             this.intzaInfoTFEX.Visible = true;
                             this.intzaInfo.Visible = false;
                             this.tStripBBO.SuspendLayout();
                             this.tsSectorName.Visible = false;
                             this.tsSectorIndex.Visible = false;
                             this.tsbtnHChart.Visible = false;
                             this.tsbtnSETNews.Visible = false;
                             this.tsbtnVolAs.Visible = false;
                             this._volAsVisible = false;
                             this.panelVolAs.Hide();
                             this.tslbTfexHigh.Visible = true;
                             this.tstbTfexHigh.Visible = true;
                             this.tslbTfexLow.Visible = true;
                             this.tstbTfexLow.Visible = true;
                             this.tStripBBO.ResumeLayout();
                             this.ReloadData();
                         }
                     }
                 }
                 if (this.tstbStock.Text != this._currentStock)
                 {
                     this.tstbStock.Text = this._currentStock;
                     if (!ApplicationInfo.IsOrderBoxFocus && isFocus)
                     {
                         this.tstbStock.Focus();
                         this.tstbStock.SelectAll();
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             this.ShowError("SetNewStockInfo", ex);
         }
     }
 }
 private void setNewStock(string stock, bool isForce)
 {
     try
     {
         StockList.StockInformation stockInformation = ApplicationInfo.StockInfo[stock];
         if (stockInformation.Number > 0)
         {
             if (stockInformation != this._stockInfo || isForce)
             {
                 this._stockInfo = stockInformation;
                 if (this.tmLoad == null)
                 {
                     this.tmLoad = new System.Windows.Forms.Timer();
                     this.tmLoad.Interval = 300;
                     this.tmLoad.Tick += new EventHandler(this.tmLoad_Tick);
                 }
                 this.tmLoad.Stop();
                 this.tmLoad.Start();
             }
         }
         else
         {
             this._stockInfo = null;
             this.IsLoadingData = false;
         }
     }
     catch (Exception ex)
     {
         this.ShowError("setNewStock", ex);
     }
 }