commit e130260ba1d82853c25275a864a687588177a61c Author: Younes Date: Tue Jul 15 14:21:59 2025 +0200 second commits diff --git a/.vs/ProjectEvaluation/wpfapp4.metadata.v9.bin b/.vs/ProjectEvaluation/wpfapp4.metadata.v9.bin new file mode 100644 index 0000000..30c6f31 Binary files /dev/null and b/.vs/ProjectEvaluation/wpfapp4.metadata.v9.bin differ diff --git a/.vs/ProjectEvaluation/wpfapp4.projects.v9.bin b/.vs/ProjectEvaluation/wpfapp4.projects.v9.bin new file mode 100644 index 0000000..447bbb7 Binary files /dev/null and b/.vs/ProjectEvaluation/wpfapp4.projects.v9.bin differ diff --git a/.vs/ProjectEvaluation/wpfapp4.strings.v9.bin b/.vs/ProjectEvaluation/wpfapp4.strings.v9.bin new file mode 100644 index 0000000..71223df Binary files /dev/null and b/.vs/ProjectEvaluation/wpfapp4.strings.v9.bin differ diff --git a/.vs/WpfApp4/DesignTimeBuild/.dtbcache.v2 b/.vs/WpfApp4/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..ebe6929 Binary files /dev/null and b/.vs/WpfApp4/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/WpfApp4/FileContentIndex/0639ec84-02ba-40c8-8e4a-85fb58784068.vsidx b/.vs/WpfApp4/FileContentIndex/0639ec84-02ba-40c8-8e4a-85fb58784068.vsidx new file mode 100644 index 0000000..9541672 Binary files /dev/null and b/.vs/WpfApp4/FileContentIndex/0639ec84-02ba-40c8-8e4a-85fb58784068.vsidx differ diff --git a/.vs/WpfApp4/FileContentIndex/84dd64ab-f1a0-41e3-8c91-d95715df3514.vsidx b/.vs/WpfApp4/FileContentIndex/84dd64ab-f1a0-41e3-8c91-d95715df3514.vsidx new file mode 100644 index 0000000..93024ff Binary files /dev/null and b/.vs/WpfApp4/FileContentIndex/84dd64ab-f1a0-41e3-8c91-d95715df3514.vsidx differ diff --git a/.vs/WpfApp4/FileContentIndex/b99a802e-23be-430a-8325-1cc92729346f.vsidx b/.vs/WpfApp4/FileContentIndex/b99a802e-23be-430a-8325-1cc92729346f.vsidx new file mode 100644 index 0000000..834417a Binary files /dev/null and b/.vs/WpfApp4/FileContentIndex/b99a802e-23be-430a-8325-1cc92729346f.vsidx differ diff --git a/.vs/WpfApp4/FileContentIndex/bc34cb05-0d5d-4d7c-9377-a4d1ad562327.vsidx b/.vs/WpfApp4/FileContentIndex/bc34cb05-0d5d-4d7c-9377-a4d1ad562327.vsidx new file mode 100644 index 0000000..1676d55 Binary files /dev/null and b/.vs/WpfApp4/FileContentIndex/bc34cb05-0d5d-4d7c-9377-a4d1ad562327.vsidx differ diff --git a/.vs/WpfApp4/FileContentIndex/e44836d5-acd9-4492-9a59-9683fdc2c18c.vsidx b/.vs/WpfApp4/FileContentIndex/e44836d5-acd9-4492-9a59-9683fdc2c18c.vsidx new file mode 100644 index 0000000..23443cc Binary files /dev/null and b/.vs/WpfApp4/FileContentIndex/e44836d5-acd9-4492-9a59-9683fdc2c18c.vsidx differ diff --git a/.vs/WpfApp4/v17/.futdcache.v2 b/.vs/WpfApp4/v17/.futdcache.v2 new file mode 100644 index 0000000..440f83e Binary files /dev/null and b/.vs/WpfApp4/v17/.futdcache.v2 differ diff --git a/.vs/WpfApp4/v17/.suo b/.vs/WpfApp4/v17/.suo new file mode 100644 index 0000000..330bdf9 Binary files /dev/null and b/.vs/WpfApp4/v17/.suo differ diff --git a/.vs/WpfApp4/v17/DocumentLayout.backup.json b/.vs/WpfApp4/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..a37f162 --- /dev/null +++ b/.vs/WpfApp4/v17/DocumentLayout.backup.json @@ -0,0 +1,171 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\bib\\source\\repos\\WpfApp4\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\databaseservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\databaseservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\pdfservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\pdfservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\fahrzeugverwaltung.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\fahrzeugverwaltung.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\fahrzeug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\fahrzeug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\app.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\app.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\wpfapp4.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\wpfapp4.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 247, + "SelectedChildIndex": 4, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "WpfApp4", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\WpfApp4.csproj", + "RelativeDocumentMoniker": "WpfApp4\\WpfApp4.csproj", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\WpfApp4.csproj", + "RelativeToolTip": "WpfApp4\\WpfApp4.csproj", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", + "WhenOpened": "2025-07-15T10:49:09.761Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "App.xaml.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml.cs", + "RelativeDocumentMoniker": "WpfApp4\\App.xaml.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml.cs", + "RelativeToolTip": "WpfApp4\\App.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAAeAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:08:49.466Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "App.xaml", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml", + "RelativeDocumentMoniker": "WpfApp4\\App.xaml", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml", + "RelativeToolTip": "WpfApp4\\App.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2025-07-14T12:08:18.503Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "PdfService.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\PdfService.cs", + "RelativeDocumentMoniker": "WpfApp4\\PdfService.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\PdfService.cs", + "RelativeToolTip": "WpfApp4\\PdfService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABgBAAABAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:05:46.954Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "DatabaseService.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\DatabaseService.cs", + "RelativeDocumentMoniker": "WpfApp4\\DatabaseService.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\DatabaseService.cs", + "RelativeToolTip": "WpfApp4\\DatabaseService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAACUAAAA2AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:04:21.362Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "MainWindow.xaml", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml", + "RelativeDocumentMoniker": "WpfApp4\\MainWindow.xaml", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml", + "RelativeToolTip": "WpfApp4\\MainWindow.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2025-07-08T06:16:53.827Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "Fahrzeug.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\Fahrzeug.cs", + "RelativeDocumentMoniker": "WpfApp4\\Fahrzeug.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\Fahrzeug.cs", + "RelativeToolTip": "WpfApp4\\Fahrzeug.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAMkAAAABAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-13T20:58:44.24Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "FahrzeugVerwaltung.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\FahrzeugVerwaltung.cs", + "RelativeDocumentMoniker": "WpfApp4\\FahrzeugVerwaltung.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\FahrzeugVerwaltung.cs", + "RelativeToolTip": "WpfApp4\\FahrzeugVerwaltung.cs", + "ViewState": "AgIAAJgAAAAAAAAAAAA1wIQAAAAVAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-08T06:51:06.505Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "WpfApp4\\MainWindow.xaml.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml.cs", + "RelativeToolTip": "WpfApp4\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAqwBIAAAAPAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-08T06:16:49.191Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/WpfApp4/v17/DocumentLayout.json b/.vs/WpfApp4/v17/DocumentLayout.json new file mode 100644 index 0000000..24e077b --- /dev/null +++ b/.vs/WpfApp4/v17/DocumentLayout.json @@ -0,0 +1,171 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\bib\\source\\repos\\WpfApp4\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\databaseservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\databaseservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\pdfservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\pdfservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\fahrzeugverwaltung.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\fahrzeugverwaltung.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\fahrzeug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\fahrzeug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\app.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\app.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|c:\\users\\bib\\source\\repos\\wpfapp4\\wpfapp4\\wpfapp4.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", + "RelativeMoniker": "D:0:0:{F6C5C16A-1943-4B83-A33B-9B0680A662FE}|WpfApp4\\WpfApp4.csproj|solutionrelative:wpfapp4\\wpfapp4.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 247, + "SelectedChildIndex": 4, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "WpfApp4", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\WpfApp4.csproj", + "RelativeDocumentMoniker": "WpfApp4\\WpfApp4.csproj", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\WpfApp4.csproj", + "RelativeToolTip": "WpfApp4\\WpfApp4.csproj", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", + "WhenOpened": "2025-07-15T10:49:09.761Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "App.xaml.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml.cs", + "RelativeDocumentMoniker": "WpfApp4\\App.xaml.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml.cs", + "RelativeToolTip": "WpfApp4\\App.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAAeAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:08:49.466Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "App.xaml", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml", + "RelativeDocumentMoniker": "WpfApp4\\App.xaml", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\App.xaml", + "RelativeToolTip": "WpfApp4\\App.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2025-07-14T12:08:18.503Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "PdfService.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\PdfService.cs", + "RelativeDocumentMoniker": "WpfApp4\\PdfService.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\PdfService.cs", + "RelativeToolTip": "WpfApp4\\PdfService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABgBAAABAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:05:46.954Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "DatabaseService.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\DatabaseService.cs", + "RelativeDocumentMoniker": "WpfApp4\\DatabaseService.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\DatabaseService.cs", + "RelativeToolTip": "WpfApp4\\DatabaseService.cs", + "ViewState": "AgIAABwAAAAAAAAAAAAzwCUAAAA2AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-14T12:04:21.362Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "MainWindow.xaml", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml", + "RelativeDocumentMoniker": "WpfApp4\\MainWindow.xaml", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml", + "RelativeToolTip": "WpfApp4\\MainWindow.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2025-07-08T06:16:53.827Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "Fahrzeug.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\Fahrzeug.cs", + "RelativeDocumentMoniker": "WpfApp4\\Fahrzeug.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\Fahrzeug.cs", + "RelativeToolTip": "WpfApp4\\Fahrzeug.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAMkAAAABAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-13T20:58:44.24Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "FahrzeugVerwaltung.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\FahrzeugVerwaltung.cs", + "RelativeDocumentMoniker": "WpfApp4\\FahrzeugVerwaltung.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\FahrzeugVerwaltung.cs", + "RelativeToolTip": "WpfApp4\\FahrzeugVerwaltung.cs", + "ViewState": "AgIAAJgAAAAAAAAAAAA1wIQAAAAVAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-08T06:51:06.505Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "WpfApp4\\MainWindow.xaml.cs", + "ToolTip": "C:\\Users\\bib\\source\\repos\\WpfApp4\\WpfApp4\\MainWindow.xaml.cs", + "RelativeToolTip": "WpfApp4\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAqwBIAAAAPAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-08T06:16:49.191Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/WpfApp4.sln b/WpfApp4.sln new file mode 100644 index 0000000..78e96c7 --- /dev/null +++ b/WpfApp4.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35728.132 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp4", "WpfApp4\WpfApp4.csproj", "{F6C5C16A-1943-4B83-A33B-9B0680A662FE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6C5C16A-1943-4B83-A33B-9B0680A662FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6C5C16A-1943-4B83-A33B-9B0680A662FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6C5C16A-1943-4B83-A33B-9B0680A662FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6C5C16A-1943-4B83-A33B-9B0680A662FE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WpfApp4/App.xaml b/WpfApp4/App.xaml new file mode 100644 index 0000000..eb57771 --- /dev/null +++ b/WpfApp4/App.xaml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/WpfApp4/App.xaml.cs b/WpfApp4/App.xaml.cs new file mode 100644 index 0000000..574fb08 --- /dev/null +++ b/WpfApp4/App.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Windows; + +namespace FahrzeugVerwaltung +{ + + public partial class App : Application + { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + DispatcherUnhandledException += App_DispatcherUnhandledException; + } + + private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + { + MessageBox.Show($"Ein unerwarteter Fehler ist aufgetreten:\n{e.Exception.Message}", + "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); + e.Handled = true; + } + + private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + MessageBox.Show($"Ein kritischer Fehler ist aufgetreten:\n{((Exception)e.ExceptionObject).Message}", + "Kritischer Fehler", MessageBoxButton.OK, MessageBoxImage.Error); + } + } +} \ No newline at end of file diff --git a/WpfApp4/DatabaseService.cs b/WpfApp4/DatabaseService.cs new file mode 100644 index 0000000..3cfa15e --- /dev/null +++ b/WpfApp4/DatabaseService.cs @@ -0,0 +1,305 @@ +using System; +using System.Collections.Generic; +using System.Data.SQLite; +using System.IO; +using System.Linq; + +namespace FahrzeugVerwaltung +{ + public class DatabaseService + { + private readonly string _connectionString; + private readonly string _dbPath; + + public DatabaseService() + { + _dbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fahrzeuge.db"); + _connectionString = $"Data Source={_dbPath};Version=3;"; + InitializeDatabase(); + } + + /// + /// Initialisiert die Datenbank und erstellt die Tabelle falls sie nicht existiert + /// + private void InitializeDatabase() + { + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string createTableQuery = @" + CREATE TABLE IF NOT EXISTS Fahrzeuge ( + Id INTEGER PRIMARY KEY AUTOINCREMENT, + Marke TEXT NOT NULL, + Modell TEXT NOT NULL, + Baujahr INTEGER NOT NULL, + Leistung INTEGER NOT NULL, + Kilometerstand INTEGER NOT NULL, + Kaufpreis DECIMAL(10,2) NOT NULL, + Farbe TEXT NOT NULL, + ErstelltAm DATETIME DEFAULT CURRENT_TIMESTAMP + )"; + + using (var command = new SQLiteCommand(createTableQuery, connection)) + { + command.ExecuteNonQuery(); + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Initialisieren der Datenbank: {ex.Message}"); + } + } + + /// + /// Speichert ein neues Fahrzeug in der Datenbank + /// + /// Das zu speichernde Fahrzeug + /// Die ID des gespeicherten Fahrzeugs + public int SpeichereFahrzeug(Fahrzeug fahrzeug) + { + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string insertQuery = @" + INSERT INTO Fahrzeuge (Marke, Modell, Baujahr, Leistung, Kilometerstand, Kaufpreis, Farbe) + VALUES (@Marke, @Modell, @Baujahr, @Leistung, @Kilometerstand, @Kaufpreis, @Farbe); + SELECT last_insert_rowid();"; + + using (var command = new SQLiteCommand(insertQuery, connection)) + { + command.Parameters.AddWithValue("@Marke", fahrzeug.Marke); + command.Parameters.AddWithValue("@Modell", fahrzeug.Modell); + command.Parameters.AddWithValue("@Baujahr", fahrzeug.Baujahr); + command.Parameters.AddWithValue("@Leistung", fahrzeug.Leistung); + command.Parameters.AddWithValue("@Kilometerstand", fahrzeug.Kilometerstand); + command.Parameters.AddWithValue("@Kaufpreis", fahrzeug.Kaufpreis); + command.Parameters.AddWithValue("@Farbe", fahrzeug.Farbe); + + var result = command.ExecuteScalar(); + return Convert.ToInt32(result); + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Speichern des Fahrzeugs: {ex.Message}"); + } + } + + /// + /// Lädt alle Fahrzeuge aus der Datenbank + /// + /// Liste aller Fahrzeuge + public List LadeAlleFahrzeuge() + { + var fahrzeuge = new List(); + + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string selectQuery = "SELECT * FROM Fahrzeuge ORDER BY Marke, Modell"; + + using (var command = new SQLiteCommand(selectQuery, connection)) + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + var fahrzeug = new Fahrzeug + { + Id = Convert.ToInt32(reader["Id"]), + Marke = reader["Marke"].ToString(), + Modell = reader["Modell"].ToString(), + Baujahr = Convert.ToInt32(reader["Baujahr"]), + Leistung = Convert.ToInt32(reader["Leistung"]), + Kilometerstand = Convert.ToInt32(reader["Kilometerstand"]), + Kaufpreis = Convert.ToDecimal(reader["Kaufpreis"]), + Farbe = reader["Farbe"].ToString() + }; + + fahrzeuge.Add(fahrzeug); + } + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Laden der Fahrzeuge: {ex.Message}"); + } + + return fahrzeuge; + } + + /// + /// Sucht Fahrzeuge basierend auf einem Suchbegriff + /// + /// Der Suchbegriff + /// Liste der gefundenen Fahrzeuge + public List SucheFahrzeuge(string suchbegriff) + { + var fahrzeuge = new List(); + + if (string.IsNullOrWhiteSpace(suchbegriff)) + return LadeAlleFahrzeuge(); + + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string searchQuery = @" + SELECT * FROM Fahrzeuge + WHERE Marke LIKE @Suchbegriff + OR Modell LIKE @Suchbegriff + OR Farbe LIKE @Suchbegriff + OR CAST(Baujahr AS TEXT) LIKE @Suchbegriff + ORDER BY Marke, Modell"; + + using (var command = new SQLiteCommand(searchQuery, connection)) + { + command.Parameters.AddWithValue("@Suchbegriff", $"%{suchbegriff}%"); + + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + var fahrzeug = new Fahrzeug + { + Id = Convert.ToInt32(reader["Id"]), + Marke = reader["Marke"].ToString(), + Modell = reader["Modell"].ToString(), + Baujahr = Convert.ToInt32(reader["Baujahr"]), + Leistung = Convert.ToInt32(reader["Leistung"]), + Kilometerstand = Convert.ToInt32(reader["Kilometerstand"]), + Kaufpreis = Convert.ToDecimal(reader["Kaufpreis"]), + Farbe = reader["Farbe"].ToString() + }; + + fahrzeuge.Add(fahrzeug); + } + } + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Suchen der Fahrzeuge: {ex.Message}"); + } + + return fahrzeuge; + } + + /// + /// Aktualisiert ein bestehendes Fahrzeug in der Datenbank + /// + /// Das zu aktualisierende Fahrzeug + /// True wenn erfolgreich, sonst False + public bool AktualisiereFahrzeug(Fahrzeug fahrzeug) + { + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string updateQuery = @" + UPDATE Fahrzeuge + SET Marke = @Marke, + Modell = @Modell, + Baujahr = @Baujahr, + Leistung = @Leistung, + Kilometerstand = @Kilometerstand, + Kaufpreis = @Kaufpreis, + Farbe = @Farbe + WHERE Id = @Id"; + + using (var command = new SQLiteCommand(updateQuery, connection)) + { + command.Parameters.AddWithValue("@Id", fahrzeug.Id); + command.Parameters.AddWithValue("@Marke", fahrzeug.Marke); + command.Parameters.AddWithValue("@Modell", fahrzeug.Modell); + command.Parameters.AddWithValue("@Baujahr", fahrzeug.Baujahr); + command.Parameters.AddWithValue("@Leistung", fahrzeug.Leistung); + command.Parameters.AddWithValue("@Kilometerstand", fahrzeug.Kilometerstand); + command.Parameters.AddWithValue("@Kaufpreis", fahrzeug.Kaufpreis); + command.Parameters.AddWithValue("@Farbe", fahrzeug.Farbe); + + int rowsAffected = command.ExecuteNonQuery(); + return rowsAffected > 0; + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Aktualisieren des Fahrzeugs: {ex.Message}"); + } + } + + /// + /// Löscht ein Fahrzeug aus der Datenbank + /// + /// Die ID des zu löschenden Fahrzeugs + /// True wenn erfolgreich, sonst False + public bool LoescheFahrzeug(int id) + { + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string deleteQuery = "DELETE FROM Fahrzeuge WHERE Id = @Id"; + + using (var command = new SQLiteCommand(deleteQuery, connection)) + { + command.Parameters.AddWithValue("@Id", id); + + int rowsAffected = command.ExecuteNonQuery(); + return rowsAffected > 0; + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Löschen des Fahrzeugs: {ex.Message}"); + } + } + + /// + /// Gibt die Anzahl der Fahrzeuge in der Datenbank zurück + /// + /// Anzahl der Fahrzeuge + public int GetAnzahlFahrzeuge() + { + try + { + using (var connection = new SQLiteConnection(_connectionString)) + { + connection.Open(); + + string countQuery = "SELECT COUNT(*) FROM Fahrzeuge"; + + using (var command = new SQLiteCommand(countQuery, connection)) + { + var result = command.ExecuteScalar(); + return Convert.ToInt32(result); + } + } + } + catch (Exception ex) + { + throw new Exception($"Fehler beim Ermitteln der Fahrzeuganzahl: {ex.Message}"); + } + } + } +} \ No newline at end of file diff --git a/WpfApp4/Fahrzeug.cs b/WpfApp4/Fahrzeug.cs new file mode 100644 index 0000000..cadf7e0 --- /dev/null +++ b/WpfApp4/Fahrzeug.cs @@ -0,0 +1,202 @@ +using System; +using System.ComponentModel; + +namespace FahrzeugVerwaltung +{ + public class Fahrzeug : INotifyPropertyChanged + { + private int _id; + private string _marke; + private string _modell; + private int _baujahr; + private int _leistung; + private int _kilometerstand; + private decimal _kaufpreis; + private string _farbe; + + public int Id + { + get => _id; + set + { + _id = value; + OnPropertyChanged(nameof(Id)); + } + } + + public string Marke + { + get => _marke; + set + { + _marke = value; + OnPropertyChanged(nameof(Marke)); + } + } + + public string Modell + { + get => _modell; + set + { + _modell = value; + OnPropertyChanged(nameof(Modell)); + } + } + + public int Baujahr + { + get => _baujahr; + set + { + _baujahr = value; + OnPropertyChanged(nameof(Baujahr)); + OnPropertyChanged(nameof(AktuellerWert)); + OnPropertyChanged(nameof(AktuellerWertFormatiert)); + } + } + + public int Leistung + { + get => _leistung; + set + { + _leistung = value; + OnPropertyChanged(nameof(Leistung)); + } + } + + public int Kilometerstand + { + get => _kilometerstand; + set + { + _kilometerstand = value; + OnPropertyChanged(nameof(Kilometerstand)); + OnPropertyChanged(nameof(KilometerstandFormatiert)); + OnPropertyChanged(nameof(AktuellerWert)); + OnPropertyChanged(nameof(AktuellerWertFormatiert)); + } + } + + public decimal Kaufpreis + { + get => _kaufpreis; + set + { + _kaufpreis = value; + OnPropertyChanged(nameof(Kaufpreis)); + OnPropertyChanged(nameof(KaufpreisFormatiert)); + OnPropertyChanged(nameof(AktuellerWert)); + OnPropertyChanged(nameof(AktuellerWertFormatiert)); + } + } + + public string Farbe + { + get => _farbe; + set + { + _farbe = value; + OnPropertyChanged(nameof(Farbe)); + } + } + + // Formatierte Eigenschaften für die Anzeige + public string KilometerstandFormatiert => $"{Kilometerstand:N0} km"; + public string KaufpreisFormatiert => $"{Kaufpreis:C}"; + public string AktuellerWertFormatiert => $"{AktuellerWert:C}"; + + // Berechnet den aktuellen Wert basierend auf Alter und Kilometerstand + public decimal AktuellerWert + { + get + { + return BerechneAktuellenWert(); + } + } + + /// + /// Berechnet den aktuellen Wert des Fahrzeugs + /// Formel: Wertverlust basierend auf Alter und Kilometerstand + /// + /// Aktueller Wert des Fahrzeugs + public decimal BerechneAktuellenWert() + { + if (Kaufpreis <= 0 || Baujahr <= 0) + return 0; + + int aktuellesJahr = DateTime.Now.Year; + int alter = aktuellesJahr - Baujahr; + + // Wertverlust pro Jahr: 15% in den ersten 3 Jahren, dann 10% pro Jahr + decimal wertverlustProzent = 0; + + for (int i = 0; i < alter; i++) + { + if (i < 3) + wertverlustProzent += 0.15m; // 15% pro Jahr in den ersten 3 Jahren + else + wertverlustProzent += 0.10m; // 10% pro Jahr danach + } + + // Zusätzlicher Wertverlust basierend auf Kilometerstand + // Pro 10.000 km: 2% Wertverlust + decimal kmWertverlust = (Kilometerstand / 10000m) * 0.02m; + + wertverlustProzent += kmWertverlust; + + // Maximal 90% Wertverlust + if (wertverlustProzent > 0.90m) + wertverlustProzent = 0.90m; + + decimal aktuellerWert = Kaufpreis * (1 - wertverlustProzent); + + // Mindestwert: 5% des Kaufpreises + decimal mindestwert = Kaufpreis * 0.05m; + if (aktuellerWert < mindestwert) + aktuellerWert = mindestwert; + + return Math.Round(aktuellerWert, 2); + } + + /// + /// Gibt eine detaillierte Beschreibung des Fahrzeugs zurück + /// + /// Formatierte Fahrzeugbeschreibung + public string GetDetailedDescription() + { + return $"{Marke} {Modell} ({Baujahr}) - {Leistung} PS - {KilometerstandFormatiert} - {Farbe}"; + } + + /// + /// Berechnet das Alter des Fahrzeugs in Jahren + /// + /// Alter in Jahren + public int GetAlter() + { + return DateTime.Now.Year - Baujahr; + } + + /// + /// Prüft, ob das Fahrzeug als Oldtimer gilt (älter als 30 Jahre) + /// + /// True wenn Oldtimer, sonst False + public bool IsOldtimer() + { + return GetAlter() >= 30; + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public override string ToString() + { + return $"{Marke} {Modell} ({Baujahr})"; + } + } +} \ No newline at end of file diff --git a/WpfApp4/FahrzeugVerwaltung.cs b/WpfApp4/FahrzeugVerwaltung.cs new file mode 100644 index 0000000..8d530dc --- /dev/null +++ b/WpfApp4/FahrzeugVerwaltung.cs @@ -0,0 +1,193 @@ +using System; +using System.Globalization; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; + +namespace FahrzeugVerwaltung +{ + public static class Utilities + { + /// + /// Validiert eine Eingabe für numerische Werte + /// + public static bool IsValidNumber(string input, out double result, double min = double.MinValue, double max = double.MaxValue) + { + result = 0; + + if (string.IsNullOrWhiteSpace(input)) + return false; + + if (double.TryParse(input, NumberStyles.Any, CultureInfo.CurrentCulture, out result)) + { + return result >= min && result <= max; + } + + return false; + } + + /// + /// Validiert eine Eingabe für Ganzzahlen + /// + public static bool IsValidInteger(string input, out int result, int min = int.MinValue, int max = int.MaxValue) + { + result = 0; + + if (string.IsNullOrWhiteSpace(input)) + return false; + + if (int.TryParse(input, out result)) + { + return result >= min && result <= max; + } + + return false; + } + + /// + /// Validiert eine Eingabe für Dezimalzahlen + /// + public static bool IsValidDecimal(string input, out decimal result, decimal min = decimal.MinValue, decimal max = decimal.MaxValue) + { + result = 0; + + if (string.IsNullOrWhiteSpace(input)) + return false; + + if (decimal.TryParse(input, NumberStyles.Any, CultureInfo.CurrentCulture, out result)) + { + return result >= min && result <= max; + } + + return false; + } + + /// + /// Bereinigt Eingabetext von überflüssigen Zeichen + /// + public static string CleanInput(string input) + { + if (string.IsNullOrWhiteSpace(input)) + return string.Empty; + + // Mehrfache Leerzeichen durch einzelne ersetzen + return Regex.Replace(input.Trim(), @"\s+", " "); + } + + /// + /// Zeigt eine Fehlermeldung an + /// + public static void ShowError(string message, string title = "Fehler") + { + MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Error); + } + + /// + /// Zeigt eine Warnmeldung an + /// + public static void ShowWarning(string message, string title = "Warnung") + { + MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Warning); + } + + /// + /// Zeigt eine Informationsmeldung an + /// + public static void ShowInfo(string message, string title = "Information") + { + MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Information); + } + + /// + /// Zeigt eine Bestätigungsdialog an + /// + public static bool ShowConfirmation(string message, string title = "Bestätigung") + { + return MessageBox.Show(message, title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; + } + + /// + /// Formatiert einen Preis für die Anzeige + /// + public static string FormatPrice(decimal price) + { + return price.ToString("C", CultureInfo.CurrentCulture); + } + + /// + /// Formatiert einen Kilometerstand für die Anzeige + /// + public static string FormatKilometers(int kilometers) + { + return $"{kilometers:N0} km"; + } + + /// + /// Berechnet die Differenz zwischen zwei Jahren + /// + public static int CalculateYearsDifference(int fromYear, int toYear) + { + return Math.Abs(toYear - fromYear); + } + + /// + /// Prüft, ob ein Baujahr realistisch ist + /// + public static bool IsValidBuildYear(int year) + { + int currentYear = DateTime.Now.Year; + return year >= 1900 && year <= currentYear + 1; + } + + /// + /// Generiert einen Dateinamen basierend auf Fahrzeugdaten + /// + public static string GenerateFileName(Fahrzeug fahrzeug, string extension = "html") + { + string marke = CleanInput(fahrzeug.Marke).Replace(" ", "_"); + string modell = CleanInput(fahrzeug.Modell).Replace(" ", "_"); + string datum = DateTime.Now.ToString("yyyyMMdd_HHmmss"); + + return $"Fahrzeug_{marke}_{modell}_{datum}.{extension}"; + } + + /// + /// Prüft, ob eine Textbox nur numerische Eingaben enthält + /// + public static void SetNumericOnly(TextBox textBox) + { + textBox.PreviewTextInput += (sender, e) => + { + e.Handled = !IsNumeric(e.Text); + }; + } + + /// + /// Prüft, ob ein String nur Zahlen enthält + /// + private static bool IsNumeric(string text) + { + return Regex.IsMatch(text, @"^[0-9]+$"); + } + + /// + /// Konvertiert einen String sicher zu einem Integer + /// + public static int SafeParseInt(string value, int defaultValue = 0) + { + if (int.TryParse(value, out int result)) + return result; + return defaultValue; + } + + /// + /// Konvertiert einen String sicher zu einem Decimal + /// + public static decimal SafeParseDecimal(string value, decimal defaultValue = 0) + { + if (decimal.TryParse(value, out decimal result)) + return result; + return defaultValue; + } + } +} \ No newline at end of file diff --git a/WpfApp4/MainWindow.xaml b/WpfApp4/MainWindow.xaml new file mode 100644 index 0000000..3f27810 --- /dev/null +++ b/WpfApp4/MainWindow.xaml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +