@@ -122,7 +110,7 @@
-
+
@@ -173,7 +161,7 @@
Startdatum
-
+
@if(Model.IsEndDateVisible)
@@ -185,7 +173,7 @@
Enddatum
-
+
}
@@ -219,11 +207,11 @@
Von
-
+
Bis
-
+
@@ -241,7 +229,7 @@
@labelText
-
+
@if(Model.IsZeiterfassungInStdMin)
{
@@ -292,8 +280,8 @@
@if(Model.NumberOfDokuTypes == 0)
{
-
-
+
+
}
else
@@ -316,7 +304,7 @@
var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1);
-
+
}
@@ -345,6 +333,5 @@
}
@Html.Partial("RestoreServiceRecordInputsPartial", Model)
-
}
\ No newline at end of file
diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml
index 68bc68b3a..1c4fc1124 100644
--- a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml
@@ -6,76 +6,95 @@
{
}
}
@using(Html.BeginForm("ResetGroupBookingForm", "Main", FormMethod.Post, new { Id = "reset-group-booking-form-form" }))
diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml
index ff83da3e4..e3fafa98b 100644
--- a/BeWoPlanerMobil/Views/Main/Main.cshtml
+++ b/BeWoPlanerMobil/Views/Main/Main.cshtml
@@ -1,5 +1,6 @@
@using BeWoPlanerMobil.Models;
@using BeWoPlanerMobil.Util;
+@using BS.Shared
@model MainModel
@{
@@ -25,6 +26,8 @@
}
@@ -105,7 +105,7 @@
-
+
@if(Model.IsEndDateVisible)
@@ -162,7 +162,7 @@
Enddatum
-
+
}
@@ -197,11 +197,11 @@
Von
-
+
Bis
-
+
@@ -219,7 +219,7 @@
@labelText
-
+
@if(Model.IsZeiterfassungInStdMin)
{
@@ -249,7 +249,7 @@
Gefahrene Kilometer
-
+
@@ -273,7 +273,7 @@
{
-
+
}
else
@@ -296,7 +296,7 @@
var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1);
-
+
}
@@ -315,6 +315,5 @@
}
@Html.Partial("RestoreServiceRecordInputsPartial", Model)
-
}
\ No newline at end of file
diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml
index 05a48d2e4..15a34bd26 100644
--- a/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml
@@ -6,103 +6,123 @@
{
}
}
diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml
index baddcc70b..ee45788c7 100644
--- a/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml
@@ -17,7 +17,7 @@
-
+
@* (Mehrfachbuchung) Ausgewählte Hilfepläne *@
diff --git a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
index 46aee2de1..827c28196 100644
--- a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml
@@ -1,483 +1,266 @@
@using BeWoPlanerMobil.Service
@using BeWoPlanerMobil.Util
+@using BS.Shared
@model BeWoPlanerMobil.Models.MainModel
@*
- ToDo: Bei Hilfeplan schauen, ob die Ziele/Maßnahmen, Kategorie/Leistung, Textbausteines korrekt sind.
-*@
+ ToDo: Bei Hilfeplan schauen, ob die Ziele/Maßnahmen, Kategorie/Leistung, Textbausteines korrekt sind.
+*@
+
-@if(TempData[TempDataConstants.AfterRestoreKey] is bool and true)
-{
-
-
-
-}
-@using(Html.BeginForm("RestoreServiceRecordForm", "Main", FormMethod.Post, new {id="restore-service-record-form"}))
+@using(Html.BeginForm("RestoreServiceRecordForm", "Main", FormMethod.Post, new { id = "restore-service-record-form" }))
{
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
}
+
+
+
+@if(Html.IsInDebugMode())
+{
+
+}
\ No newline at end of file
diff --git a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml
index ae0c7b53d..532eae60a 100644
--- a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml
@@ -5,147 +5,167 @@
@model MainModel
@{
- if(TempData[TempDataConstants.DoLogoutKey] is bool and true)
+ if(TempData[TempDataConstants.DoLogoutKey] is true)
{
}
}
@using(Html.BeginForm("ResetSingleBookingForm", "Main", FormMethod.Post, new { Id = "reset-single-booking-form-form" })) { }
@@ -274,7 +294,7 @@
}
}
-
+
@@ -309,7 +329,7 @@
-
+
@@ -373,7 +393,7 @@
Startdatum
-
+
@if(Model.IsEndDateVisible)
@@ -385,7 +405,7 @@
Enddatum
-
+
}
@@ -398,11 +418,11 @@
Von
-
+
Bis
-
+
@@ -420,7 +440,7 @@
@labelText
-
+
@if(Model.IsZeiterfassungInStdMin)
{
@@ -450,7 +470,7 @@
Gefahrene Kilometer
-
+
@@ -461,10 +481,10 @@
@if(Model.HasRightToSeeTextModules)
{
+ function textModuleButtonOnClick() {
+ $('#tree').load('@Url.Action("LoadUpToDateTextModules")');
+ }
+
@@ -479,7 +499,7 @@
{
-
+
}
else
@@ -490,7 +510,7 @@
var currentDokuType = Model.Dokutypes[i];
-
+
@currentDokuType.DisplayName
@@ -502,7 +522,7 @@
var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1);
-
+
}
diff --git a/BeWoPlanerMobil/Views/Main/TextModulePartial.cshtml b/BeWoPlanerMobil/Views/Main/TextModulePartial.cshtml
index 561eb90f5..48d672bf7 100644
--- a/BeWoPlanerMobil/Views/Main/TextModulePartial.cshtml
+++ b/BeWoPlanerMobil/Views/Main/TextModulePartial.cshtml
@@ -40,7 +40,7 @@
prefix = "mb";
}
- const dokufeldId = `#${prefix}-dokufeld-textarea`;
+ const dokufeldId = `#${prefix}-doku-textarea`;
const dokuTextareaId = `#${prefix}-doku-textarea-`;
const textareaContainerId = `#${prefix}-doku_`;
@@ -51,10 +51,10 @@
const numberOfDokutypes = getNumberOfDokutypes();
for(let i = 0; i < numberOfDokutypes; i++) {
- const currentElement = $(`#${prefix}-doku_${i}`);
+ const currentElement = $(`${textareaContainerId}${i}`);
if(currentElement.css("display") !== "none") {
- focusedDokuFeld = $(dokuTextareaId + i);
+ focusedDokuFeld = $(`${dokuTextareaId}${i}`);
break;
}
}
diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml
index 34ceca949..e96a768cd 100644
--- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml
+++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml
@@ -2,9 +2,9 @@
@using BeWoPlanerMobil.Models
@using BeWoPlanerMobil.Service
@using BeWoPlanerMobil.Util
-@using DevExpress.XtraReports.Web
+
-
+
@@ -51,7 +51,7 @@
-
+
@@ -254,7 +254,7 @@
});
function toggleRestoreButton() {
- const state = !window.getRestoreButtonState();
+ const state = false;
if($(".bewo-restore-btn").length > 0) {
$(".bewo-restore-btn").each(function(index, item) {
@@ -396,12 +396,16 @@
}
- }
- @if(Html.IsInDebugMode())
- {
+
+
+
+
-
+
+ @if(Html.IsInDebugMode())
+ {
+
+ }
@if(TempData[TempDataConstants.ErrorMessageKey] is string errorMessage)
{
diff --git a/Shared/Extensions/DateTimeExtensions.cs b/Shared/Extensions/DateTimeExtensions.cs
index 912673c46..8179b80f8 100644
--- a/Shared/Extensions/DateTimeExtensions.cs
+++ b/Shared/Extensions/DateTimeExtensions.cs
@@ -2,6 +2,7 @@
using System.Globalization;
using BS.Shared.Core;
using System.Collections.Generic;
+using System.Text.RegularExpressions;
using DevExpress.XtraScheduler;
namespace BS.Shared.Extensions
@@ -28,6 +29,8 @@ namespace BS.Shared.Extensions
public static class DateTimeExtensions
{
+ private static string _TimePattern = @"^(?:[01]\d|2[0-3]):[0-5]\d$";
+
public static DateTimeUnit GetDateTimeUnit(this DateTime Date1, DateTime Date2, TimeUnit unit)
{
List period = new List() { Date1, Date2 };
@@ -720,5 +723,32 @@ namespace BS.Shared.Extensions
{
return date.Hour == date2.Hour && date.Minute == date2.Minute && date.Second == date2.Second;
}
+
+ ///
+ /// Fügt einem Datumsobjekt die Uhrzeit aus einem Uhrzeitenstring im Format HH:mm hinzu. Ist der Uhrzeitenstring ungültig, wird 00:00:00 Uhr genommen.
+ /// Ist aber useSecond1IfNoValidTimeString true, wird 00:00:01 Uhr für ServiceRecords genommen, die ohne Uhrzeit gespeichert werden.
+ ///
+ /// Datum, dem der Uhrzeitteil hinzugefügt werden soll
+ /// Die Zeichenkette mit dem Uhrzeitteil im Format HH:mm
+ /// Flag, das bestimmt, ob die Sekunde bei fehlendem/ungültigem Uhrzeitteil auf 1 gesetzt werden soll.
+ /// Das Datumsobjekt mit Uhrzeitteil.
+ public static DateTime MergeDateAndTimeString(this DateTime date, string timeString, bool useSecond1IfNoValidTimeString = false)
+ {
+ if(Regex.IsMatch(timeString, _TimePattern))
+ {
+ var hour2Minute = timeString.Split(':');
+
+ var hour = int.Parse(hour2Minute[0]);
+ var minute = int.Parse(hour2Minute[1]);
+
+ date.MergeDateWithHoursMinutesSeconds(hour, minute, 0);
+ }
+ else if(useSecond1IfNoValidTimeString)
+ {
+ date.MergeDateWithHoursMinutesSeconds(0, 0, 1);
+ }
+
+ return date;
+ }
}
}
\ No newline at end of file
diff --git a/Shared/Extensions/StringExtensions.cs b/Shared/Extensions/StringExtensions.cs
index 802851889..8d2003789 100644
--- a/Shared/Extensions/StringExtensions.cs
+++ b/Shared/Extensions/StringExtensions.cs
@@ -84,6 +84,11 @@ namespace BS.Shared.Extensions
throw new ArgumentException("Not found.", "description");
}
+ ///
+ /// Ersetzt das große ẞ durch ein kleines, da das große ẞ nicht von latin01 inder Datenbank unterstützt wird.
+ ///
+ /// String, der möglicherweise ein großes ẞ enthält.
+ /// pString, mit ersetzten, großen ẞ, falls vorher vorhanden.
public static string RemoveUppercaseEsszett(this string pString)
{
return pString?.Replace("ẞ", "ß");
diff --git a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/BeWoDatabaseUpdater.csproj b/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/BeWoDatabaseUpdater.csproj
index 01232a757..70bfc9cf3 100644
--- a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/BeWoDatabaseUpdater.csproj
+++ b/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/BeWoDatabaseUpdater.csproj
@@ -110,9 +110,11 @@
+
-
+
+
@@ -130,5 +132,6 @@
false
+
\ No newline at end of file
diff --git a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Program.cs b/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Program.cs
index 08eac9988..018cb8fec 100644
--- a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Program.cs
+++ b/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Program.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -8,7 +7,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BeWoDatabaseUpdater.Extensions;
-using MySql.Data.MySqlClient;
+using BeWoDatabaseUpdater.Utils;
namespace BeWoDatabaseUpdater
{
@@ -29,6 +28,8 @@ namespace BeWoDatabaseUpdater
private static readonly List _LastAccessTimes = [];
private static readonly Stopwatch _Stopwatch = new();
+ private static int _OpenDbConnections = 0;
+
private static async Task Main(string[] args)
{
var settingsFilePath = Path.Combine(AppContext.BaseDirectory, UpdaterSettingsFilePath);
@@ -51,7 +52,7 @@ namespace BeWoDatabaseUpdater
if(string.IsNullOrWhiteSpace(_ConnectionString))
{
Console.WriteLine();
- Console.Write("Connection String: ");
+ Console.Write("Connection String (Server, User Id, Passwort): ");
_ConnectionString = Console.ReadLine();
}
@@ -64,9 +65,7 @@ namespace BeWoDatabaseUpdater
Console.WriteLine($"{DateTime.Now:dd.MM.yyyy HH:mm:ss.fff}: Führe Updates durch ...{Environment.NewLine}");
- var helper = new MySqlHelper(_ConnectionString);
-
- _BeWoSchemaNames = await helper.LoadBeWoDatabaseNames() ?? [];
+ _BeWoSchemaNames = await MySqlBeWoHelper.LoadBeWoDatabaseNames(_ConnectionString) ?? [];
LoadSqlScriptsFromFilesToMemory(() =>
{
@@ -79,7 +78,7 @@ namespace BeWoDatabaseUpdater
fileCount++;
});
- var message = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss.fff}: {commandCount} MySQL-Abfragen in {fileCount} Dateien und {_BeWoSchemaNames.Count} BeWoPlaner-Datenbanken ({_BeWoSchemaNames.Count * commandCount} Transaktionen gesamt):{Environment.NewLine}";
+ var message = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss.fff}: {commandCount} MySQL-Abfrag{(commandCount != 1 ? "en" : string.Empty)} in {fileCount} Datei{(fileCount != 1 ? "en" : string.Empty)} und {_BeWoSchemaNames.Count} BeWoPlaner-Datenbanken ({_BeWoSchemaNames.Count * commandCount} Transaktionen gesamt):{Environment.NewLine}";
var sb = new StringBuilder();
@@ -96,9 +95,8 @@ namespace BeWoDatabaseUpdater
return;
}
- helper.OpenSession();
-
// Ein Thread pro Sql-Kommando
+ // ToDo: Threads beachten!
var threads = new List();
foreach(var schemaName in _BeWoSchemaNames)
@@ -109,11 +107,11 @@ namespace BeWoDatabaseUpdater
foreach(var command in path2Commands.Commands)
{
- var thread = new Thread(async () =>
+ var thread = new Thread(() =>
{
var sql = $"USE `{schemaName}`; {command}";
- await helper.ExecuteUpdateOrCreate(sql, path2Commands.FilePath);
+ MySqlBeWoHelper.ExecuteUpdateOrCreateAsync(sql, path2Commands.FilePath, _ConnectionString);
});
thread.Start();
@@ -127,7 +125,6 @@ namespace BeWoDatabaseUpdater
{
thread.Join();
- helper.CloseSession();
OnAllThreadsCompleted();
});
});
@@ -136,7 +133,7 @@ namespace BeWoDatabaseUpdater
Console.Read();
#endif
- if(MySqlHelper.DistinctErrors.Any())
+ if(MySqlBeWoHelper.DistinctErrors.Any())
{
Console.Read();
}
@@ -158,9 +155,11 @@ namespace BeWoDatabaseUpdater
Console.WriteLine($"{DateTime.Now:dd.MM.yyyy HH:mm:ss.fff}: Dauer: {timeSpan.ToShortString()}{Environment.NewLine}");
- Console.WriteLine($"{MySqlHelper.DistinctErrors.Count} Fehler{(MySqlHelper.DistinctErrors.Any() ? ":" : "")}");
+ Console.WriteLine($"{MySqlBeWoHelper.DistinctErrors.Count} Fehler{(MySqlBeWoHelper.DistinctErrors.Any() ? ":" : "")}");
- MySqlHelper.DistinctErrors.DoForEach(number2Message => Console.WriteLine($"{number2Message.Key}: {number2Message.Value}"));
+ //MySqlBeWoHelper.WriteSqlErrorsToFile();
+
+ MySqlBeWoHelper.DistinctErrors.DoForEach(number2Message => Console.WriteLine($"{number2Message.Key}: {number2Message.Value}"));
}
private static void GetTextAndSqlFiles()
@@ -273,95 +272,4 @@ namespace BeWoDatabaseUpdater
});
}
}
-
- public class FilePath2MySqlCommands(string filePath, List commands)
- {
- public string FilePath { get; set; } = filePath;
- public List Commands { get; set; } = commands ?? [];
- }
-
- public class MySqlHelper
- {
- public string ConnectionString { get; set; }
-
- private readonly MySqlConnection _Connection;
-
- public async Task> LoadBeWoDatabaseNames()
- {
- var connection = new MySqlConnection(ConnectionString);
-
- var result = new List();
-
- try
- {
- await connection.OpenAsync();
-
- var command = new MySqlCommand("SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES tables WHERE tables.TABLE_NAME = 'bewofile';") {Connection = connection};
-
- await using var dataReader = command.ExecuteReader();
-
- while(await dataReader.ReadAsync())
- {
- var schemaName = dataReader["TABLE_SCHEMA"]?.ToString();
-
- if(schemaName is not null)
- {
- result.AddIfNotIn(schemaName);
- }
- }
- }
- catch(Exception exception)
- {
- Console.WriteLine(exception);
- }
- finally
- {
- if(connection.State is ConnectionState.Open or ConnectionState.Executing)
- {
- await connection.CloseAsync();
- }
- }
-
- return result;
- }
-
- public MySqlHelper(string connectionString)
- {
- ConnectionString = connectionString;
-
- _Connection = new MySqlConnection(ConnectionString);
- }
-
- public static Dictionary DistinctErrors = [];
-
- public void OpenSession()
- {
- _Connection.Open();
- }
-
- public void CloseSession()
- {
- _Connection.Close();
- WriteSqlErrorsToFile();
- }
-
- public void WriteSqlErrorsToFile()
- {
- File.WriteAllLines(Program.FailedSqlCommandsFilePath, DistinctErrors.Values);
- }
-
- public async Task ExecuteUpdateOrCreate(string sql, string filePath)
- {
- try
- {
- await new MySqlCommand(sql) { Connection = _Connection }.ExecuteNonQueryAsync();
- }
- catch(MySqlException exception)
- {
- var errorMessage = $"{exception.Number} {new FileInfo(filePath).Name}: {exception.Message}";
-
- DistinctErrors.AddAndIgnoreDuplicates(exception.Number, errorMessage);
- }
- }
- }
}
diff --git a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Utils.cs b/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Utils.cs
deleted file mode 100644
index d6a1459dd..000000000
--- a/Tools/BeWoDatabaseUpdater/BeWoDatabaseUpdater/Utils.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-namespace BeWoDatabaseUpdater
-{
- public static class Utils
- {
- public static void ConsoleWriteException(Exception exception)
- {
- ConsoleWriteError(exception.ToString());
- }
-
- public static void ConsoleWriteError(string errorMessage)
- {
- Console.BackgroundColor = ConsoleColor.Black;
- Console.ForegroundColor = ConsoleColor.DarkRed;
- Console.WriteLine(errorMessage);
- Console.BackgroundColor = ConsoleColor.Black;
- Console.ForegroundColor = ConsoleColor.White;
- }
- }
-}