示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectValidator.isUser();
            currentUser = (BLL.User)Session["currentUser"];

            var circlesname = UserCircleDAO.GetAllUserCircles(currentUser.Id);

            if (!IsPostBack)
            {
                DropDownList1.DataSource     = circlesname;
                DropDownList1.DataTextField  = "CircleId";
                DropDownList1.DataValueField = "CircleId";
                DropDownList1.DataBind();

                DropDownList2.DataSource     = circlesname;
                DropDownList2.DataTextField  = "CircleId";
                DropDownList2.DataValueField = "CircleId";
                DropDownList2.DataBind();
            }
            var notfollow = UserDAO.GetNewUser(currentUser.Id);

            Repeater1.DataSource = notfollow;
            Repeater1.DataBind();

            this.Title = "Home";
            //CircleDAO.AddCircle("gym");
            refreshGv();
        }
        public static void isUser(bool isAddingUserCircles = false)
        {
            User currentUser = (User)HttpContext.Current.Session["currentUser"];

            if (currentUser == null)
            {
                HttpContext.Current.Response.Redirect("/Auth/Login.aspx");
            }
            else
            {
                List <UserCircle> existingUserCircle = UserCircleDAO.GetAllUserCircles(currentUser.Id);
                if (existingUserCircle.Count.Equals(0) && !isAddingUserCircles)
                {
                    string[] someArr = HttpContext.Current.Request.Url.LocalPath.Split('/'); // eg: /Profile/User.aspx -> [Profile, User.aspx]
                    System.Diagnostics.Debug.WriteLine("Redirect:" + someArr[someArr.Length - 1]);

                    if (!someArr[someArr.Length - 1].Equals("User.aspx"))
                    {
                        HttpContext.Current.Response.Redirect("/Profile/User.aspx?username="******"&addingCircles=true");
                    }
                }
                else if (!existingUserCircle.Count.Equals(0) && isAddingUserCircles)
                {
                    HttpContext.Current.Response.Redirect("/Profile/User.aspx?username=" + currentUser.Username.Trim());
                }
            }
        }
示例#3
0
        public void refreshGv()
        {
            List <UserPost>       userposts   = new List <UserPost>();
            List <BLL.UserCircle> userCircles = UserCircleDAO.GetAllUserCircles(currentUser.Id);

            foreach (BLL.UserCircle circle in userCircles)
            {
                List <UserPost> posts = PostDAO.GetPostsByCircle(circle.CircleId);
                foreach (UserPost post in posts)
                {
                    userposts.Add(post);
                }
            }

            rptUserPosts.DataSource = userposts;
            rptUserPosts.DataBind();
        }
示例#4
0
        protected void GridViewFollow_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var      data     = e.Row.DataItem;
                BLL.User userpost = data as BLL.User;

                var circlesname = UserCircleDAO.GetAllUserCircles(userpost.Id);

                DropDownList DropDownList1 = (e.Row.FindControl("DropDownList1") as DropDownList);
                DropDownList1.DataSource     = circlesname;
                DropDownList1.DataTextField  = "CircleId";
                DropDownList1.DataValueField = "CircleId";
                DropDownList1.DataBind();

                Button followButton = (e.Row.FindControl("peopleNearbyFollowBtn") as Button);
                followButton.Attributes["followingid"] = userpost.Id.ToString();
                followButton.Attributes["followerid"]  = currentUser.Id.ToString();
            }
        }
示例#5
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;
            }
        }