Пример #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] june-1-2004
            Feedback = Esperantus.Localize.GetString("BLOG_FEEDBACK");

            if (!IsPostBack)
            {
                lnkRSS.HRef       = Rainbow.HttpUrlBuilder.BuildUrl("~/DesktopModules/Blog/RSS.aspx", TabID, "&mID=" + ModuleID);
                imgRSS.Src        = Rainbow.HttpUrlBuilder.BuildUrl("~/DesktopModules/Blog/xml.gif");
                lblCopyright.Text = moduleSettings["Copyright"].ToString();

                BlogDB blogDB = new BlogDB();
                int    month  = -1;
                int    year   = -1;
                try
                {
                    month = int.Parse(Request.Params.Get("month"));
                    year  = int.Parse(Request.Params.Get("year"));
                }
                catch {}

                if ((month > -1) && (year > -1))
                {
                    this.lblHeader.Text = Esperantus.Localize.GetString("BLOG_POSTSFROM", "Posts From", null) +
                                          " " + DateTime.Parse(month.ToString() + "/1/" + year.ToString()).ToString("MMMM, yyyy");
                    myDataList.DataSource = blogDB.GetBlogEntriesByMonth(month, year, ModuleID);
                }
                else
                {
                    myDataList.DataSource = blogDB.GetBlogs(ModuleID);
                }
                myDataList.DataBind();

                dlArchive.DataSource = blogDB.GetBlogMonthArchive(ModuleID);
                dlArchive.DataBind();

                SqlDataReader dataReader = blogDB.GetBlogStats(ModuleID);
                try
                {
                    if (dataReader.Read())
                    {
                        lblEntryCount.Text = Esperantus.Localize.GetString("BLOG_ENTRIES", "Entries", null) +
                                             " (" + (string)dataReader["EntryCount"].ToString() + ")";
                        lblCommentCount.Text = Esperantus.Localize.GetString("BLOG_COMMENTS", "Comments", null) +
                                               " (" + (string)dataReader["CommentCount"].ToString() + ")";
                    }
                }
                finally
                {
                    dataReader.Close();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// The BindData method is used to obtain details of a message
        /// from the Blogs table, and update the page with
        /// the message content.
        /// </summary>
        void BindData()
        {
            // Obtain the selected item from the Blogs table
            BlogDB        blogDB     = new BlogDB();
            SqlDataReader dataReader = blogDB.GetSingleBlog(ItemID);

            try
            {
                // Load first row from database
                if (dataReader.Read())
                {
                    // Update labels with message contents
                    Title.Text       = (string)dataReader["Title"].ToString();
                    txtTitle.Text    = "re: " + (string)dataReader["Title"].ToString();
                    StartDate.Text   = ((DateTime)dataReader["StartDate"]).ToString("dddd MMMM d yyyy hh:mm tt");
                    Description.Text = Server.HtmlDecode((string)dataReader["Description"].ToString());
                }
            }
            finally
            {
                dataReader.Close();
            }
            dlComments.DataSource = blogDB.GetBlogComments(ModuleID, ItemID);
            dlComments.DataBind();

            if (Request.Params.Get("blogUser") != null)
            {
                this.txtName.Text = Request.Params.Get("blogUser");
            }
            if (Request.Params.Get("blogUrl") != null)
            {
                this.txtURL.Text = Request.Params.Get("blogUrl");
            }

            dlArchive.DataSource = blogDB.GetBlogMonthArchive(ModuleID);
            dlArchive.DataBind();

            dataReader = blogDB.GetBlogStats(ModuleID);
            try
            {
                if (dataReader.Read())
                {
                    lblEntryCount.Text = Esperantus.Localize.GetString("BLOG_ENTRIES", "Entries", null) +
                                         " (" + (string)dataReader["EntryCount"].ToString() + ")";
                    lblCommentCount.Text = Esperantus.Localize.GetString("BLOG_COMMENTS", "Comments", null) +
                                           " (" + (string)dataReader["CommentCount"].ToString() + ")";
                }
            }
            finally
            {
                dataReader.Close();
            }
        }
Пример #3
0
        /// <summary>
        /// The Page_Load event handler on this User Control is used to
        /// obtain a DataReader of Blog information from the Blogs
        /// table, and then databind the results to a templated DataList
        /// server control.  It uses the Rainbow.BlogDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] june-1-2004
            Feedback = Esperantus.Localize.GetString("BLOG_FEEDBACK");

            if (!IsPostBack)
            {
                lnkRSS.HRef       = Rainbow.HttpUrlBuilder.BuildUrl("~/DesktopModules/Blog/RSS.aspx", TabID, "&mID=" + ModuleID);
                imgRSS.Src        = Rainbow.HttpUrlBuilder.BuildUrl("~/DesktopModules/Blog/xml.gif");
                lblCopyright.Text = Settings["Copyright"].ToString();
                // Obtain Blogs information from the Blogs table
                // and bind to the datalist control
                BlogDB blogData = new BlogDB();
                myDataList.DataSource = blogData.GetBlogs(ModuleID);
                myDataList.DataBind();

                dlArchive.DataSource = blogData.GetBlogMonthArchive(ModuleID);
                dlArchive.DataBind();

                SqlDataReader dr = blogData.GetBlogStats(ModuleID);
                try
                {
                    if (dr.Read())
                    {
                        lblEntryCount.Text = Esperantus.Localize.GetString("BLOG_ENTRIES", "Entries", null) +
                                             " (" + (string)dr["EntryCount"].ToString() + ")";
                        lblCommentCount.Text = Esperantus.Localize.GetString("BLOG_COMMENTS", "Comments", null) +
                                               " (" + (string)dr["CommentCount"].ToString() + ")";
                    }
                }
                finally
                {
                    // close the datareader
                    dr.Close();
                }
            }
        }