Ejemplo n.º 1
0
        /// <summary>
        /// Gets the user preference DefaultNumberOfMessagesPerPage for the current user
        /// </summary>
        /// <returns>the default # of messages per page as set by this user.</returns>
        public static int GetUserDefaultNumberOfMessagesPerPage()
        {
            UserEntity user = GetUserObject();

            if (user != null)
            {
                int toReturn = user.DefaultNumberOfMessagesPerPage;
                if (toReturn <= 0)
                {
                    return(ApplicationAdapter.GetMaxAmountMessagesPerPage());
                }
                else
                {
                    return(toReturn);
                }
            }

            return(ApplicationAdapter.GetMaxAmountMessagesPerPage());
        }
Ejemplo n.º 2
0
        protected void rptRSS_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
                DataRowView currentRow = (DataRowView)e.Item.DataItem;
                string      nickName   = currentRow["NickName"].ToString();
                string      message    = currentRow["MessageTextAsHTML"].ToString();
                string      subject    = currentRow["Subject"].ToString();
                Literal     title      = (Literal)e.Item.FindControl("title");
                title.Text = HttpUtility.HtmlEncode(String.Format("{0} by {1}", subject, nickName));

                Literal description = (Literal)e.Item.FindControl("description");
                description.Text = HttpUtility.HtmlEncode(message);

                Literal link           = (Literal)e.Item.FindControl("itemLink");
                int     threadID       = (int)currentRow["ThreadID"];
                int     messageID      = (int)currentRow["MessageID"];
                int     startAtMessage = ThreadGuiHelper.GetStartAtMessageForGivenMessageAndThread(threadID, messageID, ApplicationAdapter.GetMaxAmountMessagesPerPage());
                link.Text = HttpUtility.HtmlEncode("http://" + Request.Url.Host + ApplicationAdapter.GetVirtualRoot() + String.Format(@"Messages.aspx?ThreadID=" + threadID + "&StartAtMessage=" + startAtMessage + "#" + messageID));

                Literal permaLink = (Literal)e.Item.FindControl("permaLink");
                permaLink.Text = link.Text;

                Literal pubDate = (Literal)e.Item.FindControl("pubDate");
                pubDate.Text = String.Format("{0:R}", ((DateTime)currentRow["PostingDate"]).AddHours(-2));

                Literal author = (Literal)e.Item.FindControl("author");
                author.Text = nickName;

                Literal category = (Literal)e.Item.FindControl("threadName");
                category.Text = HttpUtility.HtmlEncode(subject);
                break;
            }
        }