public static string GetAdInteractionStr(List <Transaction> transactions, Transaction forTransaction = null) { if (forTransaction == null) { forTransaction = transactions.Last(); } var attributedToTrans = Attribution.GetAttribution(transactions, forTransaction, DateTime.Now); if (attributedToTrans == null) { return("Non-Campaign"); } switch (attributedToTrans.TransactionType) { case 1: return("Post-Impression"); case 2: return("Post-Click"); default: return(""); } }
public static void CreateTransactionPath(int successCookieId, List <Transaction> transactionList, DateTime logPointTime, string clientSite) { var printTransactions = new ConsoleTable("Logtime", "TransactionType", "Campaign", "Media", "Banner", "ID_LogPoints", "URLfrom"); var orderedTransactions = transactionList.Where(r => r.ClientSite == clientSite).OrderBy(r => r.LogTime).ToList(); var transactionsByLogTime = new List <Transaction>(); foreach (var transaction in orderedTransactions) { if (transaction.LogTime > logPointTime) { continue; } var attribute = transaction.TransactionType != TransactionValues.TrackingPoint ? transaction : Attribution.GetAttribution(orderedTransactions, transaction, logPointTime); transactionsByLogTime.Add(transaction); if (attribute != null) { printTransactions.AddRow(transaction.LogTime, transaction.TransactionType, attribute.Campaign, attribute.Media, attribute.Banner, transaction.ID_LogPoints, transaction.URLfrom); } else { printTransactions.AddRow(transaction.LogTime, transaction.TransactionType, Empty, Empty, Empty, transaction.ID_LogPoints, transaction.URLfrom); } } TransactionSessionPrinter(successCookieId, transactionsByLogTime); Console.ForegroundColor = Cyan; printTransactions.Write(); }