using Microsoft.AspNetCore.Authentication;
public static void Main()
var email = "bateaubay@twcmgroup.com";
var firstName = "TerryWhite Chemmart";
var lastName = "Bateau Bay";
var today = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
var identityProviderId = 718346354094507013;
var userAccountId = 950283282979750912;
var operatorSourceIdentifier = Base64UrlTextEncoder.Encode(BitConverter.GetBytes(userAccountId));
var operatorIdentityId = 834394572669846528;
var tenantId = 706840070690178795;
var addUserAccountSQL = $@"INSERT INTO [idp].[UserAccount] ([Id], [Identifier] ,[Email] ,[EmailValidated] ,[EmailValidatedAt] ,[PhoneValidated] ,[Disabled] ,[Deleted], [MfaEnabled])
VALUES ([shared].uniqueid(0), '{Guid.NewGuid().ToString()}' ,'{email}' ,1 ,'{today}' ,0 ,0 ,0 ,0)
SELECT TOP 1 * FROM [idp].[UserAccount] ORDER BY Id DESC
var addUserAccountIdentitySQL = $@"INSERT INTO [idp].[UserAccountIdentity]
([Id],[IdentityProviderId],[Identifier],[UserAccountId],[Deleted])
([shared].uniqueid(0),{identityProviderId},'{email}',{userAccountId},0)
SELECT TOP 1 * FROM [idp].[UserAccountIdentity] ORDER BY Id DESC
var addOperatorIdentitySQL = $@"INSERT INTO [api].[OperatorIdentity]
([shared].uniqueid(0) ,0)
SELECT TOP 1 * FROM [api].[OperatorIdentity] ORDER BY Id DESC
var addOperatorSQL = $@"INSERT INTO [api].[Operator]
([Id],[IdentityId],[TenantId],[SourceId],[SourceIdentifier],[Surname],[GivenName],[Gender],[Deleted])
([shared].uniqueid(0),{operatorIdentityId},{tenantId},1,'{operatorSourceIdentifier}','{firstName}','{lastName}',0,0)
SELECT TOP 1 * FROM [api].[Operator] ORDER BY Id DESC
Console.WriteLine("QUERY 1\n");
Console.WriteLine(addUserAccountSQL);
Console.WriteLine("QUERY 2\n");
Console.WriteLine(addUserAccountIdentitySQL);
Console.WriteLine("QUERY 3\n");
Console.WriteLine(addOperatorIdentitySQL);
Console.WriteLine("QUERY 4\n");
Console.WriteLine(addOperatorSQL);
var clientId = 7234022819097704308;
var storeName = "TerryWhite Chemmart Bateau Bay";
var addTenantSQL = $@"INSERT INTO [api].[Tenant]
([Id] ,[ClientId] ,[SharedIdentifier] ,[Name] ,[Deleted])
([shared].uniqueid(0) ,{clientId} ,'{storeId}' ,'{storeName}' ,0)
SELECT TOP 1 * FROM [api].[Tenant] ORDER BY Id DESC
Console.WriteLine("QUERY 5\n");
Console.WriteLine(addTenantSQL);