예제 #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
파일: ChatHub.cs 프로젝트: m3hrad/CityCrowd
        //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!";
                    }
            }
        }