public override void Up() { var user = M3User.Create(UserName, DevPassword, "Customer", new M1Profile() { Email = "*****@*****.**", FirstName = "Chuck", LastName = "Norris", PhoneNumber = "+375296140302", PhoneNumberConfirmed = true } ); InsertUser(user); InsertClaims(user); InsertProfile(user); Execute.WithConnection((connection, transaction) => { var nowUtc = DateTime.UtcNow; var expireUtc = nowUtc.AddYears(10); var id = GetUserId(connection, transaction, UserName); var accountNo = "3014" + Seed.RandomStringOfNumbers(9); var account = M2Account.Create(accountNo, "USD", 999999999, nowUtc, expireUtc, "CardAccount"); var card1 = M2Card.Create(accountNo, id, UserName); var card2 = M2Card.Create(accountNo, id, UserName); InsertAccount(account, connection, transaction); InsertUserAccount(account.ToUserAccount(id), connection, transaction); InsertCard(card1, connection, transaction); InsertCard(card2, connection, transaction); }); }
private void InsertCard(M2Card card, IDbConnection connection, IDbTransaction transaction) { connection.Execute( "INSERT INTO [Accounting].[Card] ([CardId], [CardNo], [CardVendorId], [HolderFirstName], [HolderLastName], [ExpirationDateUtc])" + "VALUES (@CardId, @CardNo, @CardVendorId, @HolderFirstName, @HolderLastName, @ExpirationDateUtc)", card.ToCard(), transaction); connection.Execute( "INSERT INTO [Accounting].[User_Card_Account] ([CardId], [UserId], [AccountNo]) VALUES (@CardId, @UserId, @AccountNo)", card.ToUserCard(), transaction); connection.Execute( "INSERT INTO [Accounting].[CardSettings] " + "([CardId], [Blocked], [LimitOperationsPerDayLocal], [LimitOperationsPerDayAbroad], [LimitAmountPerDayLocal], [LimitAmountPerDayAbroad])" + "VALUES (@CardId, 0, 20, 10, 1000.0, 500.0)", card, transaction); }
public override void Up() { Execute.WithConnection((connection, transaction) => { var nowUtc = DateTime.UtcNow; var expireUtc = nowUtc.AddYears(1); foreach (var idPair in GetUserIdPairs(connection, transaction)) { var accountNo = "3014" + Seed.RandomStringOfNumbers(9); var account = M2Account.Create(accountNo, "USD", 10000, nowUtc, expireUtc, "CardAccount"); var card = M2Card.Create(accountNo, idPair.UserId, idPair.UserName); InsertAccount(account, connection, transaction); InsertUserAccount(account.ToUserAccount(idPair.UserId), connection, transaction); InsertCard(card, connection, transaction); } }); }