private string GenerateKeyAndMarkSent() { string betaKey = System.Guid.NewGuid().ToString(); using (var db = Setup.DbFactory) { db.Open(); var data = new LibPoco.BetaKeys(betaKey, false, true); db.Insert(data); } return(betaKey); }
private void BetaKeySetup() { using (var db = Setup.DbFactory) { db.Open(); var info = db.Query <LibPoco.BetaKeys>("SELECT * FROM BetaKeys WHERE Code = @code", new { code = details.BetaKey }); if (info.Count() != 1) { throw new Exceptions.InvalidBetaKeyException("There appears to have been an error validating the beta key."); } betaKey = info.First(); if (betaKey.IsUsed) { throw new Exceptions.BetaKeyAlreadyUsedException("The beta key has already been used."); } } }