static void Main(string[] args)
{
Console.WriteLine("User event data grouped by day\n");
Program p = null;
try
{
ClientPolicy policy = new ClientPolicy();
// policy.user = "dbadmin";
// policy.password = "au=money";
// policy.failIfNotConnected = true;
// p = new Program(new AerospikeClient(policy, "C-9a8d04af83.aerospike.io", 3200));
p = new Program(new AerospikeClient(policy, "127.0.0.1", 3000));
int feature;
do {
// Present options
Console.WriteLine("What would you like to do:");
Console.WriteLine("1> Generate data");
Console.WriteLine("2> Simulate daily events");
Console.WriteLine("3> Get a day range of events for a user");
Console.WriteLine("0> Exit");
Console.Write("\nSelect 1-3 and hit enter:");
feature = int.Parse(Console.ReadLine());
if (feature != 0)
{
switch (feature)
{
case 1:
Console.WriteLine("********** Generate Data");
p.GenerateData();
break;
case 2:
Console.WriteLine("********** Simulate daily events");
p.SimulateDailyEvents();
break;
case 3:
Console.WriteLine("********** Get a day range of events for a user");
p.DayRangeForUser();
break;
case 0:
Console.WriteLine("Goodbye");
break;
default:
Console.WriteLine("********** Invalid Selection ");
break;
}
}
} while (feature != 0);
}
catch (AerospikeException e)
{
Console.WriteLine("AerospikeException - Message: " + e.Message);
Console.WriteLine("AerospikeException - StackTrace: " + e.StackTrace);
}
catch (Exception e)
{
Console.WriteLine("Exception - Message: " + e.Message);
Console.WriteLine("Exception - StackTrace: " + e.StackTrace);
}
finally
{
if (p.client != null && p.client.Connected)
{
// Close Aerospike server connection
p.client.Close();
}
}
}