예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DeleteButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this message?');");

        if (User.Identity.IsAuthenticated)
        {
            MembershipUser userObject = Membership.GetUser();
            string UserID = userObject.ProviderUserKey.ToString();

            pm = new MessageControl(UserID);

            if (pm.getCreatedProfile(User.Identity.Name) != "1")
            {
                Response.Redirect("CreateProfile.aspx");
            }

            if (Request.QueryString["messageId"] != null && Request.QueryString["source"] != null)
            {
                ViewMessageId = Request.QueryString["messageId"];
                Repeater1.DataSource =  pm.getMessage(ViewMessageId);
                Repeater1.DataBind();

                if (Request.QueryString["source"] == "to")
                {
                    pm.toViewed(ViewMessageId, 1);
                }

                if (Request.QueryString["source"] == "from")
                {
                    pm.fromViewed(ViewMessageId, 1);
                    ReplyButton.Visible = false;
                }
            }
            else
            {
                Response.Redirect("pmInbox.aspx");
            }
        }
        else
        {
            Response.Redirect("Login.aspx?ReturnUrl=pmInbox.aspx");
        }
    }