Esempio n. 1
0
        /// <summary>
        /// Handles OnDelete
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnDelete(EventArgs e)
        {
            base.OnDelete(e);

            //  Only attempt to delete the item if it is an existing item
            //  (new items will have "itemID" of -1)
            if (itemID != -1)
            {
                FAQsDB questions = new FAQsDB();
                questions.DeleteFAQ(itemID);
            }
            RedirectBackToReferringPage();
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            //Editor placeholder setup
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()),
                            portalSettings);

            DesktopText.Width  = new Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new Unit(moduleSettings["Height"].ToString());


            //  Determine itemID of FAQ to Update
            if (Request.Params["itemID"] != null)
            {
                itemID = Int32.Parse(Request.Params["itemID"]);
            }

            //	populate with FAQ Details
            if (Page.IsPostBack == false)
            {
                if (itemID != -1)
                {
                    //  get a single row of FAQ info
                    FAQsDB        questions = new FAQsDB();
                    SqlDataReader dr        = questions.GetSingleFAQ(itemID);

                    try
                    {
                        //  Read database
                        dr.Read();
                        Question.Text = (string)dr["Question"];
                        //Answer.Text = (string) dr["Answer"];
                        DesktopText.Text = (string)dr["Answer"];
                        CreatedBy.Text   = (string)dr["CreatedByUser"];
                        CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString();
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (CreatedBy.Text == "unknown" || CreatedBy.Text == string.Empty)
                        {
                            CreatedBy.Text = General.GetString("UNKNOWN", "unknown");
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
            }
        }