From 25db16c47fa2968cf98fa1748d4fcec55213beb9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GENO133\\IvanPlex" Date: Sat, 6 Jan 2024 08:53:45 -0700 Subject: [PATCH] added kwh setting --- Controllers/HomeController.cs | 3 ++- External/Implementations/CollisionRecordDataAccess.cs | 2 +- Models/UserConfig.cs | 1 + Views/Home/_Settings.cshtml | 9 +++++++-- appsettings.json | 3 ++- userConfig.json | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index b04364f..a44cafd 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -45,7 +45,8 @@ namespace CarCareTracker.Controllers UseDarkMode = bool.Parse(_config[nameof(UserConfig.UseDarkMode)]), UseMPG = bool.Parse(_config[nameof(UserConfig.UseMPG)]), UseDescending = bool.Parse(_config[nameof(UserConfig.UseDescending)]), - EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]) + EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]), + UsekWh = bool.Parse(_config[nameof(UserConfig.UsekWh)]) }; return PartialView("_Settings", userConfig); } diff --git a/External/Implementations/CollisionRecordDataAccess.cs b/External/Implementations/CollisionRecordDataAccess.cs index eb4366f..0044f3b 100644 --- a/External/Implementations/CollisionRecordDataAccess.cs +++ b/External/Implementations/CollisionRecordDataAccess.cs @@ -6,7 +6,7 @@ namespace CarCareTracker.External.Implementations { public class CollisionRecordDataAccess : ICollisionRecordDataAccess { - private static string dbName = "cartracker.db"; + private static string dbName = "db/cartracker.db"; private static string tableName = "collisionrecords"; public List GetCollisionRecordsByVehicleId(int vehicleId) { diff --git a/Models/UserConfig.cs b/Models/UserConfig.cs index b3cd48c..ef113e7 100644 --- a/Models/UserConfig.cs +++ b/Models/UserConfig.cs @@ -3,6 +3,7 @@ public class UserConfig { public bool UseDarkMode { get; set; } + public bool UsekWh { get; set; } public bool EnableCsvImports { get; set; } public bool UseMPG { get; set; } public bool UseDescending { get; set; } diff --git a/Views/Home/_Settings.cshtml b/Views/Home/_Settings.cshtml index 3359242..8997bb7 100644 --- a/Views/Home/_Settings.cshtml +++ b/Views/Home/_Settings.cshtml @@ -16,7 +16,11 @@
- + +
+
+ +
@@ -76,7 +80,8 @@ useDarkMode: $("#enableDarkMode").is(':checked'), enableCsvImports: $("#enableCsvImports").is(':checked'), useMPG: $("#useMPG").is(':checked'), - useDescending: $("#useDescending").is(':checked') + useDescending: $("#useDescending").is(':checked'), + usekWh: $("#usekWh").is(':checked') } $.post('/Home/WriteToSettings', { userConfig: userConfigObject}, function(data){ if (data) { diff --git a/appsettings.json b/appsettings.json index d621863..0cb8fa6 100644 --- a/appsettings.json +++ b/appsettings.json @@ -19,5 +19,6 @@ "UseDescending": false, "EnableAuth": false, "UserNameHash": "", - "UserPasswordHash": "" + "UserPasswordHash": "", + "UsekWh": false } diff --git a/userConfig.json b/userConfig.json index 681da11..62cf701 100644 --- a/userConfig.json +++ b/userConfig.json @@ -1 +1 @@ -{"UseDarkMode":true,"EnableCsvImports":false,"UseMPG":true,"UseDescending":false,"EnableAuth":false,"UserNameHash":"","UserPasswordHash":""} \ No newline at end of file +{"UseDarkMode":true,"UsekWh":false,"EnableCsvImports":false,"UseMPG":true,"UseDescending":false,"EnableAuth":false,"UserNameHash":"","UserPasswordHash":""} \ No newline at end of file