public Username(string usernameID, UsernameLog usernameLog) { UsernameID = usernameID; TimeStamp = usernameLog.TimeStamp; Password = usernameLog.Password; UserName = usernameLog.Username; }
public static void Start() { var logger = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); int i = 0; while (true) { BasicLogger basic = new BasicLogger(); if (i % 3 == 0) { basic = new MailLog(RandomGenerator.GenerateRandomMail(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword()); } if (i % 3 == 1) { basic = new MobileLog(RandomGenerator.GenerateRandomMobileNumber(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword()); } if (i % 3 == 2) { basic = new UsernameLog(RandomGenerator.GenerateRandomUsername(), DateTime.UtcNow, RandomGenerator.GenerateRandomPassword()); } logger.Information(JsonConvert.SerializeObject(basic)); i++; if (i > 100) { break; } if (basic is MailLog) { DataProvider.AddMail(basic as MailLog); } if (basic is MobileLog) { DataProvider.AddMobile(basic as MobileLog); } if (basic is UsernameLog) { DataProvider.AddUsername(basic as UsernameLog); } Thread.Sleep(300); } }
public static void AddUsername(UsernameLog UsernameLog) { ISession session = SessionManager.GetSession(); Username username = new Username(Guid.NewGuid().ToString(), UsernameLog); var t = TimeUuid.NewId(UsernameLog.TimeStamp); if (session == null) { return; } var ps = session.Prepare("insert into \"Username\" (\"UsernameID\", \"TimeStamp\", \"Password\", \"UserName\") VALUES (?, ?, ?, ?)"); var batch = new BatchStatement().Add(ps.Bind(t, (DateTimeOffset)username.TimeStamp, username.Password, username.UserName)); RowSet usernameData = session.Execute(batch); }