Ejemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender([NotNull] EventArgs e)
        {
            CodeContracts.VerifyNotNull(this.MessageFlags, "MessageFlags");

            this.MessageID = this.CurrentMessage.ID;

            if (!this.MessageFlags.IsDeleted)
            {
                // populate DisplayUserID
                if (!UserMembershipHelper.IsGuestUser(this.CurrentMessage.UserID))
                {
                    this.DisplayUserID = this.CurrentMessage.UserID;
                }

                this.IsAlt = this.IsAltMessage;

                this.RowColSpan = this.ColSpan;

                if (this.ShowAttachments)
                {
                    if (this.CurrentMessage.HasAttachments ?? false)
                    {
                        // add attached files control...
                        var attached = new MessageAttached {
                            MessageID = this.CurrentMessage.ID
                        };

                        if (this.CurrentMessage.UserID > 0 &&
                            YafContext.Current.Get <YafBoardSettings>().EnableDisplayName)
                        {
                            attached.UserName = UserMembershipHelper.GetDisplayNameFromID(this.CurrentMessage.UserID);
                        }
                        else
                        {
                            attached.UserName = this.CurrentMessage.UserName;
                        }

                        this.Controls.Add(attached);
                    }
                }
            }

            base.OnPreRender(e);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender([NotNull] EventArgs e)
        {
            if (this.DataRow != null && !this.MessageFlags.IsDeleted)
            {
                // populate DisplayUserID
                if (!UserMembershipHelper.IsGuestUser(this.DataRow["UserID"]))
                {
                    this.DisplayUserID = this.DataRow["UserID"].ToType <int>();
                }

                this.IsAlt = this.IsAltMessage;

                this.RowColSpan = this.ColSpan;

                if (this.ShowAttachments && long.Parse(this.DataRow["HasAttachments"].ToString()) > 0)
                {
                    // add attached files control...
                    var attached = new MessageAttached {
                        MessageID = this.DataRow["MessageID"].ToType <int>()
                    };

                    if (this.DataRow["UserID"] != DBNull.Value &&
                        YafContext.Current.Get <YafBoardSettings>().EnableDisplayName)
                    {
                        attached.UserName =
                            UserMembershipHelper.GetDisplayNameFromID(this.DataRow["UserID"].ToType <long>());
                    }
                    else
                    {
                        attached.UserName = this.DataRow["UserName"].ToString();
                    }

                    this.Controls.Add(attached);
                }
            }

            base.OnPreRender(e);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender([NotNull] EventArgs e)
        {
            CodeContracts.VerifyNotNull(this.MessageFlags, "MessageFlags");

            if (!this.MessageFlags.IsDeleted)
            {
                // populate DisplayUserID
                if (!UserMembershipHelper.IsGuestUser(this.CurrentMessage.UserID))
                {
                    this.DisplayUserID = this.CurrentMessage.UserID;
                }

                this.IsAlt = this.IsAltMessage;

                this.RowColSpan = this.ColSpan;

                if (this.ShowAttachments)
                {
                    if (this.CurrentMessage.HasAttachments ?? false)
                    {
                        // add attached files control...
                        var attached = new MessageAttached { MessageID = this.CurrentMessage.ID };

                        if (this.CurrentMessage.UserID > 0
                            && YafContext.Current.Get<YafBoardSettings>().EnableDisplayName)
                        {
                            attached.UserName = UserMembershipHelper.GetDisplayNameFromID(this.CurrentMessage.UserID);
                        }
                        else
                        {
                            attached.UserName = this.CurrentMessage.UserName;
                        }

                        this.Controls.Add(attached);
                    }
                }
            }

            base.OnPreRender(e);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender([NotNull] EventArgs e)
        {
            if (this.DataRow != null && !this.MessageFlags.IsDeleted)
            {
                // populate DisplayUserID
                if (!UserMembershipHelper.IsGuestUser(this.DataRow["UserID"]))
                {
                    this.DisplayUserID = this.DataRow["UserID"].ToType<int>();
                }

                this.IsAlt = this.IsAltMessage;

                this.RowColSpan = this.ColSpan;

                if (this.ShowAttachments && long.Parse(this.DataRow["HasAttachments"].ToString()) > 0)
                {
                    // add attached files control...
                    var attached = new MessageAttached { MessageID = this.DataRow["MessageID"].ToType<int>() };

                    if (this.DataRow["UserID"] != DBNull.Value
                        && YafContext.Current.Get<YafBoardSettings>().EnableDisplayName)
                    {
                        attached.UserName =
                            UserMembershipHelper.GetDisplayNameFromID(this.DataRow["UserID"].ToType<long>());
                    }
                    else
                    {
                        attached.UserName = this.DataRow["UserName"].ToString();
                    }

                    this.Controls.Add(attached);
                }
            }

            base.OnPreRender(e);
        }