Beispiel #1
0
        } // END Page_Load

        protected void ShowPageInfo(PAGESDB pages_db)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["page_id"];

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

            // ATTEMPT TO GET PAGE RECORD:
            if (valid)
            {
                Dictionary <String, String> page_record = pages_db.FindPage(Int32.Parse(pageid));

                if (page_record.Count > 0)
                {
                    page_title.Text = page_record["page_title"];
                    page_body.Text  = page_record["page_body"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                edit_page.InnerHtml = "There was an error finding that page.";
            }
        } // END ShowPageInfo
        } // END Page_Load

        protected void ShowPageDetails(PAGESDB pages_db)
        {
            bool   valid  = true;
            string pageid = Request.QueryString["page_id"];

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

            if (valid)
            {
                Dictionary <String, String> page_record = pages_db.FindPage(Int32.Parse(pageid));

                if (page_record.Count > 0)
                {
                    title.InnerHtml        = "for " + page_record["page_title"];
                    page_title.InnerHtml   = page_record["page_title"];
                    body_content.InnerHtml = page_record["page_body"];


                    page_published.InnerHtml = (page_record["page_published"] == "True") ? "Yes" : "No";
                    // SRC: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator
                    // Ternary conditional operator

                    string   page_created          = page_record["date_created"];
                    DateTime date_created_datetime = Convert.ToDateTime(page_created);
                    DateTime date_created_dateonly = date_created_datetime.Date;
                    date_created.InnerHtml = date_created_dateonly.ToString("d");
                    // SRC: HOW TO REMOVE TIME STAMP
                    // https://docs.microsoft.com/en-us/dotnet/api/system.datetime.date?redirectedfrom=MSDN&view=netframework-4.8#System_DateTime_Date
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                page_details.InnerHtml = "There was an error finding that page.";
            }
        } // END ShowPageDetails