本文整理汇总了C#中Aerospike.Client.AerospikeClient.QueryUser方法的典型用法代码示例。如果您正苦于以下问题:C# AerospikeClient.QueryUser方法的具体用法?C# AerospikeClient.QueryUser怎么用?C# AerospikeClient.QueryUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aerospike.Client.AerospikeClient
的用法示例。
在下文中一共展示了AerospikeClient.QueryUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login
private void Login()
{
string server = hostBox.Text.Trim();
int port = int.Parse(portBox.Text.Trim());
string userName = userBox.Text.Trim();
string password = passwordBox.Text.Trim();
ClientPolicy policy = new ClientPolicy();
policy.user = userName;
policy.password = password;
policy.failIfNotConnected = true;
policy.timeout = 600000;
AerospikeClient client = new AerospikeClient(policy, server, port);
try
{
if (userName.Equals("admin") && password.Equals("admin"))
{
Form form = new PasswordForm(client, userName);
form.ShowDialog();
}
// Query own user.
User user = client.QueryUser(null, userName);
if (user != null)
{
bool admin = user.roles.Contains("user-admin");
// Initialize Global Data
Globals.RefreshRoles(client, user, admin);
Form form = new AdminForm(client, user, admin);
form.Show();
}
else
{
throw new Exception("Failed to find user: " + userName);
}
}
catch (Exception)
{
client.Close();
throw;
}
}