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"; } } } } }
private void GetGuestsBtn_Click(object sender, EventArgs e) { var users = _service.GetAllUsers(_dataStorage.CurrentSelectedPartyId); var friends = _service.GetAllFriends(_dataStorage.UserId); AttendingGridView.Rows.Clear(); foreach (var user in users) { //check whether it's the user's id if (user.userID != _dataStorage.UserId) { var index = AttendingGridView.Rows.Add(); var row = AttendingGridView.Rows[index]; var auxUser = _service.GetUser(user.userID); row.Cells["UserName"].Value = auxUser.firstName + " " + auxUser.lastName; row.Cells["Status"].Value = user.status; if (user.adminPrivileges) { row.Cells["IsAdmin"].Value = 1; } else { row.Cells["IsAdmin"].Value = 0; } if (_service.AreFriends(_dataStorage.UserId, auxUser.ID)) { row.Cells["IsFriend"].Value = true; } else { row.Cells["IsFriend"].Value = false; } } } }