How hide FriendRequest from other users

62 Views Asked by At

I'm developing a social networking site where i'm facing problem when sending Friend Request from one user to another....The problem is that FriendRequest shows `` to every user not only to whom it send so i want to show that request to whom it send e.g: A send request to B so only B can see that request on FriendRequests.aspx just like facebook

I have these two pages

  1. People.aspx ...
  2. FriendRequests.aspx

Database table : FriendRequest.dbo

In People.aspx.....Subsonic Tool used...

FriendRequest obj = new FriendRequest();
obj.IsNew = true;
obj.Uid = Convert.ToInt32(Session["UserID"]);
obj.IsFriend = false;
obj.Save();

In FriendRequets.aspx

  if (!IsPostBack)
        {
            if (Session["UserID"] != null)
            {
                Response.Write(Session["FID"].ToString());
                DataTable dt = Helper.ExecutePlainQuery("select * from     UserRegistration inner join Profile on UserRegistration.uid=Profile.uid inner join FriendRequest on UserRegistration.uid=FriendRequest.uid");
                repeater1.DataSource = dt;
                repeater1.DataBind();
             }

In database table FriendRequest.dbo

ReqID int primary
uid int Foreign 
isFriend bit 

The design of these two pages just looks like facebook "People you may know" page and "Friend Requests" page

1

There are 1 best solutions below

2
Adam Copley On

Your query should looke like this:

"SELECT * FROM UserRegistration 
 INNER JOIN Profile on UserRegistration.uid=Profile.uid 
 INNER JOIN FriendRequest on UserRegistration.uid=FriendRequest.uid 
 WHERE ReqID= " +  obj.Uid

by using WHERE you are filtering the result to only the ones where the ReqID matched the logged in user. On the assumption that ReqID is the person uid wants to be friends with.