From 32ce3953d8bbfbfc47197f37f6040a51d6cb9f27 Mon Sep 17 00:00:00 2001 From: ftorres Date: Wed, 29 Apr 2020 16:28:34 -0400 Subject: [PATCH 1/5] Upgrade to .NET 4.6.1. Default to connection string using local instance of sql server. Added setup instruction in readme --- BrainWare.sln | 12 +++- PopulateDB.sql => ProjectDB/PopulateDB.sql | 0 ProjectDB/ProjectDB.sqlproj | 1 + README.md | 18 ++++++ Tests/App.config | 12 ++-- Tests/Tests.csproj | 3 +- Web/Infrastructure/Database.cs | 6 +- Web/Web.config | 72 +++++++++++++--------- Web/Web.csproj | 11 ++-- 9 files changed, 90 insertions(+), 45 deletions(-) rename PopulateDB.sql => ProjectDB/PopulateDB.sql (100%) diff --git a/BrainWare.sln b/BrainWare.sln index b23e653..a35c2af 100644 --- a/BrainWare.sln +++ b/BrainWare.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 MinimumVisualStudioVersion = 10.0.40219.1 Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "ProjectDB", "ProjectDB\ProjectDB.sqlproj", "{58D1E657-AA21-497F-BA9C-634D6DA2D921}" EndProject @@ -9,6 +9,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Web\Web.csproj", "{F EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{6C10F27E-A278-4801-8AC7-929212274D85}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5FC57735-E720-490F-AB66-1EEC6F7A26B4}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,4 +38,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F2D2A54A-021F-4976-A139-0364135E456F} + EndGlobalSection EndGlobal diff --git a/PopulateDB.sql b/ProjectDB/PopulateDB.sql similarity index 100% rename from PopulateDB.sql rename to ProjectDB/PopulateDB.sql diff --git a/ProjectDB/ProjectDB.sqlproj b/ProjectDB/ProjectDB.sqlproj index acbb062..8a7f1f2 100644 --- a/ProjectDB/ProjectDB.sqlproj +++ b/ProjectDB/ProjectDB.sqlproj @@ -65,6 +65,7 @@ + diff --git a/README.md b/README.md index a520b71..5dae803 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,21 @@ Change the AttachDbFile name to the full path of the BrainWare.mdf file (located ## Original Output Example ![page image](output.GIF?raw=true) + + +## Setup + +### Database Setup +- Start SQL Server Management Studio as Administrator +- Once conntected to your local SQL Server instance +- Right click on the Database node and select attach +- Select the file BrainWare\Web\App_Data\BrainWare.mdf + +- You can also deploy the project ProjectDB to your local SQL Server instance +- Then execute in SQL Server Management Studio the file BrainWare\ProjectDB\PopulateDB.sql + +### Visual Studio +- Open solution BrainWare\BrainWare.sln +- Set the project Web, as the start up project +- Press F5 +- Execpted a browser is open with the result of the first order \ No newline at end of file diff --git a/Tests/App.config b/Tests/App.config index c6d54b1..025efa1 100644 --- a/Tests/App.config +++ b/Tests/App.config @@ -1,4 +1,4 @@ - + + + + + - - - - + + + + + - - + + - + - - - - + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + \ No newline at end of file diff --git a/Web/Web.csproj b/Web/Web.csproj index 98ce235..07dc59d 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -15,7 +15,7 @@ Properties Web Web - v4.5.2 + v4.6.1 false true @@ -26,6 +26,8 @@ /subscriptions/2d4dc7b2-21d7-4398-9fa5-238684687c92/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/Web + + true @@ -80,13 +82,13 @@ + + - - - + @@ -140,6 +142,7 @@ True ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll + True ..\packages\WebGrease.1.5.2\lib\WebGrease.dll From 0031c185061a9d27402ec2f826d5945bd5927753 Mon Sep 17 00:00:00 2001 From: ftorres Date: Thu, 30 Apr 2020 10:20:18 -0400 Subject: [PATCH 2/5] Upgrade to .NET 4.6.1. Default to connection string using local instance of sql server. Added setup instruction in readme --- Web/Web.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Web.config b/Web/Web.config index 7b881b5..d52f875 100644 --- a/Web/Web.config +++ b/Web/Web.config @@ -5,7 +5,7 @@ --> - + From 9ae15ba456e404f71847c17cdc4e6b934afb7188 Mon Sep 17 00:00:00 2001 From: ftorres Date: Thu, 30 Apr 2020 15:27:33 -0400 Subject: [PATCH 3/5] Fred CleanUp Part 1 --- README.md | 6 +++--- Web/Infrastructure/Database.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5dae803..5695db0 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Change the AttachDbFile name to the full path of the BrainWare.mdf file (located ### Database Setup - Start SQL Server Management Studio as Administrator -- Once conntected to your local SQL Server instance -- Right click on the Database node and select attach +- Once connected to your local SQL Server instance +- Right click on the Database node and select Attach - Select the file BrainWare\Web\App_Data\BrainWare.mdf - You can also deploy the project ProjectDB to your local SQL Server instance @@ -36,4 +36,4 @@ Change the AttachDbFile name to the full path of the BrainWare.mdf file (located - Open solution BrainWare\BrainWare.sln - Set the project Web, as the start up project - Press F5 -- Execpted a browser is open with the result of the first order \ No newline at end of file +- Expected a browser is open with the result of the first order diff --git a/Web/Infrastructure/Database.cs b/Web/Infrastructure/Database.cs index dcbe351..2a2bf09 100644 --- a/Web/Infrastructure/Database.cs +++ b/Web/Infrastructure/Database.cs @@ -14,7 +14,7 @@ namespace Web.Infrastructure public Database() { - // var connectionString = "Data Source=(LocalDb)\\MSSQLLocalDB;Initial Catalog=BrainWAre;Integrated Security=SSPI;AttachDBFilename=D:\\BrainWare\\Web\\App_Data\\BrainWare.mdf" + // var connectionString = "Data Source=(LocalDb)\\MSSQLLocalDB;Initial Catalog=BrainWAre;Integrated Security=SSPI;AttachDBFilename=D:\\BrainWare\\Web\\App_Data\\BrainWare.mdf" var connectionString = "Data Source=LOCALHOST;Initial Catalog=BrainWare;Integrated Security=SSPI"; _connection = new SqlConnection(connectionString); From aeb3723ce8ef6c9868ce2adc1ce37627f7f477c4 Mon Sep 17 00:00:00 2001 From: ftorres Date: Thu, 30 Apr 2020 19:12:39 -0400 Subject: [PATCH 4/5] Fred CleanUp Part 1 --- README.md | 1 + Web/Infrastructure/OrderService.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5695db0..afd5e23 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Change the AttachDbFile name to the full path of the BrainWare.mdf file (located ### Visual Studio - Open solution BrainWare\BrainWare.sln +- Update the database connection string in file Web\Infrastructure\Database.cs - Set the project Web, as the start up project - Press F5 - Expected a browser is open with the result of the first order diff --git a/Web/Infrastructure/OrderService.cs b/Web/Infrastructure/OrderService.cs index be3a4e1..5fe0345 100644 --- a/Web/Infrastructure/OrderService.cs +++ b/Web/Infrastructure/OrderService.cs @@ -29,7 +29,7 @@ namespace Web.Infrastructure values.Add(new Order() { - CompanyName = record1.GetString(0), + CompanyName = record1["name"].ToString(), Description = record1.GetString(1), OrderId = record1.GetInt32(2), OrderProducts = new List() From d073eb03d5157ce3f25e617a3c29abad2d2f58eb Mon Sep 17 00:00:00 2001 From: ftorres Date: Thu, 30 Apr 2020 19:13:53 -0400 Subject: [PATCH 5/5] Fred CleanUp Part 1 --- Web/Infrastructure/OrderService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Infrastructure/OrderService.cs b/Web/Infrastructure/OrderService.cs index 5fe0345..be3a4e1 100644 --- a/Web/Infrastructure/OrderService.cs +++ b/Web/Infrastructure/OrderService.cs @@ -29,7 +29,7 @@ namespace Web.Infrastructure values.Add(new Order() { - CompanyName = record1["name"].ToString(), + CompanyName = record1.GetString(0), Description = record1.GetString(1), OrderId = record1.GetInt32(2), OrderProducts = new List()