Ejemplo n.º 1
0
        protected void ShowPageInfo(PAGESDB db)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["pageid"];

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

            if (valid)
            {
                Page page_record = db.FindPage(Int32.Parse(pageid));
                show_page_title.InnerHtml  = page_record.GetBusinessName();
                page_tagline.InnerHtml     = page_record.GetTagline();
                page_title.InnerHtml       = page_record.GetTitle();
                page_subtitle.InnerHtml    = page_record.GetSubtitle();
                page_description.InnerHtml = page_record.GetDescription();
            }
            else
            {
                valid = false;
            }
            if (!valid)
            {
                page_show.InnerHtml = "There was an error fining that page.";
            }
        }
Ejemplo n.º 2
0
        //function used to display the list
        protected void ShowPageInfo(PAGESDB db)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["pageid"];

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

            if (valid)
            {
                Page page_record = db.FindPage(Int32.Parse(pageid));
                page_title.InnerHtml  = page_record.GetBusinessName();
                business_name.Text    = page_record.GetBusinessName();
                tag_line.Text         = page_record.GetTagline();
                title_page.Text       = page_record.GetTitle();
                subtitle_page.Text    = page_record.GetSubtitle();
                description_page.Text = page_record.GetDescription();
            }
            else
            {
                valid = false;
            }
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         PAGESDB db = new PAGESDB();
         //it will call function ShowPageInfo
         ShowPageInfo(db);
     }
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pages_home_result.InnerHtml = "";

            //list is hidden
            home_listitem.Style.Add("display", "none");

            string searchkey = "";

            if (Page.IsPostBack)
            {
                //if the search button is clicked  then and then only the list will be displayed
                home_listitem.Style.Add("display", "block");
                searchkey = search_page.Text;

                // query to get all rows of table if user  clicks  search  button  without typing anything in searchbar
                string query = "select * from pages";
                if (searchkey != "")
                {
                    //if user types somthing in the search  bar then it will search according to the typed text
                    query += " WHERE BUSINESSNAME like '%" + searchkey + "%'";
                    query += " or TITLE like '%" + searchkey + "%'";
                }

                var db = new PAGESDB();
                List <Dictionary <String, String> > rs = db.List_Query(query);
                foreach (Dictionary <String, String> row in rs)
                {
                    //for displaying  in the  list
                    pages_home_result.InnerHtml += "<div class=\"listitem\">";

                    string pageid = row["PAGEID"];

                    string businessname = row["BUSINESSNAME"];
                    pages_home_result.InnerHtml += "<div class=\"col6\"><a href=\"Show_Page.aspx?pageid=" + pageid + "\">" + businessname + "</a></div>";

                    string tagline = row["TAGLINE"];
                    pages_home_result.InnerHtml += "<div class=\"col6\">" + tagline + "</div>";

                    string title = row["TITLE"];
                    pages_home_result.InnerHtml += "<div class=\"col6\">" + title + "</div>";

                    string subtitle = row["SUBTITLE"];
                    pages_home_result.InnerHtml += "<div class=\"col6\">" + subtitle + "</div>";

                    string description = row["DESCRIPTION"];
                    pages_home_result.InnerHtml += "<div class=\"col6\">" + description + "</div>";

                    pages_home_result.InnerHtml += "<div class=\"col6last\"><a href=\"Update_Page.aspx?pageid=" + pageid + "\"><img class=\"icons\" src=\"edit-regular.svg\"/></a></div>";

                    pages_home_result.InnerHtml += "</div>";
                }
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pages_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = page_search.Text;
            }
            string query = "select * from pages";

            if (searchkey != "")
            {
                query += " WHERE BUSINESSNAME like '%" + searchkey + "%' ";
                query += " or TITLE like '%" + searchkey + "%' ";
            }
            sql_debugger_design.InnerHtml = query;

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

            foreach (Dictionary <String, String> row in rs)
            {
                //displaying in the list
                pages_result.InnerHtml += "<div class=\"listitem\">";

                string pageid = row["PAGEID"];

                string businessname = row["BUSINESSNAME"];
                pages_result.InnerHtml += "<div class=\"col6\"><a href=\"Show_Page.aspx?pageid=" + pageid + "\">" + businessname + "</a></div>";

                string tagline = row["TAGLINE"];
                pages_result.InnerHtml += "<div class=\"col6\">" + tagline + "</div>";

                string title = row["TITLE"];
                pages_result.InnerHtml += "<div class=\"col6\">" + title + "</div>";

                string subtitle = row["SUBTITLE"];
                pages_result.InnerHtml += "<div class=\"col6\">" + subtitle + "</div>";

                string description = row["DESCRIPTION"];
                pages_result.InnerHtml += "<div class=\"col6\">" + description + "</div>";

                pages_result.InnerHtml += "<div class=\"col6last\"><a href=\"Update_Page.aspx?pageid=" + pageid + "\"><img class=\"icons\" src=\"edit-regular.svg\"/></a></div>";


                pages_result.InnerHtml += "</div>";
            }
        }
Ejemplo n.º 6
0
        protected void Delete_Page(object sender, EventArgs e)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["pageid"];

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

            PAGESDB db = new PAGESDB();

            if (valid)
            {
                db.DeletePage(Int32.Parse(pageid));
                Response.Redirect("Your_Designs.aspx");
            }
        }
Ejemplo n.º 7
0
        protected void Add_Page(object sender, EventArgs e)
        {   //object of class PAGESDB is created
            PAGESDB db = new PAGESDB();

            //object of class Page is created
            Page new_page = new Page();

            //By using object new_page we are assigning the user input value to the database
            new_page.SetBusinessName(business_name.Text);
            new_page.SetTagline(tag_line.Text);
            new_page.SetTitle(page_title.Text);
            new_page.SetSubtitle(page_subtitle.Text);
            new_page.SetDescription(page_description.Text);

            //with the help of Page object we are inserting data into database by using function AddPage of class PAGESDB
            db.AddPage(new_page);

            //this will redirect the page to Your_Designs
            Response.Redirect("Your_Designs.aspx");
        }
Ejemplo n.º 8
0
        //function used  to update the page content
        protected void UpdatePage(object sender, EventArgs e)
        {
            //object of PAGESDB
            PAGESDB db     = new PAGESDB();
            bool    valid  = true;
            string  pageid = Request.QueryString["pageid"];

            if (String.IsNullOrEmpty(pageid))
            {
                valid = false;
            }
            if (valid)
            {
                //object  of Page
                Page new_page = new Page();
                new_page.SetBusinessName(business_name.Text);
                new_page.SetTagline(tag_line.Text);
                new_page.SetTitle(title_page.Text);
                new_page.SetSubtitle(subtitle_page.Text);
                new_page.SetDescription(description_page.Text);
                try
                {
                    db.Update_Page(Int32.Parse(pageid), new_page);
                    //redirect to  Your_Designs.aspx
                    Response.Redirect("Your_Designs.aspx?pageid=" + pageid);
                }
                catch
                {
                    valid = false;
                }
            }
            if (!valid)
            {
                pages.InnerHtml = "There was an error updating that page.";
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PAGESDB db = new PAGESDB();

            ShowPageInfo(db);
        }