/* Variables used:
     * TextBoxes:
     * tbGameName
     * tbGameGenre
     * dpGamePlatform
     * tbGamePrice
     * tbImagePath
     * dpUpGameName
     * tbUpGameGenre
     * tbUpGamePlatform
     * tbUpGamePrice
     * tbUpImagePrice
     * tbDelGameName
     * dpDelPlatform
     *
     * Buttons:
     * btnCreate
     * btnUpdate
     * btnDelete
     *
     * Notes: dpGamePlatform should be populated with Platforms from DB
     *
     *
     * */
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder sb      = new StringBuilder();
        ToolboxSetup  toolBox = new ToolboxSetup();

        ToolboxSwitch.Controls.Add(new Literal {
            Text = toolBox.SetToolBox().ToString()
        });
    }
Esempio n. 2
0
    public void gordonsConnString()
    {
        string connectionString = ConfigurationManager.ConnectionStrings["yolo"].ConnectionString;

        conn    = new SqlConnection(connectionString);
        command = new SqlCommand("", conn);

        string query = string.Format("SELECT * FROM Game");

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader  = command.ExecuteReader();
            StringBuilder sb      = new StringBuilder();
            NavbarSetup   navBar  = new NavbarSetup();
            ToolboxSetup  toolBox = new ToolboxSetup();



            //Pad's games past sidebar and formats int table cells.
            sb.Append("<div class=\"game-pad\" >");
            sb.Append("<table>");
            while (reader.Read())
            {
                //variable for elements used
                string gameName  = reader.GetString(1);
                string gameImage = reader.GetString(7);
                double gamePrice = reader.GetDouble(6);

                sb.Append("<td style=\"padding-left:30px;\">");
                sb.Append("<img src=" + gameImage + " height=\"240\" width=\"260\" />");
                sb.Append("<p style=\"text-align:center\">" + gameName + "  $" + gamePrice.ToString() + "</p>");
                sb.Append("</td>");
            }
            sb.Append("</table>");
            sb.Append("</div>");

            GameList.Controls.Add(new Literal {
                Text = sb.ToString()
            });
            MyAccountSwitch.Controls.Add(new Literal {
                Text = navBar.SetNavbar().ToString()
            });
            ToolboxSwitch.Controls.Add(new Literal {
                Text = toolBox.SetToolBox().ToString()
            });
            conn.Close();
        }
        catch (Exception ex)
        {
            //insert error here
        }
    }