/// <summary> /// Gets the change counts. /// </summary> /// <param name="transactionId">The transaction identifier.</param> /// <returns></returns> private DatabaseHistoryChangeCounts GetChangeCounts(long transactionId) { var databaseManager = new DatabaseManager(PluginSettings.DatabaseSettings); const string commandText = @"--ReadiMon - LoadTransactionCounts SET NOCOUNT ON SELECT [Entity Added], [Entity Deleted], [Relationship Added], [Relationship Deleted], [Alias Added], [Alias Deleted], [Bit Added], [Bit Deleted], [DateTime Added], [DateTime Deleted], [Decimal Added], [Decimal Deleted], [Guid Added], [Guid Deleted], [Int Added], [Int Deleted], [NVarChar Added], [NVarChar Deleted], [Xml Added], [Xml Deleted] FROM dbgHist_Transaction WHERE TransactionId = @transactionId" ; DatabaseHistoryChangeCounts changeCounts = null; using (SqlCommand command = databaseManager.CreateCommand(commandText)) { databaseManager.AddParameter(command, "@transactionId", transactionId); using (IDataReader reader = command.ExecuteReader( )) { if (reader.Read( )) { changeCounts = new DatabaseHistoryChangeCounts(reader); } } } return(changeCounts); }
/// <summary> /// Loads the tooltip. /// </summary> public void LoadTooltip( ) { if (_tooltip == null && TooltipCallback != null) { DatabaseHistoryChangeCounts counts = TooltipCallback(TransactionId); EntityAdded = counts.EntityAdded; EntityDeleted = counts.EntityDeleted; RelationshipAdded = counts.RelationshipAdded; RelationshipDeleted = counts.RelationshipDeleted; AliasAdded = counts.AliasAdded; AliasDeleted = counts.AliasDeleted; BitAdded = counts.BitAdded; BitDeleted = counts.BitDeleted; DateTimeAdded = counts.DateTimeAdded; DateTimeDeleted = counts.DateTimeDeleted; DecimalAdded = counts.DecimalAdded; DecimalDeleted = counts.DecimalDeleted; GuidAdded = counts.GuidAdded; GuidDeleted = counts.GuidDeleted; IntAdded = counts.IntAdded; IntDeleted = counts.IntDeleted; NVarCharAdded = counts.NVarCharAdded; NVarCharDeleted = counts.NVarCharDeleted; XmlAdded = counts.XmlAdded; XmlDeleted = counts.XmlDeleted; StringBuilder sb = new StringBuilder( ); sb.AppendLine($"Host name: {HostName}"); sb.AppendLine($"Domain: {Domain}"); sb.AppendLine($"Username: {UserName}"); if (EntityAdded > 0) { sb.AppendLine($"Entity Added: {EntityAdded}"); } if (EntityDeleted > 0) { sb.AppendLine($"Entity Deleted: {EntityDeleted}"); } if (RelationshipAdded > 0) { sb.AppendLine($"Relationship Added: {RelationshipAdded}"); } if (RelationshipDeleted > 0) { sb.AppendLine($"Relationship Deleted: {RelationshipDeleted}"); } if (AliasAdded > 0) { sb.AppendLine($"Alias Added: {AliasAdded}"); } if (AliasDeleted > 0) { sb.AppendLine($"Alias Deleted: {AliasDeleted}"); } if (BitAdded > 0) { sb.AppendLine($"Bit Added: {BitAdded}"); } if (BitDeleted > 0) { sb.AppendLine($"Bit Deleted: {BitDeleted}"); } if (DateTimeAdded > 0) { sb.AppendLine($"DateTime Added: {DateTimeAdded}"); } if (DateTimeDeleted > 0) { sb.AppendLine($"DateTime Deleted: {DateTimeDeleted}"); } if (DecimalAdded > 0) { sb.AppendLine($"Decimal Added: {DecimalAdded}"); } if (DecimalDeleted > 0) { sb.AppendLine($"Decimal Deleted: {DecimalDeleted}"); } if (GuidAdded > 0) { sb.AppendLine($"Guid Added: {GuidAdded}"); } if (GuidDeleted > 0) { sb.AppendLine($"Guid Deleted: {GuidDeleted}"); } if (IntAdded > 0) { sb.AppendLine($"Int Added: {IntAdded}"); } if (IntDeleted > 0) { sb.AppendLine($"Int Deleted: {IntDeleted}"); } if (NVarCharAdded > 0) { sb.AppendLine($"NVarChar Added: {NVarCharAdded}"); } if (NVarCharDeleted > 0) { sb.AppendLine($"NVarChar Deleted: {NVarCharDeleted}"); } if (XmlAdded > 0) { sb.AppendLine($"Xml Added: {XmlAdded}"); } if (XmlDeleted > 0) { sb.AppendLine($"Xml Deleted: {XmlDeleted}"); } _tooltip = sb.ToString( ).TrimEnd('\n', '\r'); } }