Example #1
0
        public void GetUserPost(int Id)
        {
            string str = dbClass.retrieveFriendListID(Id);

            if (str != null)
            {
                string formatedString = str.Replace(";", ",");
                formatedString = formatedString + "," + Id;
                formatedString = formatedString.Remove(0, 1);
                string getUserPost = "SELECT p.ID,p.content,p.timestamp,p.userId,u.name,u.profilePicture,p.blockedByFriend FROM posts p INNER JOIN users u ON p.userId = u.userId WHERE p.userId IN (@formatedString) AND p.ID NOT IN (SELECT ID FROM posts Where blockedByUser = 1 AND userId !=@Id) ORDER BY p.ID DESC";
                dt = dbClass.ConnectDataBaseReturnDT(getUserPost, formatedString, Id);
                if (dt.Rows.Count > 0)
                {
                    GridViewUserPost.DataSource = HttpUtility.HtmlEncode(dt);
                    GridViewUserPost.DataBind();
                }
            }
            else
            {
                string formatedString = str.Replace(";", ",");
                formatedString = formatedString + "" + Id;
                formatedString = formatedString.Remove(0, 1);
                string getUserPost = "SELECT p.ID,p.content,p.timestamp,p.userId,u.name,u.profilePicture,p.blockedByFriend FROM posts p INNER JOIN users u ON p.userId = u.userId WHERE p.userId IN (@formatedString) AND p.ID NOT IN (SELECT ID FROM posts Where blockedByUser = 1 AND userId !=@Id) ORDER BY p.ID DESC";
                dt = dbClass.ConnectDataBaseReturnDT(getUserPost, formatedString, Id);
                if (dt.Rows.Count > 0)
                {
                    GridViewUserPost.DataSource = HttpUtility.HtmlEncode(dt);
                    GridViewUserPost.DataBind();
                }
            }
        }
Example #2
0
        public void GetUserPost(String username)
        {
            string getUserPost = "SELECT p.ID,p.content,p.timestamp,p.userId,u.name,u.profilePicture FROM posts p INNER JOIN users u ON p.userId = u.userId WHERE u.username=@username ORDER BY p.ID DESC";

            dt = da.ConnectDataBaseReturnDT(HttpUtility.HtmlEncode(getUserPost), HttpUtility.HtmlEncode(username));
            if (dt.Rows.Count > 0)
            {
                GridViewUserPost.DataSource = HttpUtility.HtmlEncode(dt);
                GridViewUserPost.DataBind();
            }
        }
Example #3
0
        public void GetUserPost(int Id)
        {
            string str            = dbClass.retrieveFriendListID(Id);
            string formatedString = str.Replace(";", ",");

            formatedString = formatedString + "," + Id;
            string getUserPost = "SELECT p.ID,p.content,p.timestamp,p.userId,u.name,u.profilePicture,p.blockedByFriend FROM posts p INNER JOIN users u ON p.userId = u.userId WHERE p.userId=" + Id + " ORDER BY p.ID DESC";

            dt = dbClass.ConnectDataBaseReturnDT(getUserPost, Id);
            if (dt.Rows.Count > 0)
            {
                GridViewUserPost.DataSource = HttpUtility.HtmlEncode(dt);
                GridViewUserPost.DataBind();
            }
        }