diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 1eeebb5..c791228 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/Demos/Archive Data/ArchiveData-Console/ArchiveData-Console.csproj b/Demos/Archive Data/ArchiveData-Console/ArchiveData-Console.csproj deleted file mode 100644 index 2e4cbcb..0000000 --- a/Demos/Archive Data/ArchiveData-Console/ArchiveData-Console.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - Exe - netcoreapp3.1 - TaleLearnCode.ChChChChanges.ArchiveData - TaleLearnCode.ChChChChanges.ArchiveData-Console - - - - - - - - - - - - diff --git a/Demos/Archive Data/ArchiveData-Console/Program.cs b/Demos/Archive Data/ArchiveData-Console/Program.cs deleted file mode 100644 index 48c2663..0000000 --- a/Demos/Archive Data/ArchiveData-Console/Program.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Azure.Cosmos; -using ShellProgressBar; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using TaleLearnCode.ChChChChanges.Common; - -namespace TaleLearnCode.ChChChChanges.ArchiveData -{ - class Program - { - static async Task Main(string[] args) - { - WelcomeUser(); - await AddDataToCosmosAsync(GetQuestionInteractions()); - - Console.Beep(); - Console.WriteLine("Done"); - } - - private static void WelcomeUser() - { - Console.Clear(); - Console.WriteLine(); - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine(@" _____ .__ .__ .__ "); - Console.WriteLine(@" / _ \_______ ____ | |__ |__|__ _______ | | "); - Console.WriteLine(@" / /_\ \_ __ \_/ ___\| | \| \ \/ /\__ \ | | "); - Console.WriteLine(@"/ | \ | \/\ \___| Y \ |\ / / __ \| |__"); - Console.WriteLine(@"\____|__ /__| \___ >___| /__| \_/ (____ /____/"); - Console.WriteLine(@" \/ \/ \/ \/ "); - Console.WriteLine(); - Console.ForegroundColor = ConsoleColor.White; - } - - private static List GetQuestionInteractions() - { - Console.WriteLine(); - Console.WriteLine(); - return QuestionInteraction.GetListOfInteractions(@"D:\Repros\TaleLearnCode\Presentations\Ch-Ch-Ch-Changes\Data\QuestionInteractions.csv"); - } - - private static async Task AddDataToCosmosAsync(List questionInteractions) - { - - Console.WriteLine(); - Console.WriteLine("Press any key to start the writing data to Cosmos..."); - Console.ReadKey(); - - Console.WriteLine(); - Console.WriteLine(); - using var progressBar = new ProgressBar(questionInteractions.Count, "Connecting to database"); - - CosmosClient client = new CosmosClient(Settings.CosmosConnectionString); - CosmosDatabase database = client.GetDatabase(Settings.MoveDataDatabasebaseName); - CosmosContainer container = database.GetContainer(Settings.ArchivalContainerName); - - for (int i = 0; i < questionInteractions.Count; i++) - { - progressBar.Tick($"Writing interaction {i + 1:n0} of {questionInteractions.Count:n0}"); - await container.CreateItemAsync(questionInteractions[i]); - var delay = questionInteractions[i + 1].InteractionDateTime.Subtract(questionInteractions[i].InteractionDateTime); - await Task.Delay(Convert.ToInt32(delay.TotalMilliseconds)); - } - - } - - } - -} \ No newline at end of file diff --git a/Demos/Denormalize Data/DenormalizeData-Console/DenormalizeData-Console.csproj b/Demos/Denormalize Data/DenormalizeData-Console/DenormalizeData-Console.csproj deleted file mode 100644 index d627717..0000000 --- a/Demos/Denormalize Data/DenormalizeData-Console/DenormalizeData-Console.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - Exe - netcoreapp3.1 - TaleLearnCode.ChChChChanges.DenormalizeData - TaleLearnCode.ChChChChanges.DenormalizeData-Console - - - - - - - - - - - - diff --git a/Demos/Denormalize Data/DenormalizeData-Console/Program.cs b/Demos/Denormalize Data/DenormalizeData-Console/Program.cs deleted file mode 100644 index 5cda1f8..0000000 --- a/Demos/Denormalize Data/DenormalizeData-Console/Program.cs +++ /dev/null @@ -1,187 +0,0 @@ -using Azure.Cosmos; -using Microsoft.VisualBasic.FileIO; -using ShellProgressBar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using TaleLearnCode.ChChChChanges.Common; - -namespace TaleLearnCode.ChChChChanges.DenormalizeData -{ - class Program - { - static async Task Main(string[] args) - { - await AddDataToCosmosAsync(); - } - - private static void WelcomeUser() - { - Console.Clear(); - Console.WriteLine(); - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine(@"________ .__ .__ "); - Console.WriteLine(@"\______ \ ____ ____ ___________ _____ _____ | | |__|_______ ____ "); - Console.WriteLine(@" | | \_/ __ \ / \ / _ \_ __ \/ \\__ \ | | | \___ // __ \ "); - Console.WriteLine(@" | ` \ ___/| | ( <_> ) | \/ Y Y \/ __ \| |_| |/ /\ ___/ "); - Console.WriteLine(@"/_______ /\___ >___| /\____/|__| |__|_| (____ /____/__/_____ \\___ >"); - Console.WriteLine(@" \/ \/ \/ \/ \/ \/ \/ "); Console.WriteLine(); - Console.ForegroundColor = ConsoleColor.White; - } - - private static async Task AddDataToCosmosAsync() - { - - using CosmosClient client = new CosmosClient(Settings.CosmosConnectionString); - CosmosDatabase database = client.GetDatabase(Settings.ShindigManagerDatabaseName); - - var execute = true; - while (execute) - { - WelcomeUser(); - Console.WriteLine("Select an option:"); - Console.WriteLine("\tUpload [P]resentations"); - Console.WriteLine("\tUpload [M]etedata"); - Console.WriteLine("\tE[x]it"); - var cki = Console.ReadKey(); - if (cki.Key == ConsoleKey.P) await AddPresentationsToCosmosAsync(database); - if (cki.Key == ConsoleKey.M) await AddMetadataToCosmosAsync(database); - if (cki.Key == ConsoleKey.X) execute = false; - } - - } - - private static async Task AddPresentationsToCosmosAsync(CosmosDatabase database) - { - - Console.WriteLine(); - Console.WriteLine("Retrieving the presentations..."); - var presentations = GetAllPresentations(); - - Console.WriteLine(); - using var progressBar = new ProgressBar(presentations.Count, "Connecting to the Cosmos DB container"); - int counter = 0; - - CosmosContainer container = database.GetContainer(Settings.PresentationsContainerName); - - foreach (var presentation in presentations) - { - counter++; - await container.CreateItemAsync(presentation); - progressBar.Tick($"Writing presentation {counter} of {presentations.Count}"); - } - - } - - private static async Task AddMetadataToCosmosAsync(CosmosDatabase database) - { - - Console.WriteLine(); - Console.WriteLine("Retrieving the metadata..."); - var metadata = GetMetadata(); - - Console.WriteLine(); - using var progressBar = new ProgressBar(metadata.Metadata.Count + metadata.Speakers.Count, "Connecting to the Cosmos DB container"); - int counter = 0; - - CosmosContainer container = database.GetContainer(Settings.MetadataContainerName); - - foreach (var item in metadata.Metadata) - { - counter++; - await container.CreateItemAsync(item); - progressBar.Tick($"Writing metadata item {counter} of {metadata.Metadata.Count + metadata.Speakers.Count}"); - } - - foreach (var speaker in metadata.Speakers) - { - counter++; - await container.CreateItemAsync(speaker); - progressBar.Tick($"Writing metadata item {counter} of {metadata.Metadata.Count + metadata.Speakers.Count}"); - } - - } - - private static List GetAllPresentations() - { - var presentations = new List(); - presentations.AddRange(GetEventPresentations("CPL19")); - presentations.AddRange(GetEventPresentations("CPL20")); - return presentations; - } - - private static List GetEventPresentations(string eventId) - { - - var presentations = new Dictionary(); - - using var parser = new TextFieldParser($@"D:\Repros\TaleLearnCode\Presentations\Ch-Ch-Ch-Changes\Data\{eventId}.csv"); - parser.TextFieldType = FieldType.Delimited; - parser.SetDelimiters(","); - while (!parser.EndOfData) - { - string[] fields = parser.ReadFields(); - - if (presentations.ContainsKey(fields[PresentationFields.Id])) - { - - if (presentations[fields[PresentationFields.Id]].Speakers.FindIndex(x => x.Id == fields[PresentationFields.SpeakerId]) == -1) - presentations[fields[PresentationFields.Id]].Speakers.Add( - new Speaker( - fields[PresentationFields.SpeakerId], - fields[PresentationFields.SpeakerFirstName], - fields[PresentationFields.SpeakerLastName])); - - if (presentations[fields[PresentationFields.Id]].Topics.FindIndex(x => x.Id == fields[PresentationFields.TopicId]) == -1) - presentations[fields[PresentationFields.Id]].Topics.Add( - Metadata.TopicFactory(fields[PresentationFields.TopicId], - fields[PresentationFields.TopicName])); - - if (presentations[fields[PresentationFields.Id]].Tags.FindIndex(x => x.Id == fields[PresentationFields.TagId]) == -1) - presentations[fields[PresentationFields.Id]].Tags.Add( - Metadata.TagFactory(fields[PresentationFields.TagId], - fields[PresentationFields.TagName])); - - } - else - presentations.Add(fields[PresentationFields.Id], new Presentation(fields)); - } - - return presentations.Values.ToList(); - - } - - private static (List Metadata, List Speakers) GetMetadata() - { - - var metadata = new List(); - var speakers = new List(); - - using var parser = new TextFieldParser($@"D:\Repros\TaleLearnCode\Presentations\Ch-Ch-Ch-Changes\Data\Metadata.csv"); - parser.TextFieldType = FieldType.Delimited; - parser.SetDelimiters(","); - while (!parser.EndOfData) - { - string[] fields = parser.ReadFields(); - if (fields[MetadataFields.Type] != "speaker") - metadata.Add( - new Metadata( - fields[MetadataFields.Type], - fields[MetadataFields.Id], - fields[MetadataFields.Name])); - else - speakers.Add( - new Speaker( - fields[MetadataFields.Id], - fields[MetadataFields.FirstName], - fields[MetadataFields.LastName])); - } - - return (metadata, speakers); - - } - - } - -} \ No newline at end of file diff --git a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/EventDrivenArchitecture-Console.csproj b/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/EventDrivenArchitecture-Console.csproj deleted file mode 100644 index 01c8aee..0000000 --- a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/EventDrivenArchitecture-Console.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - Exe - netcoreapp3.1 - TaleLearnCode.ChChChChanges.EventDrivenArchitecture - TaleLearnCode.ChChChChanges.EventDrivenArchitecture-Console - - - - - - - - - - - - diff --git a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/OrderSimulator.cs b/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/OrderSimulator.cs deleted file mode 100644 index 2d614ed..0000000 --- a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/OrderSimulator.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Azure.Cosmos; -using Microsoft.VisualBasic.FileIO; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using TaleLearnCode.ChChChChanges.Common; - -namespace TaleLearnCode.ChChChChanges.EventDrivenArchitecture -{ - public class OrderSimulator - { - - private List _fakeNames = new List(); - private List _products = new List(); - - public OrderSimulator() - { - GetFakeNames(); - GetProducts(); - } - - public async Task SimulateOrdersAsync() - { - using CosmosClient client = new CosmosClient(Settings.CosmosConnectionString); - CosmosDatabase database = client.GetDatabase(Settings.OrderManagementDatabaseName); - CosmosContainer container = database.GetContainer(Settings.OrdersContainerName); - - //while (true) - //{ - // var order = GetOrder(); - // await container.CreateItemAsync(order); - // Console.WriteLine($"Saved order #{order.Id}"); - // await Task.Delay(500); - //} - - var order = GetOrder(); - await container.CreateItemAsync(order); - - } - - private void GetFakeNames() - { - - Console.WriteLine("Generating fake names for the demo..."); - - using var parser = new TextFieldParser($@"C:\Users\chadg\Downloads\FakeNameGenerator.com_100eedb1\FakeNames.csv"); - parser.TextFieldType = FieldType.Delimited; - parser.SetDelimiters(","); - while (!parser.EndOfData) - { - string[] fields = parser.ReadFields(); - _fakeNames.Add(new FakeName() - { - FirstName = fields[FakeNameFields.GivenName], - LastName = fields[FakeNameFields.Surname], - StreetAddress = fields[FakeNameFields.StreetAddress], - City = fields[FakeNameFields.City], - State = fields[FakeNameFields.State], - PostalCode = fields[FakeNameFields.ZipCode], - Country = fields[FakeNameFields.Country], - EmailAddress = fields[FakeNameFields.EmailAddress], - UserName = fields[FakeNameFields.UserName] - }); - } - - } - - private void GetProducts() - { - Console.WriteLine("Generating fake products for the demo..."); - _products.Add(new Product("75291", "Lego Death Start Final Duel", 99.99m)); - _products.Add(new Product("75293", "Resistance I-TS Transport", 99.99m)); - _products.Add(new Product("75286", "General Grievous's Starfighter", 79.99m)); - _products.Add(new Product("75318", "The Child", 79.99m)); - _products.Add(new Product("75278", "D-O", 69.99m)); - _products.Add(new Product("75284", "Knights of Ren™ Transport Ship", 69.99m)); - _products.Add(new Product("75277", "Boba Fett™ Helmet", 59.99m)); - _products.Add(new Product("75276", "Stormtrooper™ Helmet", 59.99m)); - _products.Add(new Product("75292", "The Razor Crest", 129.99m)); - _products.Add(new Product("21046", "Empire State Building", 129.99m)); - } - - private Order GetOrder() - { - var rand = new Random(); - - var customer = _fakeNames[rand.Next(0, _fakeNames.Count)]; - var order = new Order() - { - UserName = customer.UserName, - EmailAddress = customer.EmailAddress, - ShippingAddress = new PostalAddress(customer.FirstName, customer.LastName, customer.StreetAddress, customer.State, customer.PostalCode, customer.Country), - OrderDateTime = DateTime.UtcNow - }; - - var numberOfItems = rand.Next(1, 10); - for (int i = 1; i <= numberOfItems; i++) - { - var product = _products[rand.Next(0, _products.Count)]; - order.OrderItems.Add(new OrderItem(product, rand.Next(1, 3))); - } - - return order; - - } - - } - -} \ No newline at end of file diff --git a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/Program.cs b/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/Program.cs deleted file mode 100644 index 73fa6a6..0000000 --- a/Demos/Event-Driven Architecture/EventDrivenArchitecture-Console/Program.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Threading.Tasks; - -namespace TaleLearnCode.ChChChChanges.EventDrivenArchitecture -{ - class Program - { - static async Task Main(string[] args) - { - WelcomeUser(); - var orderSimulator = new OrderSimulator(); - Console.WriteLine("Press any key to start the simulator..."); - Console.ReadKey(); - await orderSimulator.SimulateOrdersAsync(); - } - - private static void WelcomeUser() - { - Console.Clear(); - Console.WriteLine(); - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine(@"___________________ _____ "); - Console.WriteLine(@"\_ _____/\______ \ / _ \ "); - Console.WriteLine(@" | __)_ | | \ / /_\ \ "); - Console.WriteLine(@" | \ | ` \/ | \"); - Console.WriteLine(@"/_______ //_______ /\____|__ /"); - Console.WriteLine(@" \/ \/ \/ "); - Console.ForegroundColor = ConsoleColor.White; - Console.WriteLine(); - } - - } - -} \ No newline at end of file diff --git a/Demos/Replicating Data/ReplicatingData-Console/Program.cs b/Demos/Replicating Data/ReplicatingData-Console/Program.cs deleted file mode 100644 index 12f960d..0000000 --- a/Demos/Replicating Data/ReplicatingData-Console/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace TaleLearnCode.ChChChChanges.ReplicatingData -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} \ No newline at end of file diff --git a/Demos/Replicating Data/ReplicatingData-Console/ReplicatingData-Console.csproj b/Demos/Replicating Data/ReplicatingData-Console/ReplicatingData-Console.csproj deleted file mode 100644 index 7f77461..0000000 --- a/Demos/Replicating Data/ReplicatingData-Console/ReplicatingData-Console.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - netcoreapp3.1 - TaleLearnCode.ChChChChanges.ReplicatingData - TaleLearnCode.ChChChChanges.ReplicatingData-Console - - - - - - -