Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Request.QueryString["addingCircles"]))
            {
                RedirectValidator.isUser(isAddingUserCircles: false);
            }
            else
            {
                addCirclesCloseButton.Visible = false;
                RedirectValidator.isUser(isAddingUserCircles: true);
            }

            currentUser   = (BLL.User)Session["currentUser"];
            requestedUser = GetUserByIdentifier(Request.QueryString["username"]);
            if (requestedUser == null)
            {
                requestedUser = currentUser;
            }
            Event        retrieveEventData    = new Event();
            List <Event> createdEventDataList = new List <Event>();

            if (!Page.IsPostBack)
            {
                existingUserCircleList = UserCircleDAO.GetAllUserCircles(requestedUser.Id);
                foreach (UserCircle userCircle in existingUserCircleList)
                {
                    var userDetailsForCircle = UserCircleDAO.GetCircleFollowerDetails(userCircle.CircleId);
                    circleFollowerDetailList.Add(userDetailsForCircle);
                }

                rptUpdateCircles.DataSource = existingUserCircleList;
                rptUpdateCircles.DataBind();

                rptUserCircles.DataSource = existingUserCircleList;
                rptUserCircles.DataBind();

                rptCircleFollowerLinks.DataSource = existingUserCircleList;
                rptCircleFollowerLinks.DataBind();

                rptUserFollowing.DataSource = FollowDAO.GetAllFollowingUsers(requestedUser.Id);
                rptUserFollowing.DataBind();

                createdEventDataList = retrieveEventData.GetAllEventCreatedByUser(currentUser.Id);
                rpViewEventPageCreated.DataSource = createdEventDataList;
                rpViewEventPageCreated.DataBind();

                bindExisitingCircles();
                updateCirclesModal();
                initializeNearbyUserMap();
            }

            GMap.OverlayClick += new EventHandler <OverlayEventArgs>(MarkerClick);

            Title = requestedUser.Username + " - MyCircles";
            ProfilePicImage.ImageUrl = requestedUser.ProfileImage;
            lbName.Text      = requestedUser.Name;
            lbUsername.Text  = "@" + requestedUser.Username;
            lbBio.InnerText  = requestedUser.Bio;
            lbCity.InnerText = requestedUser.City;

            if (requestedUser.Id == currentUser.Id)
            {
                btMessage.Visible = false;
            }
            else
            {
                var sCoord = new GeoCoordinate(Double.Parse(currentUser.Latitude.ToString()), Double.Parse(currentUser.Longitude.ToString()));
                var eCoord = new GeoCoordinate(Double.Parse(requestedUser.Latitude.ToString()), Double.Parse(requestedUser.Longitude.ToString()));

                lbDistance.InnerText    = (sCoord.GetDistanceTo(eCoord) / 1000).ToString("0.0") + " km away";
                btEditProfile.Visible   = false;
                btMessage.Visible       = true;
                followWarning.InnerText = requestedUser.Name + " has not followed anyone yet";
            }

            if (String.IsNullOrEmpty(requestedUser.Bio))
            {
                lbBio.Visible = false;
            }
            else
            {
                lbBio.Visible = true;
            }

            if (rptUserFollowing.Items.Count > 0)
            {
                followWarning.Visible = false;
            }
            else
            {
                followWarning.Visible = true;
            }
        }
Esempio n. 2
0
        public List <string> SelectFollowers(string userId)
        {
            List <string> followers = new FollowDAO().SelectFollowers(userId);

            return(followers);
        }
Esempio n. 3
0
        public List <string> SelectFollowing(string userId)
        {
            List <string> following = new FollowDAO().SelectFollowing(userId);

            return(following);
        }
Esempio n. 4
0
        public bool isFollowed(string followerId, string followingId)
        {
            bool followed = new FollowDAO().isFollowed(followerId, followingId);

            return(followed);
        }
Esempio n. 5
0
        public int Remove(string followerId, string followingId)
        {
            int result = new FollowDAO().RemoveFollow(followerId, followingId);

            return(result);
        }
Esempio n. 6
0
        public int Insert()
        {
            int result = new FollowDAO().AddFollow(this);

            return(result);
        }