예제 #1
0
        private void btnSeeFriends_Click(object sender, EventArgs e)
        {
            FriendsGridView.Rows.Clear();
            var allUsers = _service.GetAllTheUsers();

            foreach (var aux in allUsers)
            {
                if (aux.ID != _dataStorage.UserId)
                {
                    var userTable = new UserTable
                    {
                        ID        = aux.ID,
                        firstName = aux.firstName
                    };
                    var index = FriendsGridView.Rows.Add();
                    var row   = FriendsGridView.Rows[index];
                    if (userTable.ID != _dataStorage.UserId)
                    {
                        row.Cells["ID"].Value         = userTable.ID;
                        row.Cells["PersonName"].Value = userTable.firstName + " " + userTable.lastName;
                        if (_service.AreFriends(_dataStorage.UserId, userTable.ID))
                        {
                            row.Cells["isFriend"].Value = "true";
                        }
                        else
                        {
                            row.Cells["isFriend"].Value = "false";
                        }
                    }
                }
            }
        }