示例#1
0
        protected void ButtonFollow_Click(object sender, EventArgs e)
        {
            int userId    = Convert.ToInt32(Session["UserId"]);
            int profileId = Convert.ToInt32(HiddenFieldUserId.Value);

            if (userId == 0)
            {
                Response.Redirect("~/Login/Profile/" + profileId.ToString());
            }
            else
            {
                // is visitor follower
                Classes.UserActions ua = new Classes.UserActions();
                int followStatus       = ua.followAction(userId, profileId);


                if (followStatus == 1)
                {
                    //user followed
                    HiddenFieldFollowText.Value   = "UNFOLLOW";
                    HiddenFieldToastStatus.Value  = "1";
                    HiddenFieldToastMode.Value    = "follow";
                    HiddenFieldToastSmiley.Value  = ":)";
                    HiddenFieldToastMessage.Value = "You followed this user!";
                    HiddenFieldButton1Text.Value  = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                }
                else if (followStatus == 2)
                {
                    //user unfollowed
                    HiddenFieldFollowText.Value   = "FOLLOW";
                    HiddenFieldToastStatus.Value  = "1";
                    HiddenFieldToastMode.Value    = "follow";
                    HiddenFieldToastSmiley.Value  = ":)";
                    HiddenFieldToastMessage.Value = "You unfollowed this user!";
                    HiddenFieldButton1Text.Value  = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                }
                else if (followStatus == 0)
                {
                    //error

                    HiddenFieldToastStatus.Value  = "1";
                    HiddenFieldToastMode.Value    = "follow";
                    HiddenFieldToastSmiley.Value  = ":)";
                    HiddenFieldToastMessage.Value = "Something went wrong! Please try later!";
                    HiddenFieldButton1Text.Value  = "OK";
                    HiddenFieldButton1Color.Value = "d7432e";
                }
            }
        }
示例#2
0
        //userId: who presses the button, profileId: target
        public int follow(int userId, int profileId)
        {
            Classes.UserActions ua = new Classes.UserActions();
            int followStatus       = ua.followAction(userId, profileId);

            /*if 1:
             *  //user followed
             *  2:
             *  //user unfollowed
             *  0:
             *  //error
             * }*/
            return(followStatus);
        }
示例#3
0
        protected void ButtonFollow_Click(object sender, EventArgs e)
        {
            int userId    = Convert.ToInt32(Session["UserId"]);
            int profileId = Convert.ToInt32(HiddenFieldUserId.Value);

            if (userId == 0)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text    = "You need to login first!";
            }
            else
            {
                // is visitor follower
                Classes.UserActions ua = new Classes.UserActions();
                int followStatus       = ua.followAction(userId, profileId);


                if (followStatus == 1)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "You have successfully followed this user.";
                    ButtonFollow.Text    = "Unfollow";
                }
                else if (followStatus == 2)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "You have successfully unfollowed this user.";
                    ButtonFollow.Text    = "Follow";
                }
                else if (followStatus == 0)
                {
                    LabelMessage.Visible = true;
                    LabelMessage.Text    = "Something strange happened! Please try again later!";
                }
            }
        }
示例#4
0
        protected void ButtonFollow_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            int profileId = Convert.ToInt32(HiddenFieldUserId.Value);

            if (userId == 0)
            {
                Response.Redirect("~/Login/Profile/" + profileId.ToString());
            }
            else
            {
                // is visitor follower
                Classes.UserActions ua = new Classes.UserActions();
                int followStatus = ua.followAction(userId, profileId);


                    if (followStatus == 1)
                    {
                        //user followed
                        HiddenFieldFollowText.Value = "UNFOLLOW";
                        HiddenFieldToastStatus.Value = "1";
                        HiddenFieldToastMode.Value = "follow";
                        HiddenFieldToastSmiley.Value = ":)";
                        HiddenFieldToastMessage.Value = "You followed this user!";
                        HiddenFieldButton1Text.Value = "OK";
                        HiddenFieldButton1Color.Value = "d7432e";
                    }
                    else if (followStatus == 2)
                    {
                        //user unfollowed
                        HiddenFieldFollowText.Value = "FOLLOW";
                        HiddenFieldToastStatus.Value = "1";
                        HiddenFieldToastMode.Value = "follow";
                        HiddenFieldToastSmiley.Value = ":)";
                        HiddenFieldToastMessage.Value = "You unfollowed this user!";
                        HiddenFieldButton1Text.Value = "OK";
                        HiddenFieldButton1Color.Value = "d7432e";
                    }
                    else if (followStatus == 0)
                    {
                        //error

                        HiddenFieldToastStatus.Value = "1";
                        HiddenFieldToastMode.Value = "follow";
                        HiddenFieldToastSmiley.Value = ":)";
                        HiddenFieldToastMessage.Value = "Something went wrong! Please try later!";
                        HiddenFieldButton1Text.Value = "OK";
                        HiddenFieldButton1Color.Value = "d7432e";
                    }
            }
        }
示例#5
0
        protected void ButtonFollow_Click(object sender, EventArgs e)
        {
            int userId = Convert.ToInt32(Session["UserId"]);
            int profileId = Convert.ToInt32(HiddenFieldUserId.Value);

            if (userId == 0)
            {
                LabelMessage.Visible = true;
                LabelMessage.Text = "You need to login first!";
            }
            else
            {
                // is visitor follower
                Classes.UserActions ua = new Classes.UserActions();
                int followStatus = ua.followAction(userId, profileId);


                    if (followStatus == 1)
                    {
                        LabelMessage.Visible = true;
                        LabelMessage.Text = "You have successfully followed this user.";
                        ButtonFollow.Text = "Unfollow";
                    }
                    else if (followStatus == 2)
                    {

                        LabelMessage.Visible = true;
                        LabelMessage.Text = "You have successfully unfollowed this user.";
                        ButtonFollow.Text = "Follow";
                    }
                    else if (followStatus == 0)
                    {

                        LabelMessage.Visible = true;
                        LabelMessage.Text = "Something strange happened! Please try again later!";
                    }
            }
        }