public void UpdatePageCMS(int pagecmsid, PageCMS new_pagecms)
        {
            string query = "update pagecmsinfo set pagecmstitle='{0}', pagecmsbody='{1}' where pagecmsid={2}";

            query = String.Format(query, new_pagecms.GetCMStitle(), new_pagecms.GetCMSbody(), pagecmsid);
            query = String.Format(query, new_pagecms.GetCMStitle(), new_pagecms.GetCMSbody());



            MySqlConnection Connect = new MySqlConnection(ConnectionString);
            MySqlCommand    cmd     = new MySqlCommand(query, Connect);

            try
            {
                Connect.Open();
                cmd.ExecuteNonQuery();
                Debug.WriteLine("Executed query " + query);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Something went wrong in the UpdatePageCMS Method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
        }
Example #2
0
        protected void ShowPageInfo(PagesCMSDB db)
        {
            bool   valid     = true;
            string pagecmsid = Request.QueryString["pagecmsid"];

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


            if (valid)
            {
                PageCMS pagecms_record = db.FindPageCMS(Int32.Parse(pagecmsid));

                pagecms_title.Text = pagecms_record.GetCMStitle();
                pagecms_body.Text  = pagecms_record.GetCMSbody();
            }

            //if not valid
            if (!valid)
            {
                PageUpdateCMS.InnerHtml = "There was an error finding that page.";
            }
        }
Example #3
0
        protected void ShowPageInfo(PagesCMSDB db)
        {   //Debug.WriteLine allows to check for errors in the Debug Output window easier
            Debug.WriteLine("I am trying to show a page");
            bool   valid     = true;
            string pagecmsid = Request.QueryString["pagecmsid"];

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


            if (valid)
            {
                //finds page title and body info and displays it
                PageCMS page_record = db.FindPageCMS(Int32.Parse(pagecmsid));

                Debug.WriteLine("the page is " + page_record.GetCMStitle());
                page_title.InnerHtml = page_record.GetCMStitle();
                page_body.InnerHtml  = page_record.GetCMSbody();
            }
            else
            {
                valid = false;
            }


            if (!valid)
            {   //displays if the user goes to the page directly and not from
                //the list page
                pagecms.InnerHtml = "There was an error finding that page.";
            }
        }
        public void AddPageCMS(PageCMS new_pagecms)
        {
            string query = "insert into pagecmsinfo (pagecmstitle, pagecmsbody) values ('{0}','{1}')";

            query = String.Format(query, new_pagecms.GetCMStitle(), new_pagecms.GetCMSbody());



            MySqlConnection Connect = new MySqlConnection(ConnectionString);
            MySqlCommand    cmd     = new MySqlCommand(query, Connect);

            try
            {
                Connect.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Something went wrong in the AddPageCMS Method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
        }