public static bool UserIsInList(int id, string username) { UsersTable table = new UsersTable(); bool present = table.IsPresent(id, username); table.Dispose(); return(present); }
private AcceptUserType OnAcceptUser(PeerSocket peer, UserInfo userInfo) { if (userInfo.SecureAuthentication == false) { return(AcceptUserType.Ask); } UsersTable usersDb = new UsersTable(); // If User isn't into DB if (usersDb.IsPresent(myAccountId, userInfo.Name) == false) { usersDb.Dispose(); return(AcceptUserType.Ask); } // Get User Accept Status bool acceptUser = usersDb.GetAccept(myAccountId, userInfo.Name); usersDb.Dispose(); return(acceptUser ? AcceptUserType.Yes : AcceptUserType.No); }