protected void Page_Load(object sender, EventArgs e)
        {
            checkLoggedin();
            loggedInUser = (User)Session["User"];



            if (!IsPostBack)
            {
                if (Request.QueryString["UserId"] != null)
                {
                    int userId = Convert.ToInt32(Request.QueryString["UserId"]);
                    LoadProPic(userId);
                    User currentUserProfile = userManager.GetUserById(userId);
                    LoadUser(currentUserProfile);
                    nameLabel.NavigateUrl = String.Format("~/UI/UserProfileUI.aspx?UserId={0}",
                                                          userId);
                    int followingCount = followManager.GetFollowerByPersonId(userId).Count();
                    //folloew count
                    int followerCount = followManager.GetFollowerCountOfPerson(userId).Count();
                    followerButton.Text         = followerCount + " Follower";
                    followerButton.NavigateUrl  = String.Format("~/UI/SearchUI.aspx?FollowerUserId={0}", userId);
                    followingButton.Text        = followingCount + " Following";
                    followingButton.NavigateUrl = String.Format("~/UI/SearchUI.aspx?FollowingUserId={0}", userId);

                    if (userId == loggedInUser.Id)
                    {
                        LoadAllPostGridView(userId);
                    }
                    else
                    {
                        LoadPostGridView(userId, 1);
                    }

                    if (userId == loggedInUser.Id)
                    {
                        propicDiv.Visible           = true;
                        editProfileLink.Text        = "Edit Profile";
                        editProfileLink.NavigateUrl = String.Format("~/UI/editProfileUI.aspx?UserId={0}",
                                                                    userId);
                    }
                    else if (FoundFollower(userId))
                    {
                        editProfileLink.Text        = "UnFollow";
                        editProfileLink.NavigateUrl = String.Format("~/UI/FollowUI.aspx?UnFollow={0}&&PersonId={1}",
                                                                    userId, loggedInUser.Id);
                    }
                    else
                    {
                        editProfileLink.Text        = "Follow";
                        editProfileLink.NavigateUrl = String.Format("~/UI/FollowUI.aspx?FollowerId={0}&&FollowerName={1}&&PersonId={2}",
                                                                    loggedInUser.Id, loggedInUser.Name, currentUserProfile.Id);
                    }
                }
                else
                {
                    Response.Redirect("~/UI/Index.aspx");
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            checkLoggedin();

            loggedInUser = (User)Session["User"];

            if (!IsPostBack)
            {
                if (Request.QueryString["search"] != null)
                {
                    string name = Request.QueryString["search"];
                    LoadGridview(userManager.GetUserByName(name));
                }
                else if (Request.QueryString["FollowerUserId"] != null)
                {
                    int           personId      = Convert.ToInt32(Request.QueryString["FollowerUserId"]);
                    List <Follow> followingList = followManager.GetFollowerCountOfPerson(personId);
                    List <User>   userList      = new List <User>();
                    foreach (Follow follow in followingList)
                    {
                        userList.Add(FindUser(follow.FollowerId));
                    }
                    LoadGridview(userList);
                }
                else if (Request.QueryString["FollowingUserId"] != null)
                {
                    int           personId      = Convert.ToInt32(Request.QueryString["FollowingUserId"]);
                    List <Follow> followingList = followManager.GetFollowerByPersonId(personId);
                    List <User>   userList      = new List <User>();
                    foreach (Follow follow in followingList)
                    {
                        userList.Add(FindUser(follow.PersonId));
                    }
                    LoadGridview(userList);
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            checkLoggedin();

            loggedInUser = (User)Session["User"];
            LoadProPic(loggedInUser.Id);
            editProfileLink.NavigateUrl = String.Format("~/UI/editProfileUI.aspx?UserId={0}",
                                                        loggedInUser.Id);
            nameLabel.NavigateUrl = String.Format("~/UI/UserProfileUI.aspx?UserId={0}",
                                                  loggedInUser.Id);
            LoadUser(userManager.GetUserById(loggedInUser.Id));

            int followingCount = followManager.GetFollowerByPersonId(loggedInUser.Id).Count();
            //folloew count
            int followerCount = followManager.GetFollowerCountOfPerson(loggedInUser.Id).Count();

            followerButton.Text         = followerCount + " Follower";
            followerButton.NavigateUrl  = String.Format("~/UI/SearchUI.aspx?FollowerUserId={0}", loggedInUser.Id);
            followingButton.Text        = followingCount + " Following";
            followingButton.NavigateUrl = String.Format("~/UI/SearchUI.aspx?FollowingUserId={0}", loggedInUser.Id);


            LoadPostGridView();
        }