protected void ShowSeasonInfo(seasondb db)
        {
            bool   valid     = true;
            string season_id = Request.QueryString["seasonid"];

            if (String.IsNullOrEmpty(season_id))
            {
                valid = false;
            }


            if (valid)
            {
                http_page season_record = db.FindPage(Int32.Parse(season_id));

                s_title.InnerHtml += season_record.GetStitle();
                s_body.InnerHtml  += season_record.GetSbody();
            }
            else
            {
                valid = false;
            }

            if (!valid)
            {
                main_content.InnerHtml = "There was an error finding the season.";
            }
        }
        protected void SeasonTitle(seasondb db)
        {
            seasontitle.InnerHtml = "";

            string search_key = "";
            string query      = "select * from season";

            if (search_key != "")
            {
                query += " WHERE seasonid LIKE '%" + search_key + "%'";
                query += " OR seasontitle LIKE '%" + search_key + "%'";
                query += " OR seasonbody LIKE '%" + search_key + "%'";
            }

            //var db = new seasondb();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                seasontitle.InnerHtml += "";

                string season_id = row["seasonid"];

                string season_title = row["seasontitle"];
                seasontitle.InnerHtml += "<a href=\"showpage.aspx?seasonid=" + season_id + "\">" + season_title + "</a>  ";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            result_season.InnerHtml = "";

            string search_key = "";
            string query      = "select * from season";

            if (search_key != "")
            {
                query += " WHERE seasonid LIKE '%" + search_key + "%'";
                query += " OR seasontitle LIKE '%" + search_key + "%'";
                query += " OR seasonbody LIKE '%" + search_key + "%'";
            }

            var db = new seasondb();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                result_season.InnerHtml += "<div class=\"result_season\">";

                string season_id = row["seasonid"];

                string season_title = row["seasontitle"];
                result_season.InnerHtml += "<a href=\"showpage.aspx?seasonid=" + season_id + "\">" + season_title + ": </a>";

                string season_body = row["seasonbody"];
                result_season.InnerHtml += season_body;

                result_season.InnerHtml += "";
            }
        }
        protected void Update_Page(object sender, EventArgs e)
        {
            seasondb db = new seasondb();

            bool   valid     = true;
            string season_id = Request.QueryString["seasonid"];

            if (String.IsNullOrEmpty(season_id))
            {
                valid = false;
            }

            if (valid)
            {
                http_page new_season = new http_page();

                new_season.SetStitle(s_title.Text);
                new_season.SetSbody(s_body.Text);
                try
                {
                    db.UpdatePage(Int32.Parse(season_id), new_season);
                    Response.Redirect("listpages.aspx?seasonid=" + season_id);
                }
                catch
                {
                    valid = false;
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         seasondb db = new seasondb();
         ShowSeasonInfo(db);
     }
 }
        protected void Add_Page(object sender, EventArgs e)
        {
            seasondb db = new seasondb();

            http_page new_season = new http_page();

            new_season.SetStitle(season_title.Text);
            new_season.SetSbody(season_body.Text);

            db.AddPage(new_season);
            Response.Redirect("listpages.aspx");
        }
        protected void Delete_Season(object sender, EventArgs e)
        {
            bool   valid     = true;
            string season_id = Request.QueryString["seasonid"];

            if (String.IsNullOrEmpty(season_id))
            {
                valid = false;
            }

            seasondb db = new seasondb();

            if (valid)
            {
                db.DeletePage(Int32.Parse(season_id));
                Response.Redirect("listpages.aspx");
            }
            else
            {
                valid = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            seasondb db = new seasondb();

            SeasonTitle(db);
        }