コード例 #1
0
        /// <summary>
        /// The Page_Load event handler on this User Control is
        /// used to load and execute a user control block.
        /// The user control to execute is stored in the HtmlText
        /// database table.  This method uses the Rainbow.HtmlTextDB()
        /// data component to encapsulate all data functionality.
        /// Is a simple variation from HtmlModule.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Obtain the selected item from the HtmlText table
            ComponentModuleDB comp = new ComponentModuleDB();
            SqlDataReader     dr   = comp.GetComponentModule(ModuleID);

            try
            {
                if (dr.Read())
                {
                    // Dynamically add the file content into the page
                    string content = (string)dr["Component"];
                    try
                    {
                        ComponentHolder.Controls.Add(ParseControl(content));
                    }
                    catch (Exception controlError)
                    {
                        ComponentHolder.Controls.Add
                            (new LiteralControl("<p>Error in control: " + controlError + "<p>" + content));
                    }
                }
            }
            finally
            {
                // Close the datareader
                dr.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the event to edit.
        /// It then uses the Rainbow.ComponentModuleDB() data component
        /// to populate the page's edit controls with the control details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                // Obtain a single row of event information
                ComponentModuleDB comp = new ComponentModuleDB();
                SqlDataReader     dr   = comp.GetComponentModule(this.ModuleID);

                try
                {
                    // Read first row from database
                    if (dr.Read())
                    {
                        TitleField.Text     = (string)dr["Title"];
                        ComponentField.Text = (string)dr["Component"];
                        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 = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                        }
                    }
                }
                finally
                {
                    dr.Close();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// The UpdateBtn_Click event handler on this Page is used to either
        /// create or update an event.  It uses the Rainbow.EventsDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="e"></param>
        override protected void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Only Update if the Entered Data is Valid
            if (Page.IsValid == true)
            {
                // Create an instance of the Event DB component
                ComponentModuleDB comp = new ComponentModuleDB();

                comp.UpdateComponentModule(ModuleID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text, ComponentField.Text);

                // Redirect back to the portal home page
                this.RedirectBackToReferringPage();
            }
        }