Beispiel #1
0
    protected void GridViewSearchUser_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow row = GridViewSearchUser.Rows[Convert.ToInt32(e.CommandArgument)];

        Friendid = GridViewSearchUser.DataKeys[row.RowIndex].Value.ToString();
        string s = ((LinkButton)(row.Cells[1].Controls[0])).Text;

        if (s.Equals("Add Friend"))
        {
            FriendsBLL.sendFriendRequest(Userid, Friendid);
            Requestsent = true;
            //e.Row.Cells[0].Controls[0].Attributes.Add("onclick", "alert(‘An alert’);")
            //row.Cells[0].Controls[0].Visible=false;
            //row.Cells[1].Controls[0].Visible = true;
            ((LinkButton)(row.Cells[1].Controls[0])).Text = "Cancel Request";
            //row.FindControl("btnAddFriend").Visible = true;

            //row.FindControl("btnCancelRequest").Visible = false;
        }
        else if (s.Equals("Cancel Request"))
        {
            FriendsBLL.cancelFriendRequest(Userid, Friendid);
            Requestsent = false;
            ((LinkButton)(row.Cells[1].Controls[0])).Text = "Add Friend";
        }
    }
Beispiel #2
0
    protected void GridViewFriendsList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string friendid;


        if (e.CommandName == "add")
        {
            GridViewRow row = GridViewFriendsList.Rows[Convert.ToInt32(e.CommandArgument)];
            friendid = GridViewFriendsList.DataKeys[row.RowIndex].Value.ToString();
            string s = ((LinkButton)(row.Cells[3].Controls[0])).Text;
            if (s.Equals("Add Friend"))
            {
                FriendsBLL.sendFriendRequest(Userid, friendid);
                Requestsent = true;

                ((LinkButton)(row.Cells[3].Controls[0])).Text = "Cancel Request";
            }
            else if (s.Equals("Cancel Request"))
            {
                FriendsBLL.cancelFriendRequest(Userid, friendid);
                Requestsent = false;
                ((LinkButton)(row.Cells[3].Controls[0])).Text = "Add Friend";
            }
        }
        else
        if (e.CommandName == "viewmutual")
        {
            GridViewRow row = GridViewFriendsList.Rows[Convert.ToInt32(e.CommandArgument)];
            friendid = GridViewFriendsList.DataKeys[row.RowIndex].Value.ToString();

            Response.Redirect("FriendofFriendsList.aspx?UserId=" + friendid + "&Type=Mutual");
        }
    }
Beispiel #3
0
    protected void btnCancelRequest_Click(object sender, EventArgs e)
    {
        btnCancelRequest.Visible     = false;
        btnCancelRequest.Enabled     = false;
        btnAddAsFriend.Visible       = true;
        btnAddAsFriend.Enabled       = true;
        lblFriendRequestSent.Visible = false;
        string friendId = Userid;
        string userId   = Session["UserId"].ToString();

        FriendsBLL.cancelFriendRequest(userId, friendId);
    }
    protected void GridViewFriendsOfFriend_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow row = GridViewFriendsOfFriend.Rows[Convert.ToInt32(e.CommandArgument)];

        friendid = GridViewFriendsOfFriend.DataKeys[row.RowIndex].Value.ToString();
        string s = ((LinkButton)(row.Cells[0].Controls[0])).Text;

        if (s.Equals("Add Friend"))
        {
            FriendsBLL.sendFriendRequest(Userid, friendid);

            ((LinkButton)(row.Cells[0].Controls[0])).Text = "Cancel Request";
        }
        else if (s.Equals("Cancel Request"))
        {
            FriendsBLL.cancelFriendRequest(Userid, friendid);

            ((LinkButton)(row.Cells[0].Controls[0])).Text = "Add Friend";
        }
    }