LinkLogic linkLogic = new LinkLogic(); //Trial Mode
LinkLogic linkLogicLicensed = new LinkLogic("place user name here", "place license key here"); //License Mode
//Use a in memory mock database for testing
ILinkTrackerDatabaseLogic databaseLogic = new LinkTrackerMockDatabase();
linkLogic.DatabaseLogic = databaseLogic;
//Create a dummy file for testing
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt");
File.WriteAllText(filePath, "This is a test");
//Create a link that expires 1 year from now, with a maximum of 10 IP Addresss, and a maximum of 2 requests per day
//We are setting the Alternate Link Id to 4242 which is the primary key for an OrderId
LinkParms parms = new LinkParms();
parms.IsUrl = false;
parms.AlternateLinkId = 4242;
parms.AlternateLinkText = "OrderId";
parms.ExpirationDate = DateTime.Now.AddYears(1);
parms.MaxIpAddresses = 10;
parms.MaxRequestsPerDay = 2;
parms.FilePathOrUrl = filePath;
TrackedLink createdLink = linkLogic.CreateLink(parms);
List<TrackedLink> trackedLinksForOrder = linkLogic.GetTrackedLinksByAlternateLinkId(4242);
//Loop through each link found
foreach (var trackedLink in trackedLinksForOrder)
{
//Get the associated File Path
Console.WriteLine("File Path: " + trackedLink.FilePathOrUrl);
}
Dim linkLogic As New LinkLogic() 'Trial Mode
Dim linkLogicLicensed As New LinkLogic("place user name here", "place license key here") 'License Mode
'Use a in memory mock database for testing
Dim databaseLogic As ILinkTrackerDatabaseLogic = New LinkTrackerMockDatabase()
linkLogic.DatabaseLogic = databaseLogic
'Create a dummy file for testing
Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.txt")
File.WriteAllText(filePath, "This is a test")
'Create a link that expires 1 year from now, with a maximum of 10 IP Addresss, and a maximum of 2 requests per day
'We are setting the Alternate Link Id to 4242 which is the primary key for an OrderId
Dim parms As New LinkParms()
parms.IsUrl = False
parms.AlternateLinkId = 4242
parms.AlternateLinkText = "OrderId"
parms.ExpirationDate = Date.Now.AddYears(1)
parms.MaxIpAddresses = 10
parms.MaxRequestsPerDay = 2
parms.FilePathOrUrl = filePath
Dim createdLink As TrackedLink = linkLogic.CreateLink(parms)
Dim trackedLinksForOrder As List(Of TrackedLink) = linkLogic.GetTrackedLinksByAlternateLinkId(4242)
'Loop through each link found
For Each trackedLink In trackedLinksForOrder
'Get the associated File Path
Console.WriteLine("File Path: " & trackedLink.FilePathOrUrl)
Next trackedLink