protected void Update_Page(object sender, EventArgs e)
        {
            Page_DB db = new Page_DB();

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

            if (String.IsNullOrEmpty(page_number))
            {
                valid = false;
            }
            if (valid)
            {
                CRUDpages new_page = new CRUDpages();

                new_page.SetName(page_title.Text);
                new_page.SetBody(page_content.Text);

                try
                {
                    db.UpdatePage(Int32.Parse(page_number), new_page);
                    Response.Redirect("ShowPage.aspx?page_number=" + page_number);
                }
                catch
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                page_title.InnerHtml = "There was an error updating that student.";
            }
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Page_DB db = new Page_DB();
         ShowPageInfo(db);
     }
 }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //I created a ShowPageInfo in the database class, that didn't solve the issue.
            //I'm not sure what else is missing, but perhaps it's something in the Page_DB class.
            Page_DB db = new Page_DB();

            ShowPageInfo(db);
        }
        protected void ListNewPages(Page_DB db)
        {
            string query = "select page_name from PAGES";
            List <Dictionary <string, string> > ds = db.QueryList(query);

            foreach (Dictionary <string, string> row in ds)
            {
                blog_pages.InnerHtml += row["page_name"] + "<br>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page_DB db = new Page_DB();

            CRUDpages new_page = new CRUDpages();

            new CRUDpages.SetName(page_title.text);
            new CRUDpages.SetBody(page_body.text);

            db.addpage(new_page);

            Response.Redirect("ViewPages.aspx");
        }
        protected void ShowPageInfo(Page_DB db)
        {
            bool   valid       = true;
            string page_number = Request.QueryString["page_number"];

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

            if (valid)
            {
                CRUDpages page_record = db.FindPage(Int32.Parse(page_number));
                page_title.InnerHtml = CRUDpages.GetName();
                page_body.Text       = CRUDpages.GetBody();
            }

            if (!valid)
            {
                page_title.InnerHtml = "There was an error finding that page.";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page_DB db = new Page_DB();

            ListNewPages(db);
        }