Exemplo n.º 1
0
 protected void ButtonSearch_Click(object sender, EventArgs e)
 {
     if (TextBoxSearch.Text.Length > 0)
     {
         //DataTable resultTable = StockApi.symbolSearch(TextBoxSearch.Text, apiKey: Session["ApiKey"].ToString());
         DataTable resultTable = StockApi.symbolSearchAltername(TextBoxSearch.Text, apiKey: Session["ApiKey"].ToString());
         if (resultTable != null)
         {
             DropDownListStock.Items.Clear();
             DropDownListStock.DataSource     = null;
             DropDownListStock.DataTextField  = "Name";
             DropDownListStock.DataValueField = "Symbol";
             DropDownListStock.DataSource     = resultTable;
             DropDownListStock.DataBind();
             ListItem li = new ListItem("Select Stock", "-1");
             DropDownListStock.Items.Insert(0, li);
             //ddlPortfolios.Items.Clear();
             labelSelectedSymbol.Text = "Selected stock: ";
         }
         else
         {
             //Response.Write("<script language=javascript>alert('" + common.noSymbolFound + "')</script>");
             Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noSymbolFound + "');", true);
         }
     }
     else
     {
         //Response.Write("<script language=javascript>alert('" + common.noTextSearchSymbol + "')</script>");
         Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noTextSearchSymbol + "');", true);
     }
 }
Exemplo n.º 2
0
        public void FillSymbolList()
        {
            DropDownListStock.Items.Clear();
            textboxSelectedSymbol.Text      = "";
            ViewState["GraphScript"]        = "";
            ddlExchange.SelectedIndex       = 0;
            ddlInvestmentType.SelectedIndex = 0;

            StockManager stockManager = new StockManager();
            DataTable    tableStockMaster;

            tableStockMaster = stockManager.getStockMaster();

            if ((tableStockMaster != null) && (tableStockMaster.Rows.Count > 0))
            {
                ViewState["STOCKMASTER"] = tableStockMaster;
                DropDownListStock.Items.Clear();
                DropDownListStock.DataTextField  = "COMP_NAME";
                DropDownListStock.DataValueField = "SYMBOL";
                DropDownListStock.DataSource     = tableStockMaster;
                DropDownListStock.DataBind();
                ListItem li = new ListItem("Select Investment", "-1");
                DropDownListStock.Items.Insert(0, li);
            }
        }
Exemplo n.º 3
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            if (TextBoxSearch.Text.Length > 0)
            {
                DataTable resultTable = StockApi.symbolSearch(TextBoxSearch.Text, apiKey: Session["ApiKey"].ToString());

                if (resultTable != null)
                {
                    DropDownListStock.DataTextField  = "Name";
                    DropDownListStock.DataValueField = "Symbol";
                    DropDownListStock.DataSource     = resultTable;
                    DropDownListStock.DataBind();
                    ListItem li = new ListItem("Select Stock", "-1");
                    DropDownListStock.Items.Insert(0, li);
                    ViewState["GraphScript"] = "Search & Select script";
                    labelSelectedSymbol.Text = "Search & Select script";
                }
                else
                {
                    Response.Write("<script language=javascript>alert('" + common.noSymbolFound + "')</script>");
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('" + common.noTextSearchSymbol + "')</script>");
            }
        }
Exemplo n.º 4
0
        public void LoadPortfolioStockList()
        {
            if (ddlPortfolios.SelectedIndex > 0)
            {
                DropDownListStock.Items.Clear();
                TextBoxSearch.Text              = "";
                textboxSelectedSymbol.Text      = "";
                ViewState["GraphScript"]        = "";
                ddlExchange.SelectedIndex       = 0;
                ddlInvestmentType.SelectedIndex = 0;
                //ViewState["STOCKMASTER"] = null;

                StockManager stockManager = new StockManager();
                DataTable    symbolTable  = stockManager.getSymbolListFromPortfolio(ddlPortfolios.SelectedValue);
                if ((symbolTable != null) && (symbolTable.Rows.Count > 0))
                {
                    //ViewState["STOCKMASTER"] = symbolTable;
                    DropDownListStock.Items.Clear();
                    DropDownListStock.DataTextField  = "COMP_NAME";
                    DropDownListStock.DataValueField = "SYMBOL";
                    DropDownListStock.DataSource     = symbolTable;
                    DropDownListStock.DataBind();

                    ListItem li = new ListItem("Select Investment", "-1");
                    DropDownListStock.Items.Insert(0, li);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noScriptsInPortfolio + "');", true);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets full list of symbols from STOCKMASTER and populates the Drop Down with additional "-1" entry
        /// </summary>
        public void FillSymbolList()
        {
            DropDownListStock.Items.Clear();

            StockManager stockManager = new StockManager();
            DataTable    tableStockMaster;

            tableStockMaster = stockManager.getStockMaster();

            if ((tableStockMaster != null) && (tableStockMaster.Rows.Count > 0))
            {
                ViewState["STOCKMASTER"] = tableStockMaster;
                DropDownListStock.Items.Clear();
                DropDownListStock.DataTextField  = "COMP_NAME";
                DropDownListStock.DataValueField = "SYMBOL";
                DropDownListStock.DataSource     = tableStockMaster;
                DropDownListStock.DataBind();
                ListItem li = new ListItem("Select Investment", "-1");
                DropDownListStock.Items.Insert(0, li);
            }
        }