示例#1
0
        private void BindData()
        {
            PrivateMessage pm = ForumManager.GetPrivateMessageByID(this.PrivateMessageID);

            if (pm != null)
            {
                if (pm.ToUserID != NopContext.Current.User.CustomerID && pm.FromUserID != NopContext.Current.User.CustomerID)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation() + "PrivateMessages.aspx");
                }

                if (!pm.IsRead && pm.ToUserID == NopContext.Current.User.CustomerID)
                {
                    pm = ForumManager.UpdatePrivateMessage(pm.PrivateMessageID, pm.FromUserID, pm.ToUserID,
                                                           pm.Subject, pm.Text, true, pm.IsDeletedByAuthor, pm.IsDeletedByRecipient, pm.CreatedOn);
                }
            }
            else
            {
                Response.Redirect(CommonHelper.GetStoreLocation() + "PrivateMessages.aspx");
            }

            lblFrom.Text    = Server.HtmlEncode(CustomerManager.FormatUserName(pm.FromUser));
            lblTo.Text      = Server.HtmlEncode(CustomerManager.FormatUserName(pm.ToUser));
            lblSubject.Text = Server.HtmlEncode(pm.Subject);
            lblMessage.Text = ForumManager.FormatPrivateMessageText(pm.Text);
        }