From 67709a737fe9569040b0f3475767bca9bdc9707e Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 12:01:36 +0200 Subject: [PATCH 001/103] Unit Test Solution + Wohneinheit dc,entity,db + Wohneinheitbelegung ... --- .gitignore | 4 + BeWo/View/Detail/WohnheimView.xaml | 38 +++ BeWoTests.sln | 196 +++++++++++++ Data/Data.csproj | 8 + Data/Entities/Wohneinheit.cs | 257 ++++++++++++++++++ Data/Entities/WohneinheitBelegung.cs | 105 +++++++ Data/Mappings/Wohneinheit.hbm.xml | 34 +++ Data/Mappings/WohneinheitBelegung.hbm.xml | 22 ++ Host/Host.csproj.user | 2 +- Model/Changes_2024_07_15 Wohneinheit.txt | 46 ++++ .../AccountingServiceImp.cs | 12 +- Shared/BeWoEntityEnums.cs | 2 + Shared/DataContracts/DataContract.cs | 36 +++ Shared/DataContracts/WohneinheitBelegungDC.cs | 18 ++ Shared/DataContracts/WohneinheitDC.cs | 27 ++ Shared/Shared.csproj | 3 + .../Properties/AssemblyInfo.cs | 20 ++ .../WohneinheitUnitTest.csproj | 78 ++++++ WohneinheitUnitTest/WohneinheitUnitTest1.cs | 27 ++ WohneinheitUnitTest/packages.config | 5 + 20 files changed, 933 insertions(+), 7 deletions(-) create mode 100644 BeWoTests.sln create mode 100644 Data/Entities/Wohneinheit.cs create mode 100644 Data/Entities/WohneinheitBelegung.cs create mode 100644 Data/Mappings/Wohneinheit.hbm.xml create mode 100644 Data/Mappings/WohneinheitBelegung.hbm.xml create mode 100644 Model/Changes_2024_07_15 Wohneinheit.txt create mode 100644 Shared/DataContracts/DataContract.cs create mode 100644 Shared/DataContracts/WohneinheitBelegungDC.cs create mode 100644 Shared/DataContracts/WohneinheitDC.cs create mode 100644 WohneinheitUnitTest/Properties/AssemblyInfo.cs create mode 100644 WohneinheitUnitTest/WohneinheitUnitTest.csproj create mode 100644 WohneinheitUnitTest/WohneinheitUnitTest1.cs create mode 100644 WohneinheitUnitTest/packages.config diff --git a/.gitignore b/.gitignore index c66999f80..9a7b012d0 100644 --- a/.gitignore +++ b/.gitignore @@ -624,6 +624,10 @@ obj /Dakota/obj /DakotaSender/bin /DakotaSender/obj +/DakotaUnitTest/bin +/DakotaUnitTest/obj +/WohneinheitUnitTest/bin +/WohneinheitUnitTest/obj /BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Debug /BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Release /ReportImp/TestLWV diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 95df978ff..0819bb058 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -308,6 +308,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWoTests.sln b/BeWoTests.sln new file mode 100644 index 000000000..ac36fd2ed --- /dev/null +++ b/BeWoTests.sln @@ -0,0 +1,196 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33927.289 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{E7543C39-A44C-40C9-82C9-E7FAA2D9A852}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{FEB0336B-F053-40B6-92DD-7DE56AB9408A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeWo", "BeWo\BeWo.csproj", "{3FEBB560-9275-413A-9767-BB68C44EEBC3}" + ProjectSection(ProjectDependencies) = postProject + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3} = {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3} + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF} = {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service.csproj", "{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Controls\Controls.csproj", "{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Report", "Report\Report.csproj", "{40D8B312-EA64-49E3-A31A-5E57ED4D5654}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Host", "Host\Host.csproj", "{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportingService", "ReportService\ReportingService.csproj", "{663EFCB5-9E3E-4C76-97EE-3188E072634C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatController", "..\Chat\ChatController\ChatController.csproj", "{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dakota", "Dakota\Dakota.csproj", "{47331732-DD96-4075-869F-83AA9F3F9937}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B6039E62-D43E-477A-BE82-EADB1057A3A2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{CCD6B644-49E7-4A11-BD8F-607088A4AC83}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wohneinheit", "Wohneinheit", "{2F7893AD-34FC-40A2-838A-3D2D8596E9AC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WohneinheitUnitTest", "WohneinheitUnitTest\WohneinheitUnitTest.csproj", "{7630915F-DFE4-45A4-A7B1-B6D19B0126C1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|.NET = Debug|.NET + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Release|.NET = Release|.NET + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|.NET.ActiveCfg = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|.NET.Build.0 = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|.NET.ActiveCfg = Release|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.Build.0 = Release|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|.NET.ActiveCfg = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|.NET.Build.0 = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|.NET.ActiveCfg = Release|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.Build.0 = Release|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|.NET.ActiveCfg = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|.NET.Build.0 = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|.NET.ActiveCfg = Release|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.Build.0 = Release|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|.NET.Build.0 = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|.NET.ActiveCfg = Release|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.Build.0 = Release|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|.NET.ActiveCfg = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|.NET.Build.0 = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|.NET.ActiveCfg = Release|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.Build.0 = Release|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|.NET.ActiveCfg = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|.NET.Build.0 = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|.NET.ActiveCfg = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.Build.0 = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|.NET.ActiveCfg = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|.NET.Build.0 = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|.NET.ActiveCfg = Release|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.Build.0 = Release|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|.NET.ActiveCfg = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|.NET.Build.0 = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|.NET.ActiveCfg = Release|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.Build.0 = Release|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.ActiveCfg = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.Build.0 = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.ActiveCfg = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.Build.0 = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.Build.0 = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|.NET.ActiveCfg = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|.NET.Build.0 = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|.NET.ActiveCfg = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|.NET.Build.0 = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|Any CPU.Build.0 = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {47331732-DD96-4075-869F-83AA9F3F9937}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|.NET.ActiveCfg = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|.NET.Build.0 = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|.NET.ActiveCfg = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|.NET.Build.0 = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|Any CPU.Build.0 = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {3FEBB560-9275-413A-9767-BB68C44EEBC3} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852} + {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {D5E53B0F-BF5A-41E8-93E2-0F32845FC729} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852} + {40D8B312-EA64-49E3-A31A-5E57ED4D5654} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {663EFCB5-9E3E-4C76-97EE-3188E072634C} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {8A83C4DC-A0B1-4A51-AE1D-366D7A05B298} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852} + {47331732-DD96-4075-869F-83AA9F3F9937} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A} + {2F7893AD-34FC-40A2-838A-3D2D8596E9AC} = {CCD6B644-49E7-4A11-BD8F-607088A4AC83} + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1} = {2F7893AD-34FC-40A2-838A-3D2D8596E9AC} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5352BE53-F2FD-442F-85A8-4157599AA153} + EndGlobalSection +EndGlobal diff --git a/Data/Data.csproj b/Data/Data.csproj index b0ffe0de7..7c17e6e59 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -301,6 +301,8 @@ + + @@ -696,6 +698,12 @@ PreserveNewest + + Designer + + + Designer + diff --git a/Data/Entities/Wohneinheit.cs b/Data/Entities/Wohneinheit.cs new file mode 100644 index 000000000..956ddcfa5 --- /dev/null +++ b/Data/Entities/Wohneinheit.cs @@ -0,0 +1,257 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.Data.Entities +{ + public class Wohneinheit : BeWoEntityBase + { + public static string PropertyName_Wohnheim = nameof(Wohnheim); + public static string PropertyName_Wohnname = nameof(Wohnname); + public static string PropertyName_Zimmername = nameof(Zimmername); + public static string PropertyName_Miete = nameof(Miete); + public static string PropertyName_Heizung = nameof(Heizung); + public static string PropertyName_Strom = nameof(Strom); + public static string PropertyName_Betriebskosten = nameof(Betriebskosten); + public static string PropertyName_SonstigeKosten = nameof(SonstigeKosten); + public static string PropertyName_QM = nameof(QM); + public static string PropertyName_Baujahr = nameof(Baujahr); + public static string PropertyName_Mobilierung = nameof(Mobilierung); + public static string PropertyName_Zusatznotiz = nameof(Zusatznotiz); + public static string PropertyName_Stock = nameof(Stock); + public static string PropertyName_Belegungen = nameof(Belegungen); + + private Wohnheim _Wohnheim; + private string _Wohnname; + private string _Zimmername; + private decimal _Miete; + private decimal _Heizung; + private decimal _Strom; + private decimal _Betriebskosten; + private decimal _SonstigeKosten; + private decimal _QM; + private int _Baujahr; + private string _Mobilierung; + private string _Zusatznotiz; + private string _Stock; + private IList _Belegungen; + + public Wohneinheit() + { + _Tid = BS.Shared.TableID.Wohneinheit; + } + + public virtual Wohnheim Wohnheim + { + get + { + return this._Wohnheim; + } + + set + { + if (this.AreDifferent(this._Wohnheim, value)) + { + this._Wohnheim = value; + } + } + } + public virtual string Wohnname + { + get + { + return this._Wohnname; + } + + set + { + if (this.AreDifferent(this._Wohnname, value)) + { + this._Wohnname = value; + } + } + } + public virtual string Zimmername + { + get + { + return this._Zimmername; + } + + set + { + if (this.AreDifferent(this._Zimmername, value)) + { + this._Zimmername = value; + } + } + } + public virtual decimal Miete + { + get + { + return this._Miete; + } + + set + { + if (this.AreDifferent(this._Miete, value)) + { + this._Miete = value; + } + } + } + public virtual decimal Heizung + { + get + { + return this._Heizung; + } + + set + { + if (this.AreDifferent(this._Heizung, value)) + { + this._Heizung = value; + } + } + } + public virtual decimal Strom + { + get + { + return this._Strom; + } + + set + { + if (this.AreDifferent(this._Strom, value)) + { + this._Strom = value; + } + } + } + public virtual decimal Betriebskosten + { + get + { + return this._Betriebskosten; + } + + set + { + if (this.AreDifferent(this._Betriebskosten, value)) + { + this._Betriebskosten = value; + } + } + } + public virtual decimal SonstigeKosten + { + get + { + return this._SonstigeKosten; + } + + set + { + if (this.AreDifferent(this._SonstigeKosten, value)) + { + this._SonstigeKosten = value; + } + } + } + public virtual decimal QM + { + get + { + return this._QM; + } + + set + { + if (this.AreDifferent(this._QM, value)) + { + this._QM = value; + } + } + } + public virtual int Baujahr + { + get + { + return this._Baujahr; + } + + set + { + if (this.AreDifferent(this._Baujahr, value)) + { + this._Baujahr = value; + } + } + } + public virtual string Mobilierung + { + get + { + return this._Mobilierung; + } + + set + { + if (this.AreDifferent(this._Mobilierung, value)) + { + this._Mobilierung = value; + } + } + } + public virtual string Zusatznotiz + { + get + { + return this._Zusatznotiz; + } + + set + { + if (this.AreDifferent(this._Zusatznotiz, value)) + { + this._Zusatznotiz = value; + } + } + } + public virtual string Stock + { + get + { + return this._Stock; + } + + set + { + if (this.AreDifferent(this._Stock, value)) + { + this._Stock = value; + } + } + } + public virtual IList Belegungen + { + get + { + return this._Belegungen; + } + + set + { + if (this.AreDifferent(this._Belegungen, value)) + { + this._Belegungen = value; + } + } + } + } +} diff --git a/Data/Entities/WohneinheitBelegung.cs b/Data/Entities/WohneinheitBelegung.cs new file mode 100644 index 000000000..00fbc29bd --- /dev/null +++ b/Data/Entities/WohneinheitBelegung.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.Data.Entities +{ + public class WohneinheitBelegung : BeWoEntityBase + { + public static string PropertyName_Customer = nameof(Customer); + public static string PropertyName_Wohneinheit = nameof(Wohneinheit); + public static string PropertyName_StartDate = nameof(StartDate); + public static string PropertyName_EndDate = nameof(EndDate); + public static string PropertyName_Kommentar = nameof(Kommentar); + + private Customer _Customer; + private Wohneinheit _Wohneinheit; + private DateTime _StartDate; + private DateTime? _EndDate; + private string _Kommentar; + + public WohneinheitBelegung() + { + _Tid = BS.Shared.TableID.WohneinheitBelegung; + } + + public virtual Customer Customer + { + get + { + return this._Customer; + } + + set + { + if (this.AreDifferent(this._Customer, value)) + { + this._Customer = value; + } + } + } + public virtual Wohneinheit Wohneinheit + { + get + { + return this._Wohneinheit; + } + + set + { + if (this.AreDifferent(this._Wohneinheit, value)) + { + this._Wohneinheit = value; + } + } + } + public virtual DateTime StartDate + { + get + { + return this._StartDate; + } + + set + { + if (this.AreDifferent(this._StartDate, value)) + { + this._StartDate = value; + } + } + } + public virtual DateTime? EndDate + { + get + { + return this._EndDate; + } + + set + { + if (this.AreDifferent(this._EndDate, value)) + { + this._EndDate = value; + } + } + } + public virtual string Kommentar + { + get + { + return this._Kommentar; + } + + set + { + if (this.AreDifferent(this._Kommentar, value)) + { + this._Kommentar = value; + } + } + } + + } +} diff --git a/Data/Mappings/Wohneinheit.hbm.xml b/Data/Mappings/Wohneinheit.hbm.xml new file mode 100644 index 000000000..6a98c80fc --- /dev/null +++ b/Data/Mappings/Wohneinheit.hbm.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Data/Mappings/WohneinheitBelegung.hbm.xml b/Data/Mappings/WohneinheitBelegung.hbm.xml new file mode 100644 index 000000000..c719b2a73 --- /dev/null +++ b/Data/Mappings/WohneinheitBelegung.hbm.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index 769cd8b25..a0002e9f5 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -3,7 +3,7 @@ BeWo2.0 true - Release|Any CPU + Debug|Any CPU false diff --git a/Model/Changes_2024_07_15 Wohneinheit.txt b/Model/Changes_2024_07_15 Wohneinheit.txt new file mode 100644 index 000000000..bc62e3cee --- /dev/null +++ b/Model/Changes_2024_07_15 Wohneinheit.txt @@ -0,0 +1,46 @@ +CREATE TABLE `wohneinheit` ( + `Oid` bigint NOT NULL AUTO_INCREMENT, + `InsTs` datetime DEFAULT NULL, + `InsUser` varchar(256) DEFAULT NULL, + `Notice` varchar(1024) DEFAULT NULL, + `Tid` int DEFAULT NULL, + `UdpUser` varchar(256) DEFAULT NULL, + `Version` bigint DEFAULT NULL, + `IsActive` tinyint DEFAULT NULL, + `SystemEntryID` int DEFAULT NULL, + `WohnheimOid` bigint NOT NULL, + `Wohnname` varchar(256) NOT NULL, + `Zimmername` varchar(256) DEFAULT NULL, + `Miete` decimal(18,10) DEFAULT NULL, + `Heizung` decimal(18,10) DEFAULT NULL, + `Strom` decimal(18,10) DEFAULT NULL, + `Betriebskosten` decimal(18,10) DEFAULT NULL, + `SonstigeKosten` decimal(18,10) DEFAULT NULL, + `QM` decimal(18,10) DEFAULT NULL, + `Baujahr` int DEFAULT NULL, + `Mobilierung` varchar(1024) DEFAULT NULL, + `Zusatznotiz` varchar(1024) DEFAULT NULL, + `Stock` varchar(256) DEFAULT NULL, + PRIMARY KEY (`Oid`), + CONSTRAINT `FK_WOHNEINHEIT_WOHNHEIM` FOREIGN KEY (`WohnheimOid`) REFERENCES `Wohnheim` (`Oid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 + +CREATE TABLE `wohneinheitbelegung` ( + `Oid` bigint NOT NULL AUTO_INCREMENT, + `InsTs` datetime DEFAULT NULL, + `InsUser` varchar(256) DEFAULT NULL, + `Notice` varchar(1024) DEFAULT NULL, + `Tid` int DEFAULT NULL, + `UdpUser` varchar(256) DEFAULT NULL, + `Version` bigint DEFAULT NULL, + `IsActive` tinyint DEFAULT NULL, + `SystemEntryID` int DEFAULT NULL, + `WohneinheitOid` bigint NOT NULL, + `CustomerOid` bigint NOT NULL, + `StartDate` datetime NOT NULL, + `EndDate` datetime DEFAULT NULL, + `Kommentar` varchar(1024) DEFAULT NULL, + PRIMARY KEY (`Oid`), + CONSTRAINT `FK_WOHNEINHEITBELEGUNG_WOHNEINHEIT` FOREIGN KEY (`WohneinheitOid`) REFERENCES `Wohneinheit` (`Oid`) + CONSTRAINT `FK_WOHNEINHEITBELEGUNG_CUSTOMER` FOREIGN KEY (`CustomerOid`) REFERENCES `Customer` (`Oid`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 \ No newline at end of file diff --git a/Service/ServiceImplementations/AccountingServiceImp.cs b/Service/ServiceImplementations/AccountingServiceImp.cs index 290c0e867..f0a5797b1 100644 --- a/Service/ServiceImplementations/AccountingServiceImp.cs +++ b/Service/ServiceImplementations/AccountingServiceImp.cs @@ -566,7 +566,7 @@ namespace BeWo.Service.ServiceImplementations { var dc = invoices.Where(i => i.InvoiceBaseOid == entity.Oid).FirstOrDefault(); - + if (dc.IsPaid != entity.IsPaid || dc.IsExported != entity.IsExported || dc.IsReviewed != entity.IsReviewed || @@ -885,7 +885,7 @@ namespace BeWo.Service.ServiceImplementations { var validation_success = CreateGkvTransferProtokoll(entity, protokoll); - if(!validation_success) + if (!validation_success) { response.Message = "Validierung fehlgeschlagen"; return response; @@ -1077,7 +1077,7 @@ namespace BeWo.Service.ServiceImplementations GkvTransferProtokoll = gkv_transfer_dc, Username = loginName, Password = hashed_password, - Tenant = MultitenancyOperationContextExt.Current.Tenant, + Tenant = MultitenancyOperationContextExt.Current.Tenant, DebugMode = "fozc4897b6ztvf978AFCRRG244fvFV2532fvf324AF" }; @@ -1131,14 +1131,14 @@ namespace BeWo.Service.ServiceImplementations response_app8 = JsonConvert.DeserializeObject(response_app8_str); } - catch(Exception e) + catch (Exception e) { return true; } if (!response_app8.Success) throw new DakotaException(response_app8.Message); - + bool allAreUpToDate = true; for (int id = 0; id < updateables_len; id++) { @@ -1181,7 +1181,7 @@ namespace BeWo.Service.ServiceImplementations response_app8_str = client.UploadString(url, "POST", dataString); } } - catch(Exception e) + catch (Exception e) { throw new DakotaException(e.Message, "App8"); } diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index c7039441b..7c2df7ac6 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -172,6 +172,8 @@ namespace BS.Shared GkvAbrechnung = 165, Bargeldtransaktionshistory = 166, GkvTransferprotokoll = 167, + Wohneinheit = 168, + WohneinheitBelegung = 169 } public enum SystemEntryID diff --git a/Shared/DataContracts/DataContract.cs b/Shared/DataContracts/DataContract.cs new file mode 100644 index 000000000..5eb2c3d01 --- /dev/null +++ b/Shared/DataContracts/DataContract.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + public abstract class DataContract : IDataContract + { + [DataMember] + public long? Oid { get; set; } + + [DataMember] + public ActivationTypeId IsActive { get; set; } + + [DataMember] + public string Notice { get; set; } + + [DataMember] + public DateTime? InsTs { get; set; } + + [DataMember] + public string InsUser { get; set; } + + [DataMember] + public long? Version { get; set; } + + [DataMember] + public string UdpUser { get; set; } + + [DataMember] + public SystemEntryID? SystemEntryID { get; set; } + } +} diff --git a/Shared/DataContracts/WohneinheitBelegungDC.cs b/Shared/DataContracts/WohneinheitBelegungDC.cs new file mode 100644 index 000000000..6837d5b36 --- /dev/null +++ b/Shared/DataContracts/WohneinheitBelegungDC.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + public class WohneinheitBelegungDC : DataContract + { + [DataMember] public WohneinheitDC Wohneinheit { get; set; } + [DataMember] public CustomerDC Customer { get; set; } + [DataMember] public DateTime StartDate { get; set; } + [DataMember] public DateTime? EndDate { get; set; } + [DataMember] public string Kommentar { get; set; } + } +} diff --git a/Shared/DataContracts/WohneinheitDC.cs b/Shared/DataContracts/WohneinheitDC.cs new file mode 100644 index 000000000..ed0874e26 --- /dev/null +++ b/Shared/DataContracts/WohneinheitDC.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + public class WohneinheitDC : DataContract + { + [DataMember] public WohnheimDC Wohnheim { get; set; } + [DataMember] public string Wohnname { get; set; } + [DataMember] public string Zimmername { get; set; } + [DataMember] public decimal Miete { get; set; } + [DataMember] public decimal Heizung { get; set; } + [DataMember] public decimal Strom { get; set; } + [DataMember] public decimal Betriebskosten { get; set; } + [DataMember] public decimal SonstigeKosten { get; set; } + [DataMember] public decimal QM { get; set; } + [DataMember] public int Baujahr { get; set; } + [DataMember] public string Mobilierung { get; set; } + [DataMember] public string Zusatznotiz { get; set; } + [DataMember] public string Stock { get; set; } + [DataMember] public List Belegungen { get; set; } + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index a5e76b1eb..ebf12b264 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -170,6 +170,7 @@ + @@ -285,6 +286,8 @@ + + diff --git a/WohneinheitUnitTest/Properties/AssemblyInfo.cs b/WohneinheitUnitTest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..71fcba43c --- /dev/null +++ b/WohneinheitUnitTest/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("WohneinheitUnitTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WohneinheitUnitTest")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("7630915f-dfe4-45a4-a7b1-b6d19b0126c1")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WohneinheitUnitTest/WohneinheitUnitTest.csproj b/WohneinheitUnitTest/WohneinheitUnitTest.csproj new file mode 100644 index 000000000..93879d9c5 --- /dev/null +++ b/WohneinheitUnitTest/WohneinheitUnitTest.csproj @@ -0,0 +1,78 @@ + + + + + + Debug + AnyCPU + {7630915F-DFE4-45A4-A7B1-B6D19B0126C1} + Library + Properties + WohneinheitUnitTest + WohneinheitUnitTest + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE} + Data + + + {2f50b83d-a3f0-4ec4-979a-3f9b7e3d8ed4} + Shared + + + + + + + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". + + + + + + \ No newline at end of file diff --git a/WohneinheitUnitTest/WohneinheitUnitTest1.cs b/WohneinheitUnitTest/WohneinheitUnitTest1.cs new file mode 100644 index 000000000..5ccc9090b --- /dev/null +++ b/WohneinheitUnitTest/WohneinheitUnitTest1.cs @@ -0,0 +1,27 @@ +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BS.Shared.DataContracts; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +namespace WohneinheitUnitTest +{ + [TestClass] + public class WohneinheitUnitTest1 + { + [TestMethod] + public void TestMethod1() + { + var wohnheim = DAOFactory.GenericDAO.GetByID(1); + + var wohneinheit = new Wohneinheit(); + + wohneinheit.Wohnheim = wohnheim; + wohneinheit.Wohnname = "Test"; + + DAOFactory.GenericDAO.Insert(wohneinheit); + + Assert.IsTrue(true); + } + } +} diff --git a/WohneinheitUnitTest/packages.config b/WohneinheitUnitTest/packages.config new file mode 100644 index 000000000..f84cb1064 --- /dev/null +++ b/WohneinheitUnitTest/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 9830bff49bb6528645e6b62221b8a08f6d99f0ce Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 13:02:50 +0200 Subject: [PATCH 002/103] Mappings --- Service/DCEntityMapper/MapperFactory.cs | 10 +++ ...hneinheitBelegungDC_WohneinheitBelegung.cs | 87 ++++++++++++++++++ .../WohneinheitDC_Wohneinheit.cs | 89 +++++++++++++++++++ Service/Service.csproj | 2 + 4 files changed, 188 insertions(+) create mode 100644 Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs create mode 100644 Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs diff --git a/Service/DCEntityMapper/MapperFactory.cs b/Service/DCEntityMapper/MapperFactory.cs index 2179719b5..5f93eb5bb 100644 --- a/Service/DCEntityMapper/MapperFactory.cs +++ b/Service/DCEntityMapper/MapperFactory.cs @@ -298,6 +298,10 @@ namespace BeWo.Service.DCEntityMapper private static BargeldtransaktionshistoryDC_Bargeldtransaktionshistory _BargeldtransaktionshistoryDC_Bargeldtransaktionshistory; + private static WohneinheitDC_Wohneinheit _WohneinheitDC_Wohneinheit; + + private static WohneinheitBelegungDC_WohneinheitBelegung _WohneinheitBelegungDC_WohneinheitBelegung; + public static MedRecordDC_MedRecord MedRecordDC_MedRecord => _MedRecordDC_MedRecord ?? (_MedRecordDC_MedRecord = new MedRecordDC_MedRecord()); @@ -748,5 +752,11 @@ namespace BeWo.Service.DCEntityMapper public static BargeldtransaktionshistoryDC_Bargeldtransaktionshistory BargeldtransaktionshistoryDC_Bargeldtransaktionshistory => _BargeldtransaktionshistoryDC_Bargeldtransaktionshistory ?? (_BargeldtransaktionshistoryDC_Bargeldtransaktionshistory = new BargeldtransaktionshistoryDC_Bargeldtransaktionshistory()); + + public static WohneinheitDC_Wohneinheit WohneinheitDC_Wohneinheit => + _WohneinheitDC_Wohneinheit ?? (_WohneinheitDC_Wohneinheit = new WohneinheitDC_Wohneinheit()); + + public static WohneinheitBelegungDC_WohneinheitBelegung WohneinheitBelegungDC_WohneinheitBelegung => + _WohneinheitBelegungDC_WohneinheitBelegung ?? (_WohneinheitBelegungDC_WohneinheitBelegung = new WohneinheitBelegungDC_WohneinheitBelegung()); } } \ No newline at end of file diff --git a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs new file mode 100644 index 000000000..ccf511d48 --- /dev/null +++ b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BeWo.Data.Access; +using BeWo.Data.Entities; + +using BS.Shared; +using BS.Shared.DataContracts; + +namespace BeWo.Service.DCEntityMapper +{ + public class WohneinheitBelegungDC_WohneinheitBelegung : AbstractIDCEntityMapper + { + public virtual List MapToNewDCs(IEnumerable pEntitys, WohneinheitDC dc) + { + var lResult = new List(); + if (pEntitys != null) + { + foreach (WohneinheitBelegung iEntity in pEntitys) + { + lResult.Add(MergeWithDC(iEntity, CreateNewDC(), dc)); + } + } + return lResult; + } + + public override WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract) + { + throw new NotImplementedException("Logik fehlt."); + + var wohneinheit = MapperFactory.WohneinheitDC_Wohneinheit.MapToNewDC(pEntity.Wohneinheit); + + return MergeWithDC(pEntity, pDataContract, wohneinheit); + } + + public WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract, WohneinheitDC wohneinheit) + { + pDataContract.Customer = MapperFactory.CustomerDC_Customer.MapToNewDC(pEntity.Customer); + + pDataContract.Wohneinheit = wohneinheit; + + pDataContract.Oid = pEntity.Oid; + pDataContract.IsActive = pEntity.IsActive; + pDataContract.Notice = pEntity.Notice; + pDataContract.InsTs = pEntity.InsTs; + pDataContract.InsUser = pEntity.InsUser; + pDataContract.Version = pEntity.Version; + pDataContract.UdpUser = pEntity.UdpUser; + pDataContract.SystemEntryID = pEntity.SystemEntryID; + pDataContract.StartDate = pEntity.StartDate; + pDataContract.EndDate = pEntity.EndDate; + pDataContract.Kommentar = pEntity.Kommentar; + + return pDataContract; + } + + public override WohneinheitBelegung MergeWithEntity(WohneinheitBelegungDC pDataContract, WohneinheitBelegung pEntity) + { + pEntity.Oid = pDataContract.Oid; + pEntity.IsActive = pDataContract.IsActive; + pEntity.Notice = pDataContract.Notice; + pEntity.InsTs = pDataContract.InsTs; + pEntity.InsUser = pDataContract.InsUser; + pEntity.Version = pDataContract.Version; + pEntity.UdpUser = pDataContract.UdpUser; + pEntity.SystemEntryID = pDataContract.SystemEntryID; + pEntity.StartDate = pDataContract.StartDate; + pEntity.EndDate = pDataContract.EndDate; + pEntity.Kommentar = pDataContract.Kommentar; + + pEntity.Customer = DAOFactory.GenericDAO.GetByID(pDataContract.Customer.CustomerOid.Value); + pEntity.Wohneinheit = DAOFactory.GenericDAO.GetByID(pDataContract.Wohneinheit.Oid.Value); + + return pEntity; + } + + protected override bool AreDCAndEntityEqual(WohneinheitBelegungDC pDC, WohneinheitBelegung pEntity) + { + if (pDC.Oid == null) + { + return false; + } + + return pDC.Oid == pEntity.Oid; + } + } +} \ No newline at end of file diff --git a/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs new file mode 100644 index 000000000..81c1742aa --- /dev/null +++ b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using System.Linq; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Service.ServiceImplementations; +using BS.Shared; +using BS.Shared.DataContracts; + +namespace BeWo.Service.DCEntityMapper +{ + public class WohneinheitDC_Wohneinheit : AbstractIDCEntityMapper + { + public override WohneinheitDC MergeWithDC(Wohneinheit pEntity, WohneinheitDC pDataContract) + { + pDataContract.Oid = pEntity.Oid; + pDataContract.IsActive = pEntity.IsActive; + pDataContract.Notice = pEntity.Notice; + pDataContract.InsTs = pEntity.InsTs; + pDataContract.InsUser = pEntity.InsUser; + pDataContract.Version = pEntity.Version; + pDataContract.UdpUser = pEntity.UdpUser; + pDataContract.SystemEntryID = pEntity.SystemEntryID; + + pDataContract.Wohnname = pEntity.Wohnname; + pDataContract.Zimmername = pEntity.Zimmername; + pDataContract.Miete = pEntity.Miete; + pDataContract.Heizung = pEntity.Heizung; + pDataContract.Strom = pEntity.Strom; + pDataContract.Betriebskosten = pEntity.Betriebskosten; + pDataContract.SonstigeKosten = pEntity.SonstigeKosten; + pDataContract.QM = pEntity.QM; + pDataContract.Baujahr = pEntity.Baujahr; + pDataContract.Mobilierung = pEntity.Mobilierung; + pDataContract.Zusatznotiz = pEntity.Zusatznotiz; + pDataContract.Stock = pEntity.Stock; + + pDataContract.Wohnheim = MapperFactory.WohnheimDC_Wohnheim.MapToNewDC(pEntity.Wohnheim); + + if (pEntity.Belegungen is object && pEntity.Belegungen.Any()) + pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen, pDataContract); + + return pDataContract; + } + + public override Wohneinheit MergeWithEntity(WohneinheitDC pDataContract, Wohneinheit pEntity) + { + pEntity.Oid = pDataContract.Oid; + pEntity.IsActive = pDataContract.IsActive; + pEntity.Notice = pDataContract.Notice; + pEntity.InsTs = pDataContract.InsTs; + pEntity.InsUser = pDataContract.InsUser; + pEntity.Version = pDataContract.Version; + pEntity.UdpUser = pDataContract.UdpUser; + pEntity.SystemEntryID = pDataContract.SystemEntryID; + + pEntity.Wohnname = pDataContract.Wohnname; + pEntity.Zimmername = pDataContract.Zimmername; + pEntity.Miete = pDataContract.Miete; + pEntity.Heizung = pDataContract.Heizung; + pEntity.Strom = pDataContract.Strom; + pEntity.Betriebskosten = pDataContract.Betriebskosten; + pEntity.SonstigeKosten = pDataContract.SonstigeKosten; + pEntity.QM = pDataContract.QM; + pEntity.Baujahr = pDataContract.Baujahr; + pEntity.Mobilierung = pDataContract.Mobilierung; + pEntity.Zusatznotiz = pDataContract.Zusatznotiz; + pEntity.Stock = pDataContract.Stock; + + pEntity.Wohnheim = DAOFactory.GenericDAO.LoadByID(pDataContract.Wohnheim.WohnheimOid.Value); + + if (pEntity.Belegungen is null) + pEntity.Belegungen = new List(); + + MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MergeWithEntitys(pDataContract.Belegungen, pEntity.Belegungen); + + return pEntity; + } + + protected override bool AreDCAndEntityEqual(WohneinheitDC pDC, Wohneinheit pEntity) + { + if (pDC.Oid == null) + { + return false; + } + + return pDC.Oid == pEntity.Oid; + } + } +} \ No newline at end of file diff --git a/Service/Service.csproj b/Service/Service.csproj index edca4ddd1..26b8d8262 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -327,9 +327,11 @@ + + From 6ca13995c11d6d94643e1f509fddf45f2c67b93e Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 13:18:26 +0200 Subject: [PATCH 003/103] BelegungDC hat keinen Verweis mehr auf WohneinheitDC Objekt --- ...hneinheitBelegungDC_WohneinheitBelegung.cs | 26 ++----------------- .../WohneinheitDC_Wohneinheit.cs | 2 +- Shared/DataContracts/WohneinheitBelegungDC.cs | 2 +- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs index ccf511d48..1ca89d47b 100644 --- a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs +++ b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs @@ -11,33 +11,11 @@ namespace BeWo.Service.DCEntityMapper { public class WohneinheitBelegungDC_WohneinheitBelegung : AbstractIDCEntityMapper { - public virtual List MapToNewDCs(IEnumerable pEntitys, WohneinheitDC dc) - { - var lResult = new List(); - if (pEntitys != null) - { - foreach (WohneinheitBelegung iEntity in pEntitys) - { - lResult.Add(MergeWithDC(iEntity, CreateNewDC(), dc)); - } - } - return lResult; - } - public override WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract) - { - throw new NotImplementedException("Logik fehlt."); - - var wohneinheit = MapperFactory.WohneinheitDC_Wohneinheit.MapToNewDC(pEntity.Wohneinheit); - - return MergeWithDC(pEntity, pDataContract, wohneinheit); - } - - public WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract, WohneinheitDC wohneinheit) { pDataContract.Customer = MapperFactory.CustomerDC_Customer.MapToNewDC(pEntity.Customer); - pDataContract.Wohneinheit = wohneinheit; + pDataContract.Wohneinheit = pEntity.Wohneinheit.Oid.Value; pDataContract.Oid = pEntity.Oid; pDataContract.IsActive = pEntity.IsActive; @@ -69,7 +47,7 @@ namespace BeWo.Service.DCEntityMapper pEntity.Kommentar = pDataContract.Kommentar; pEntity.Customer = DAOFactory.GenericDAO.GetByID(pDataContract.Customer.CustomerOid.Value); - pEntity.Wohneinheit = DAOFactory.GenericDAO.GetByID(pDataContract.Wohneinheit.Oid.Value); + pEntity.Wohneinheit = DAOFactory.GenericDAO.GetByID(pDataContract.Wohneinheit); return pEntity; } diff --git a/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs index 81c1742aa..9e3681e83 100644 --- a/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs +++ b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs @@ -37,7 +37,7 @@ namespace BeWo.Service.DCEntityMapper pDataContract.Wohnheim = MapperFactory.WohnheimDC_Wohnheim.MapToNewDC(pEntity.Wohnheim); if (pEntity.Belegungen is object && pEntity.Belegungen.Any()) - pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen, pDataContract); + pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen); return pDataContract; } diff --git a/Shared/DataContracts/WohneinheitBelegungDC.cs b/Shared/DataContracts/WohneinheitBelegungDC.cs index 6837d5b36..145b3754d 100644 --- a/Shared/DataContracts/WohneinheitBelegungDC.cs +++ b/Shared/DataContracts/WohneinheitBelegungDC.cs @@ -9,7 +9,7 @@ namespace BS.Shared.DataContracts { public class WohneinheitBelegungDC : DataContract { - [DataMember] public WohneinheitDC Wohneinheit { get; set; } + [DataMember] public long Wohneinheit { get; set; } [DataMember] public CustomerDC Customer { get; set; } [DataMember] public DateTime StartDate { get; set; } [DataMember] public DateTime? EndDate { get; set; } From 5f634b37907bbe8cbef3ce46eff63fba44f49da9 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 13:19:57 +0200 Subject: [PATCH 004/103] format --- BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs | 6 ------ .../WohneinheitBelegungDC_WohneinheitBelegung.cs | 1 - 2 files changed, 7 deletions(-) diff --git a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs index 0acacaf86..9e6ab8e9e 100644 --- a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs +++ b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs @@ -138,7 +138,6 @@ namespace BeWo.ViewModel.ListViewModel #endregion - #region Public Methods public VMType AddNewVMToList() { @@ -199,9 +198,6 @@ namespace BeWo.ViewModel.ListViewModel return this._DCBackup.Where(dc => !this._VMList.Select(vm => vm.DataContract).Contains(dc)).ToList(); } - #endregion - - #region Methods protected virtual VMType CreateVM(DCType pDC) { @@ -209,7 +205,5 @@ namespace BeWo.ViewModel.ListViewModel return lConstr.Invoke(new object[] { pDC }) as VMType; } - - #endregion } } \ No newline at end of file diff --git a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs index 1ca89d47b..ec24b5937 100644 --- a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs +++ b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs @@ -14,7 +14,6 @@ namespace BeWo.Service.DCEntityMapper public override WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract) { pDataContract.Customer = MapperFactory.CustomerDC_Customer.MapToNewDC(pEntity.Customer); - pDataContract.Wohneinheit = pEntity.Wohneinheit.Oid.Value; pDataContract.Oid = pEntity.Oid; From e7e0396d3ff6d78e475b571875671a8e80da03dd Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 14:39:49 +0200 Subject: [PATCH 005/103] =?UTF-8?q?WohneinheitVM=20+=20Ebenen=20ber=C3=BCc?= =?UTF-8?q?ksichtigt:=20-=20Verweise=20auf=20Parents:=20Oid=20-=20Verweise?= =?UTF-8?q?=20auf=20Childs:=20Objekte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWo.csproj | 2 + .../ListViewModel/WohneinheitListVM.cs | 15 + BeWo/ViewModel/WohneinheitVM.cs | 279 ++++++++++++++++++ Data/Entities/Wohneinheit.cs | 12 +- Data/Entities/WohneinheitBelegung.cs | 24 +- Data/Mappings/Wohneinheit.hbm.xml | 4 +- Data/Mappings/WohneinheitBelegung.hbm.xml | 6 +- ...hneinheitBelegungDC_WohneinheitBelegung.cs | 18 +- .../WohneinheitDC_Wohneinheit.cs | 14 +- Shared/DataContracts/DataContract.cs | 15 - Shared/DataContracts/WohneinheitBelegungDC.cs | 4 +- Shared/DataContracts/WohneinheitDC.cs | 2 +- 12 files changed, 330 insertions(+), 65 deletions(-) create mode 100644 BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs create mode 100644 BeWo/ViewModel/WohneinheitVM.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 82c471f1a..b342a9929 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -1039,6 +1039,8 @@ + + diff --git a/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs b/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs new file mode 100644 index 000000000..193ae017e --- /dev/null +++ b/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +using BS.Shared; +using BS.Shared.Core; +using BS.Shared.DataContracts; + +namespace BeWo.ViewModel.ListViewModel +{ + public class WohneinheitListVM : AbstractDCListMapperVM + { + public WohneinheitListVM(List pDCs): base(pDCs) + { + } + } +} \ No newline at end of file diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs new file mode 100644 index 000000000..9334e50f5 --- /dev/null +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -0,0 +1,279 @@ +using BS.Shared; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.ViewModel +{ + public class WohneinheitVM : AbstractDCMapperVM + { + private long? _Oid; + private long? _Version; + private string _Notice; + + private long _WohnheimOid; + private string _Wohnname; + private string _Zimmername; + private decimal _Miete; + private decimal _Heizung; + private decimal _Strom; + private decimal _Betriebskosten; + private decimal _SonstigeKosten; + private decimal _QM; + private int _Baujahr; + private string _Mobilierung; + private string _Zusatznotiz; + private string _Stock; + private List _Belegungen; + + public WohneinheitVM(WohneinheitDC dc) : base(dc, dc.Oid == null) + { + + } + + public long WohnheimOid + { + get { return _WohnheimOid; } + set + { + if (AreDifferent(WohnheimOid, value)) + { + _WohnheimOid = value; + StoreDirtyInformation(AreDifferent(DataContract.WohnheimOid, value), nameof(WohnheimOid)); + FirePropertyChanged(nameof(WohnheimOid)); + } + } + } + + public string Wohnname + { + get { return _Wohnname; } + set + { + if (AreDifferent(Wohnname, value)) + { + _Wohnname = value; + StoreDirtyInformation(AreDifferent(DataContract.Wohnname, value), nameof(Wohnname)); + FirePropertyChanged(nameof(Wohnname)); + } + } + } + + public string Zimmername + { + get { return _Zimmername; } + set + { + if (AreDifferent(Zimmername, value)) + { + _Zimmername = value; + StoreDirtyInformation(AreDifferent(DataContract.Zimmername, value), nameof(Zimmername)); + FirePropertyChanged(nameof(Zimmername)); + } + } + } + + public decimal Miete + { + get { return _Miete; } + set + { + if (AreDifferent(Miete, value)) + { + _Miete = value; + StoreDirtyInformation(AreDifferent(DataContract.Miete, value), nameof(Miete)); + FirePropertyChanged(nameof(Miete)); + } + } + } + + public decimal Heizung + { + get { return _Heizung; } + set + { + if (AreDifferent(Heizung, value)) + { + _Heizung = value; + StoreDirtyInformation(AreDifferent(DataContract.Heizung, value), nameof(Heizung)); + FirePropertyChanged(nameof(Heizung)); + } + } + } + + public decimal Strom + { + get { return _Strom; } + set + { + if (AreDifferent(Strom, value)) + { + _Strom = value; + StoreDirtyInformation(AreDifferent(DataContract.Strom, value), nameof(Strom)); + FirePropertyChanged(nameof(Strom)); + } + } + } + + public decimal Betriebskosten + { + get { return _Betriebskosten; } + set + { + if (AreDifferent(Betriebskosten, value)) + { + _Betriebskosten = value; + StoreDirtyInformation(AreDifferent(DataContract.Betriebskosten, value), nameof(Betriebskosten)); + FirePropertyChanged(nameof(Betriebskosten)); + } + } + } + + public decimal SonstigeKosten + { + get { return _SonstigeKosten; } + set + { + if (AreDifferent(SonstigeKosten, value)) + { + _SonstigeKosten = value; + StoreDirtyInformation(AreDifferent(DataContract.SonstigeKosten, value), nameof(SonstigeKosten)); + FirePropertyChanged(nameof(SonstigeKosten)); + } + } + } + + public decimal QM + { + get { return _QM; } + set + { + if (AreDifferent(QM, value)) + { + _QM = value; + StoreDirtyInformation(AreDifferent(DataContract.QM, value), nameof(QM)); + FirePropertyChanged(nameof(QM)); + } + } + } + + public int Baujahr + { + get { return _Baujahr; } + set + { + if (AreDifferent(Baujahr, value)) + { + _Baujahr = value; + StoreDirtyInformation(AreDifferent(DataContract.Baujahr, value), nameof(Baujahr)); + FirePropertyChanged(nameof(Baujahr)); + } + } + } + + public string Mobilierung + { + get { return _Mobilierung; } + set + { + if (AreDifferent(Mobilierung, value)) + { + _Mobilierung = value; + StoreDirtyInformation(AreDifferent(DataContract.Mobilierung, value), nameof(Mobilierung)); + FirePropertyChanged(nameof(Mobilierung)); + } + } + } + + public string Zusatznotiz + { + get { return _Zusatznotiz; } + set + { + if (AreDifferent(Zusatznotiz, value)) + { + _Zusatznotiz = value; + StoreDirtyInformation(AreDifferent(DataContract.Zusatznotiz, value), nameof(Zusatznotiz)); + FirePropertyChanged(nameof(Zusatznotiz)); + } + } + } + + public string Stock + { + get { return _Stock; } + set + { + if (AreDifferent(Stock, value)) + { + _Stock = value; + StoreDirtyInformation(AreDifferent(DataContract.Stock, value), nameof(Stock)); + FirePropertyChanged(nameof(Stock)); + } + } + } + + public List Belegungen + { + get { return _Belegungen; } + set + { + if (AreDifferent(Belegungen, value)) + { + _Belegungen = value; + StoreDirtyInformation(AreDifferent(DataContract.Belegungen, value), nameof(Belegungen)); + FirePropertyChanged(nameof(Belegungen)); + } + } + } + + protected override void InitByDataContract(WohneinheitDC pDataContract) + { + _Oid = pDataContract.Oid; + _Version = pDataContract.Version; + _Notice = pDataContract.Notice; + + _Wohnname = pDataContract.Wohnname; + _Zimmername = pDataContract.Zimmername; + _Miete = pDataContract.Miete; + _Heizung = pDataContract.Heizung; + _Strom = pDataContract.Strom; + _Betriebskosten = pDataContract.Betriebskosten; + _SonstigeKosten = pDataContract.SonstigeKosten; + _QM = pDataContract.QM; + _Baujahr = pDataContract.Baujahr; + _Mobilierung = pDataContract.Mobilierung; + _Zusatznotiz = pDataContract.Zusatznotiz; + _Stock = pDataContract.Stock; + _WohnheimOid = pDataContract.WohnheimOid; + _Belegungen = pDataContract.Belegungen; + } + + protected override WohneinheitDC MapToDataContract(WohneinheitDC bDataContract, bool doCommit) + { + bDataContract.Oid = _Oid; + bDataContract.Notice = _Notice; + bDataContract.Version = _Version; + + bDataContract.Wohnname = _Wohnname; + bDataContract.Zimmername = _Zimmername; + bDataContract.Miete = _Miete; + bDataContract.Heizung = _Heizung; + bDataContract.Strom = _Strom; + bDataContract.Betriebskosten = _Betriebskosten; + bDataContract.SonstigeKosten = _SonstigeKosten; + bDataContract.QM = _QM; + bDataContract.Baujahr = _Baujahr; + bDataContract.Mobilierung = _Mobilierung; + bDataContract.Zusatznotiz = _Zusatznotiz; + bDataContract.Stock = _Stock; + bDataContract.WohnheimOid = _WohnheimOid; + bDataContract.Belegungen = _Belegungen; + + return bDataContract; + } + } +} diff --git a/Data/Entities/Wohneinheit.cs b/Data/Entities/Wohneinheit.cs index 956ddcfa5..8a7855271 100644 --- a/Data/Entities/Wohneinheit.cs +++ b/Data/Entities/Wohneinheit.cs @@ -8,7 +8,7 @@ namespace BeWo.Data.Entities { public class Wohneinheit : BeWoEntityBase { - public static string PropertyName_Wohnheim = nameof(Wohnheim); + public static string PropertyName_Wohnheim = nameof(WohnheimOid); public static string PropertyName_Wohnname = nameof(Wohnname); public static string PropertyName_Zimmername = nameof(Zimmername); public static string PropertyName_Miete = nameof(Miete); @@ -23,7 +23,7 @@ namespace BeWo.Data.Entities public static string PropertyName_Stock = nameof(Stock); public static string PropertyName_Belegungen = nameof(Belegungen); - private Wohnheim _Wohnheim; + private long _WohnheimOid; private string _Wohnname; private string _Zimmername; private decimal _Miete; @@ -43,18 +43,18 @@ namespace BeWo.Data.Entities _Tid = BS.Shared.TableID.Wohneinheit; } - public virtual Wohnheim Wohnheim + public virtual long WohnheimOid { get { - return this._Wohnheim; + return _WohnheimOid; } set { - if (this.AreDifferent(this._Wohnheim, value)) + if (AreDifferent(this._WohnheimOid, value)) { - this._Wohnheim = value; + _WohnheimOid = value; } } } diff --git a/Data/Entities/WohneinheitBelegung.cs b/Data/Entities/WohneinheitBelegung.cs index 00fbc29bd..02e07f967 100644 --- a/Data/Entities/WohneinheitBelegung.cs +++ b/Data/Entities/WohneinheitBelegung.cs @@ -8,14 +8,14 @@ namespace BeWo.Data.Entities { public class WohneinheitBelegung : BeWoEntityBase { - public static string PropertyName_Customer = nameof(Customer); - public static string PropertyName_Wohneinheit = nameof(Wohneinheit); + public static string PropertyName_Customer = nameof(CustomerOid); + public static string PropertyName_Wohneinheit = nameof(WohneinheitOid); public static string PropertyName_StartDate = nameof(StartDate); public static string PropertyName_EndDate = nameof(EndDate); public static string PropertyName_Kommentar = nameof(Kommentar); - private Customer _Customer; - private Wohneinheit _Wohneinheit; + private long _CustomerOid; + private long _WohneinheitOid; private DateTime _StartDate; private DateTime? _EndDate; private string _Kommentar; @@ -25,33 +25,33 @@ namespace BeWo.Data.Entities _Tid = BS.Shared.TableID.WohneinheitBelegung; } - public virtual Customer Customer + public virtual long CustomerOid { get { - return this._Customer; + return this._CustomerOid; } set { - if (this.AreDifferent(this._Customer, value)) + if (this.AreDifferent(this._CustomerOid, value)) { - this._Customer = value; + this._CustomerOid = value; } } } - public virtual Wohneinheit Wohneinheit + public virtual long WohneinheitOid { get { - return this._Wohneinheit; + return this._WohneinheitOid; } set { - if (this.AreDifferent(this._Wohneinheit, value)) + if (this.AreDifferent(this._WohneinheitOid, value)) { - this._Wohneinheit = value; + this._WohneinheitOid = value; } } } diff --git a/Data/Mappings/Wohneinheit.hbm.xml b/Data/Mappings/Wohneinheit.hbm.xml index 6a98c80fc..f8ffafa68 100644 --- a/Data/Mappings/Wohneinheit.hbm.xml +++ b/Data/Mappings/Wohneinheit.hbm.xml @@ -25,7 +25,9 @@ - + + + diff --git a/Data/Mappings/WohneinheitBelegung.hbm.xml b/Data/Mappings/WohneinheitBelegung.hbm.xml index c719b2a73..926bc98af 100644 --- a/Data/Mappings/WohneinheitBelegung.hbm.xml +++ b/Data/Mappings/WohneinheitBelegung.hbm.xml @@ -16,7 +16,9 @@ - - + + + \ No newline at end of file diff --git a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs index ec24b5937..35c9b836c 100644 --- a/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs +++ b/Service/DCEntityMapper/WohneinheitBelegungDC_WohneinheitBelegung.cs @@ -13,17 +13,12 @@ namespace BeWo.Service.DCEntityMapper { public override WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract) { - pDataContract.Customer = MapperFactory.CustomerDC_Customer.MapToNewDC(pEntity.Customer); - pDataContract.Wohneinheit = pEntity.Wohneinheit.Oid.Value; + pDataContract.CustomerOid = pEntity.CustomerOid; + pDataContract.WohneinheitOid = pEntity.WohneinheitOid; pDataContract.Oid = pEntity.Oid; - pDataContract.IsActive = pEntity.IsActive; pDataContract.Notice = pEntity.Notice; - pDataContract.InsTs = pEntity.InsTs; - pDataContract.InsUser = pEntity.InsUser; pDataContract.Version = pEntity.Version; - pDataContract.UdpUser = pEntity.UdpUser; - pDataContract.SystemEntryID = pEntity.SystemEntryID; pDataContract.StartDate = pEntity.StartDate; pDataContract.EndDate = pEntity.EndDate; pDataContract.Kommentar = pEntity.Kommentar; @@ -34,19 +29,14 @@ namespace BeWo.Service.DCEntityMapper public override WohneinheitBelegung MergeWithEntity(WohneinheitBelegungDC pDataContract, WohneinheitBelegung pEntity) { pEntity.Oid = pDataContract.Oid; - pEntity.IsActive = pDataContract.IsActive; pEntity.Notice = pDataContract.Notice; - pEntity.InsTs = pDataContract.InsTs; - pEntity.InsUser = pDataContract.InsUser; pEntity.Version = pDataContract.Version; - pEntity.UdpUser = pDataContract.UdpUser; - pEntity.SystemEntryID = pDataContract.SystemEntryID; pEntity.StartDate = pDataContract.StartDate; pEntity.EndDate = pDataContract.EndDate; pEntity.Kommentar = pDataContract.Kommentar; - pEntity.Customer = DAOFactory.GenericDAO.GetByID(pDataContract.Customer.CustomerOid.Value); - pEntity.Wohneinheit = DAOFactory.GenericDAO.GetByID(pDataContract.Wohneinheit); + pEntity.CustomerOid = pDataContract.CustomerOid; + pEntity.WohneinheitOid = pDataContract.WohneinheitOid; return pEntity; } diff --git a/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs index 9e3681e83..0cc37daac 100644 --- a/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs +++ b/Service/DCEntityMapper/WohneinheitDC_Wohneinheit.cs @@ -13,13 +13,8 @@ namespace BeWo.Service.DCEntityMapper public override WohneinheitDC MergeWithDC(Wohneinheit pEntity, WohneinheitDC pDataContract) { pDataContract.Oid = pEntity.Oid; - pDataContract.IsActive = pEntity.IsActive; pDataContract.Notice = pEntity.Notice; - pDataContract.InsTs = pEntity.InsTs; - pDataContract.InsUser = pEntity.InsUser; pDataContract.Version = pEntity.Version; - pDataContract.UdpUser = pEntity.UdpUser; - pDataContract.SystemEntryID = pEntity.SystemEntryID; pDataContract.Wohnname = pEntity.Wohnname; pDataContract.Zimmername = pEntity.Zimmername; @@ -34,7 +29,7 @@ namespace BeWo.Service.DCEntityMapper pDataContract.Zusatznotiz = pEntity.Zusatznotiz; pDataContract.Stock = pEntity.Stock; - pDataContract.Wohnheim = MapperFactory.WohnheimDC_Wohnheim.MapToNewDC(pEntity.Wohnheim); + pDataContract.WohnheimOid = pEntity.WohnheimOid; if (pEntity.Belegungen is object && pEntity.Belegungen.Any()) pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen); @@ -45,13 +40,8 @@ namespace BeWo.Service.DCEntityMapper public override Wohneinheit MergeWithEntity(WohneinheitDC pDataContract, Wohneinheit pEntity) { pEntity.Oid = pDataContract.Oid; - pEntity.IsActive = pDataContract.IsActive; pEntity.Notice = pDataContract.Notice; - pEntity.InsTs = pDataContract.InsTs; - pEntity.InsUser = pDataContract.InsUser; pEntity.Version = pDataContract.Version; - pEntity.UdpUser = pDataContract.UdpUser; - pEntity.SystemEntryID = pDataContract.SystemEntryID; pEntity.Wohnname = pDataContract.Wohnname; pEntity.Zimmername = pDataContract.Zimmername; @@ -66,7 +56,7 @@ namespace BeWo.Service.DCEntityMapper pEntity.Zusatznotiz = pDataContract.Zusatznotiz; pEntity.Stock = pDataContract.Stock; - pEntity.Wohnheim = DAOFactory.GenericDAO.LoadByID(pDataContract.Wohnheim.WohnheimOid.Value); + pEntity.WohnheimOid =pDataContract.WohnheimOid; if (pEntity.Belegungen is null) pEntity.Belegungen = new List(); diff --git a/Shared/DataContracts/DataContract.cs b/Shared/DataContracts/DataContract.cs index 5eb2c3d01..e13447281 100644 --- a/Shared/DataContracts/DataContract.cs +++ b/Shared/DataContracts/DataContract.cs @@ -12,25 +12,10 @@ namespace BS.Shared.DataContracts [DataMember] public long? Oid { get; set; } - [DataMember] - public ActivationTypeId IsActive { get; set; } - [DataMember] public string Notice { get; set; } - [DataMember] - public DateTime? InsTs { get; set; } - - [DataMember] - public string InsUser { get; set; } - [DataMember] public long? Version { get; set; } - - [DataMember] - public string UdpUser { get; set; } - - [DataMember] - public SystemEntryID? SystemEntryID { get; set; } } } diff --git a/Shared/DataContracts/WohneinheitBelegungDC.cs b/Shared/DataContracts/WohneinheitBelegungDC.cs index 145b3754d..f99f7c076 100644 --- a/Shared/DataContracts/WohneinheitBelegungDC.cs +++ b/Shared/DataContracts/WohneinheitBelegungDC.cs @@ -9,8 +9,8 @@ namespace BS.Shared.DataContracts { public class WohneinheitBelegungDC : DataContract { - [DataMember] public long Wohneinheit { get; set; } - [DataMember] public CustomerDC Customer { get; set; } + [DataMember] public long WohneinheitOid { get; set; } + [DataMember] public long CustomerOid { get; set; } [DataMember] public DateTime StartDate { get; set; } [DataMember] public DateTime? EndDate { get; set; } [DataMember] public string Kommentar { get; set; } diff --git a/Shared/DataContracts/WohneinheitDC.cs b/Shared/DataContracts/WohneinheitDC.cs index ed0874e26..caf18722a 100644 --- a/Shared/DataContracts/WohneinheitDC.cs +++ b/Shared/DataContracts/WohneinheitDC.cs @@ -9,7 +9,7 @@ namespace BS.Shared.DataContracts { public class WohneinheitDC : DataContract { - [DataMember] public WohnheimDC Wohnheim { get; set; } + [DataMember] public long WohnheimOid { get; set; } [DataMember] public string Wohnname { get; set; } [DataMember] public string Zimmername { get; set; } [DataMember] public decimal Miete { get; set; } From 774c4b334416282961c3cf9726a46caa00030893 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 16 Jul 2024 15:07:59 +0200 Subject: [PATCH 006/103] Popup + Listenlogik --- BeWo/BeWo.csproj | 7 + BeWo/View/Controls/WohneinheitEditPopup.xaml | 121 ++++++++++++++++++ .../Controls/WohneinheitEditPopup.xaml.cs | 83 ++++++++++++ BeWo/View/Detail/WohnheimView.xaml | 15 ++- BeWo/View/Detail/WohnheimView.xaml.cs | 16 ++- BeWo/ViewModel/AbstractDCMapperVM.cs | 8 +- .../ListViewModel/WohneinheitListVM.cs | 9 +- BeWo/ViewModel/WohneinheitVM.cs | 76 ++++++----- BeWo/ViewModel/WohnheimVM.cs | 22 +++- Data/Entities/Wohneinheit.cs | 17 +++ Data/Entities/Wohnheim.cs | 15 +++ Data/Mappings/Wohneinheit.hbm.xml | 1 + Data/Mappings/Wohnheim.hbm.xml | 4 + Model/Changes_2024_07_15 Wohneinheit.txt | 7 +- .../WohneinheitDC_Wohneinheit.cs | 2 + Service/DCEntityMapper/WohnheimDC_Wohnheim.cs | 12 +- Shared/DataContracts/WohneinheitDC.cs | 1 + Shared/DataContracts/WohnheimDC.cs | 3 + WohneinheitUnitTest/WohneinheitUnitTest1.cs | 9 -- 19 files changed, 358 insertions(+), 70 deletions(-) create mode 100644 BeWo/View/Controls/WohneinheitEditPopup.xaml create mode 100644 BeWo/View/Controls/WohneinheitEditPopup.xaml.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index b342a9929..9441d2f33 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -319,6 +319,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -1143,6 +1147,9 @@ + + WohneinheitEditPopup.xaml + HilfeplanImportView.xaml diff --git a/BeWo/View/Controls/WohneinheitEditPopup.xaml b/BeWo/View/Controls/WohneinheitEditPopup.xaml new file mode 100644 index 000000000..dd115fff5 --- /dev/null +++ b/BeWo/View/Controls/WohneinheitEditPopup.xaml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs new file mode 100644 index 000000000..2382a3beb --- /dev/null +++ b/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs @@ -0,0 +1,83 @@ +using BeWo.ViewModel; +using BeWo.ViewModel.ListViewModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Controls +{ + /// + /// Interaktionslogik für WohneinheitEditControl.xaml + /// + public partial class WohneinheitEditPopup : Popup + { + private bool _IsNew; + + public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register( + "ViewModel", typeof(WohnheimVM), + typeof(WohneinheitEditPopup), + new PropertyMetadata(null) + ); + + public WohnheimVM ViewModel + { + get => (WohnheimVM)GetValue(ViewModelProperty); + set => SetValue(ViewModelProperty, value); + } + + public WohneinheitEditPopup() + { + InitializeComponent(); + } + + private void Save_Button_Click(object sender, RoutedEventArgs e) + { + if (_IsNew) + { + ViewModel.WohneinheitListVM.AddNewVMToList(); + } + else + { + ViewModel.WohneinheitListVM.EditVM = null; + } + + IsOpen = false; + } + + private void Cancel_Button_Click(object sender, RoutedEventArgs e) + { + if (_IsNew) + { + ViewModel.WohneinheitListVM.NewVM = null; + } + else + { + ViewModel.WohneinheitListVM.EditVM.RestoreByDataContract(); + ViewModel.WohneinheitListVM.EditVM = null; + } + + IsOpen = false; + } + + private void Popup_Opened(object sender, EventArgs e) + { + var vmlist = ViewModel.WohneinheitListVM; + + _IsNew = vmlist.CurrentVM == vmlist.NewVM; + + groupbox_newWohneinheit.Header = _IsNew ? "Wohneinheit erstellen" : "Wohneinheit bearbeiten"; + } + } +} diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 0819bb058..88f9fb123 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -2,10 +2,12 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" + xmlns:uvc="clr-namespace:BeWo.View.Controls" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" - xmlns:val="clr-namespace:BeWo.Validation" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" + xmlns:val="clr-namespace:BeWo.Validation" + xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" @@ -314,7 +316,7 @@ - + @@ -323,6 +325,15 @@ + + + + + + + diff --git a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs new file mode 100644 index 000000000..821c8bc05 --- /dev/null +++ b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs @@ -0,0 +1,83 @@ +using BeWo.ViewModel; +using BeWo.ViewModel.ListViewModel; +using BS.Shared.Core; +using BS.Shared.DataContracts.Compact; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Controls +{ + /// + /// Interaktionslogik für WohneinheitBelegungEditPopup.xaml + /// + public partial class WohneinheitBelegungEditPopup : Popup + { + public WohneinheitBelegungVM ViewModel + { + get { return (WohneinheitBelegungVM)GetValue(VMProperty); } + set { SetValue(VMProperty, value); } + } + + // Using a DependencyProperty as the backing store for VM. This enables animation, styling, binding, etc... + public static readonly DependencyProperty VMProperty = + DependencyProperty.Register("ViewModel", typeof(WohneinheitBelegungVM), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); + + public WohneinheitBelegungEditPopup() + { + InitializeComponent(); + } + + private void Save_Button_Click(object sender, RoutedEventArgs e) + { + IsOpen = false; + } + + private void Cancel_Button_Click(object sender, RoutedEventArgs e) + { + IsOpen = false; + } + + private void Popup_Opened(object sender, EventArgs e) + { + //var vmlist = ViewModel.WohneinheitListVM; + + //_IsNew = vmlist.EditVM is null; + //groupbox_newWohneinheit.Header = _IsNew ? "Wohneinheit erstellen" : "Wohneinheit bearbeiten"; + //btn_cancel.Content = _IsNew ? "Abbrechen" : "Schließen"; + //btn_save.Visibility = _IsNew ? Visibility.Visible : Visibility.Collapsed; + + //var current = vmlist.CurrentVM; + + //if (!string.IsNullOrEmpty(current.Wohnname) && combobox_wohnungsname.Items.Contains(current.Wohnname)) + //{ + // combobox_wohnungsname.SelectedItem = current.Wohnname; + //} + //else + //{ + // combobox_wohnungsname.SelectedItem = null; + //} + } + + private void CustomerSelectionControl_ItemSelected(object sender, EventArgs e) + { + var oid = e.Data?.CustomerOid; + + ViewModel.CustomerOid = oid; + + btn_save.IsEnabled = oid is object; + } + } +} diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 335aba143..b81ae0017 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -310,14 +310,14 @@ - + - + - + @@ -327,7 +327,7 @@ - diff --git a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs index 821c8bc05..64169410c 100644 --- a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs +++ b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs @@ -4,6 +4,7 @@ using BS.Shared.Core; using BS.Shared.DataContracts.Compact; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -25,15 +26,22 @@ namespace BeWo.View.Controls /// public partial class WohneinheitBelegungEditPopup : Popup { + public static readonly DependencyProperty ViewModelProperty = + DependencyProperty.Register("ViewModel", typeof(WohneinheitBelegungVM), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); + public static readonly DependencyProperty WohneinheitenProperty = + DependencyProperty.Register("Wohneinheiten", typeof(BindingList), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); + public WohneinheitBelegungVM ViewModel { - get { return (WohneinheitBelegungVM)GetValue(VMProperty); } - set { SetValue(VMProperty, value); } + get { return (WohneinheitBelegungVM)GetValue(ViewModelProperty); } + set { SetValue(ViewModelProperty, value); } } - // Using a DependencyProperty as the backing store for VM. This enables animation, styling, binding, etc... - public static readonly DependencyProperty VMProperty = - DependencyProperty.Register("ViewModel", typeof(WohneinheitBelegungVM), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); + public BindingList Wohneinheiten + { + get { return (BindingList)GetValue(WohneinheitenProperty); } + set { SetValue(WohneinheitenProperty, value); } + } public WohneinheitBelegungEditPopup() { @@ -52,6 +60,13 @@ namespace BeWo.View.Controls private void Popup_Opened(object sender, EventArgs e) { + combobox_Wohneinheit.ItemsSource = Wohneinheiten; + combobox_Wohneinheit.SelectedItem = ViewModel.Wohneinheit; + + //var test = Wohneinheiten; + //var test2 = Wohneinheiten; + + //var test3 = combobox_Wohneinheit.Items; //var vmlist = ViewModel.WohneinheitListVM; //_IsNew = vmlist.EditVM is null; diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index b81ae0017..d6a829aa0 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -386,7 +386,7 @@ - diff --git a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs index 64169410c..03758ed27 100644 --- a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs +++ b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs @@ -26,15 +26,13 @@ namespace BeWo.View.Controls /// public partial class WohneinheitBelegungEditPopup : Popup { - public static readonly DependencyProperty ViewModelProperty = - DependencyProperty.Register("ViewModel", typeof(WohneinheitBelegungVM), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); public static readonly DependencyProperty WohneinheitenProperty = DependencyProperty.Register("Wohneinheiten", typeof(BindingList), typeof(WohneinheitBelegungEditPopup), new PropertyMetadata(null)); - public WohneinheitBelegungVM ViewModel + public WohneinheitListVM ViewModel { - get { return (WohneinheitBelegungVM)GetValue(ViewModelProperty); } - set { SetValue(ViewModelProperty, value); } + get { return DataContext as WohneinheitListVM; } + set { DataContext = value; } } public BindingList Wohneinheiten @@ -50,6 +48,10 @@ namespace BeWo.View.Controls private void Save_Button_Click(object sender, RoutedEventArgs e) { + ViewModel.WohneinheitBelegungListVM.AddNewVMToList(); + + ViewModel.WohneinheitBelegungListVM.CurrentVM = null; + IsOpen = false; } @@ -60,8 +62,6 @@ namespace BeWo.View.Controls private void Popup_Opened(object sender, EventArgs e) { - combobox_Wohneinheit.ItemsSource = Wohneinheiten; - combobox_Wohneinheit.SelectedItem = ViewModel.Wohneinheit; //var test = Wohneinheiten; //var test2 = Wohneinheiten; @@ -90,7 +90,7 @@ namespace BeWo.View.Controls { var oid = e.Data?.CustomerOid; - ViewModel.CustomerOid = oid; + ViewModel.WohneinheitBelegungListVM.CurrentVM.CustomerOid = oid; btn_save.IsEnabled = oid is object; } diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index d6a829aa0..e3f066b7e 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -6,12 +6,18 @@ xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:val="clr-namespace:BeWo.Validation" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" - xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" + xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" + xmlns:viewmodel="clr-namespace:BeWo.ViewModel" + + d:DataContext="{d:DesignInstance Type=viewmodel:WohnheimVM}" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" - VerticalAlignment="Stretch" Focusable="True" GotFocus="UserControl_GotFocus"> + VerticalAlignment="Stretch" Focusable="True" GotFocus="UserControl_GotFocus" > @@ -387,7 +393,7 @@ + diff --git a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs index 03758ed27..32293e53a 100644 --- a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs +++ b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs @@ -41,6 +41,8 @@ namespace BeWo.View.Controls set { SetValue(WohneinheitenProperty, value); } } + public bool AddMode { get; set; } + public WohneinheitBelegungEditPopup() { InitializeComponent(); @@ -50,40 +52,43 @@ namespace BeWo.View.Controls { ViewModel.WohneinheitBelegungListVM.AddNewVMToList(); - ViewModel.WohneinheitBelegungListVM.CurrentVM = null; - IsOpen = false; } private void Cancel_Button_Click(object sender, RoutedEventArgs e) { + ViewModel.WohneinheitBelegungListVM.CloseNewVM(); + IsOpen = false; } private void Popup_Opened(object sender, EventArgs e) { + var listvm = ViewModel.WohneinheitBelegungListVM; - //var test = Wohneinheiten; - //var test2 = Wohneinheiten; + AddMode = listvm.EditVM is null; - //var test3 = combobox_Wohneinheit.Items; - //var vmlist = ViewModel.WohneinheitListVM; + if (AddMode) + { + btn_cancel.Visibility = Visibility.Visible; + btn_save.Visibility = Visibility.Visible; + StaysOpen = true; + groupbox_newBelegung.Header = "Belegung erstellen"; - //_IsNew = vmlist.EditVM is null; - //groupbox_newWohneinheit.Header = _IsNew ? "Wohneinheit erstellen" : "Wohneinheit bearbeiten"; - //btn_cancel.Content = _IsNew ? "Abbrechen" : "Schließen"; - //btn_save.Visibility = _IsNew ? Visibility.Visible : Visibility.Collapsed; + customer_selection_control.SelectedItem = null; + } + else + { + btn_cancel.Visibility = Visibility.Collapsed; + btn_save.Visibility = Visibility.Collapsed; + StaysOpen = false; + groupbox_newBelegung.Header = "Belegung bearbeiten"; - //var current = vmlist.CurrentVM; - - //if (!string.IsNullOrEmpty(current.Wohnname) && combobox_wohnungsname.Items.Contains(current.Wohnname)) - //{ - // combobox_wohnungsname.SelectedItem = current.Wohnname; - //} - //else - //{ - // combobox_wohnungsname.SelectedItem = null; - //} + if (listvm.CurrentVM.CustomerOid.HasValue) + { + customer_selection_control.SetSelectedCustomerOid(listvm.CurrentVM.CustomerOid.Value); + } + } } private void CustomerSelectionControl_ItemSelected(object sender, EventArgs e) @@ -94,5 +99,30 @@ namespace BeWo.View.Controls btn_save.IsEnabled = oid is object; } + + private void root_Popup_Closed(object sender, EventArgs e) + { + var vmlist = ViewModel.WohneinheitBelegungListVM; + var currentvm = vmlist.CurrentVM; + + root_Popup.Focus(); + + if (currentvm is object) + { + if (AddMode) + { + vmlist.CloseNewVM(); + } + else + { + vmlist.CloseEditVM(); + } + } + } + + private void TextBox_LostFocus(object sender, RoutedEventArgs e) + { + + } } } diff --git a/BeWo/View/Controls/WohneinheitEditPopup.xaml b/BeWo/View/Controls/WohneinheitEditPopup.xaml index 3c93cdcb4..dd7cafaf4 100644 --- a/BeWo/View/Controls/WohneinheitEditPopup.xaml +++ b/BeWo/View/Controls/WohneinheitEditPopup.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:BeWo.View.Controls" mc:Ignorable="d" Width="500" - StaysOpen="True" Placement="MousePoint" Opened="Popup_Opened"> + StaysOpen="True" Placement="MousePoint" Opened="Popup_Opened" Closed="Popup_Closed"> @@ -32,31 +32,31 @@ + Text="{Binding Path=WohneinheitListVM.CurrentVM.Zimmername, UpdateSourceTrigger=PropertyChanged}" /> + EditValue="{Binding Path=WohneinheitListVM.CurrentVM.Baujahr, UpdateSourceTrigger=PropertyChanged}" Mask="0000"/> diff --git a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs index aba697a6c..c75120a5f 100644 --- a/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs +++ b/BeWo/View/Controls/WohneinheitBelegungEditPopup.xaml.cs @@ -96,8 +96,6 @@ namespace BeWo.View.Controls var customer = e.Data; ViewModel.WohneinheitBelegungListVM.CurrentVM.Customer = customer; - - btn_save.IsEnabled = customer is object; } private void root_Popup_Closed(object sender, EventArgs e) @@ -119,10 +117,5 @@ namespace BeWo.View.Controls } } } - - private void TextBox_LostFocus(object sender, RoutedEventArgs e) - { - - } } } diff --git a/BeWo/ViewModel/WohneinheitBelegungVM.cs b/BeWo/ViewModel/WohneinheitBelegungVM.cs index 802e92b34..07dd475a2 100644 --- a/BeWo/ViewModel/WohneinheitBelegungVM.cs +++ b/BeWo/ViewModel/WohneinheitBelegungVM.cs @@ -34,6 +34,9 @@ namespace BeWo.ViewModel public long? Oid => _Oid; + public bool CanSave + => Wohneinheit is object && Customer is object; + public WohneinheitVM Wohneinheit { get { return _Wohneinheit; } @@ -51,6 +54,7 @@ namespace BeWo.ViewModel _Wohneinheit.PropertyChanged += FirePropertyChanged; FirePropertyChanged(nameof(Wohneinheit)); + FirePropertyChanged(nameof(CanSave)); } } public CompactCustomerDC Customer @@ -63,6 +67,7 @@ namespace BeWo.ViewModel _Customer = value; FirePropertyChanged(nameof(Customer)); + FirePropertyChanged(nameof(CanSave)); } } public DateTime StartDate @@ -76,6 +81,11 @@ namespace BeWo.ViewModel _StartDate = value; StoreDirtyInformation(AreDifferent(DataContract.StartDate, value), nameof(StartDate)); FirePropertyChanged(nameof(StartDate)); + + if (EndDate.HasValue && EndDate.Value < StartDate) + { + EndDate = new DateTime(StartDate.Year, 12, 31); + } } } public DateTime? EndDate @@ -89,6 +99,11 @@ namespace BeWo.ViewModel _EndDate = value; StoreDirtyInformation(AreDifferent(DataContract.EndDate, value), nameof(EndDate)); FirePropertyChanged(nameof(EndDate)); + + if(value.HasValue && value.Value < StartDate) + { + StartDate = new DateTime(value.Value.Year, value.Value.Month, 1); + } } } public string Kommentar From f546b44bad66d173c25b4a1dbcde8bab5dad024c Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 6 Aug 2024 12:23:23 +0200 Subject: [PATCH 029/103] Renaming -> Wrong T Search prevented --- Shared/Core/EnumTranslations.cs | 38 +++++++++-------- TranslationUnitTest/EnumTranslation.cs | 28 ------------- TranslationUnitTest/EnumTranslationTest.cs | 41 +++++++++++++++++++ .../TranslationUnitTest.csproj | 2 +- 4 files changed, 62 insertions(+), 47 deletions(-) delete mode 100644 TranslationUnitTest/EnumTranslation.cs create mode 100644 TranslationUnitTest/EnumTranslationTest.cs diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index ac920a697..1e9edb2da 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -630,15 +630,17 @@ namespace BS.Shared.Core dict.Add(UserRightType.AccountingTransactionView_Delete, Translator.Translate("Finanzen löschen")); dict.Add(UserRightType.AccountingTransactionView_Edit, Translator.Translate("Finanzen ändern")); dict.Add(UserRightType.AccountingTransactionView_View, Translator.Translate("Finanzen ansehen (alle)")); + dict.Add(UserRightType.AdministrationView_Create, Translator.Translate("Verwaltung anlegen")); dict.Add(UserRightType.AdministrationView_Delete, Translator.Translate("Verwaltung löschen")); dict.Add(UserRightType.AdministrationView_Edit, Translator.Translate("Verwaltung ändern")); dict.Add(UserRightType.AdministrationView_View, Translator.Translate("Verwaltung ansehen")); + dict.Add(UserRightType.CustomerView_Create, Translator.Translate("Klienten") + " anlegen"); dict.Add(UserRightType.CustomerView_Delete, Translator.Translate("Klienten") + " löschen"); - dict.Add(UserRightType.Customer_AllowArchiving, Translator.Translate("Klienten") + " archivieren"); dict.Add(UserRightType.CustomerView_Edit, Translator.Translate("Klienten") + " ändern"); dict.Add(UserRightType.CustomerView_View, Translator.Translate("Klienten") + " ansehen (alle)"); + dict.Add(UserRightType.Customer_AllowArchiving, Translator.Translate("Klienten") + " archivieren"); dict.Add(UserRightType.Customer_ViewMyCustomers, Translator.Translate("Klienten") + " ansehen (von " + Translator.Translate("MitarbeiterSingular") + " betreut)"); dict.Add(UserRightType.Customer_ViewMyTeams, Translator.Translate("Klienten") + " ansehen (von Teams betreut)"); dict.Add(UserRightType.Customer_ViewMedication, Translator.Translate("Klienten") + " Medikation ansehen"); @@ -647,26 +649,10 @@ namespace BS.Shared.Core dict.Add(UserRightType.Customer_ViewNotizen, Translator.Translate("Klienten") + " Notizen ansehen"); dict.Add(UserRightType.Customer_EditNotizen, Translator.Translate("Klienten") + " Notizen bearbeiten"); dict.Add(UserRightType.Customer_DeleteNotizen, Translator.Translate("Klienten") + " Notizen löschen"); + dict.Add(UserRightType.DeleteAll, Translator.Translate("Alles löschen")); dict.Add(UserRightType.EmployeeView_Create, Translator.Translate("MitarbeiterSingular") + " anlegen"); dict.Add(UserRightType.EmployeeView_Delete, Translator.Translate("MitarbeiterSingular") + " löschen"); - - dict.Add(UserRightType.WohnheimView_Create, Translator.Translate("Wohnprojekte anlegen")); - dict.Add(UserRightType.WohnheimView_Delete, Translator.Translate("Wohnprojekte löschen")); - dict.Add(UserRightType.WohnheimView_Edit, Translator.Translate("Wohnprojekte bearbeiten")); - dict.Add(UserRightType.WohnheimView_View, Translator.Translate("Wohnprojekte ansehen")); - dict.Add(UserRightType.Wohnheim_AllowArchiving, Translator.Translate("Wohnprojekte archivieren")); - - dict.Add(UserRightType.WohnheimView_Wohneinheit_View, Translator.Translate("Wohnprojekte-> Wohneinheit ansehen")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Create, Translator.Translate("Wohnprojekte-> Wohneinheit anlegen")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Edit, Translator.Translate("Wohnprojekte-> Wohneinheit bearbeiten")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Delete, Translator.Translate("Wohnprojekte-> Wohneinheit löschen")); - - dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_View, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung ansehen")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Create, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung anlegen")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Edit, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung bearbeiten")); - dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Delete, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung löschen")); - dict.Add(UserRightType.EmployeeView_Edit, Translator.Translate("MitarbeiterSingular") + " ändern (alle)"); dict.Add(UserRightType.EmployeeView_View, Translator.Translate("MitarbeiterSingular") + " ansehen (alle)"); dict.Add(UserRightType.Employee_ShowFinance, Translator.Translate("MitarbeiterSingular") + " alle Daten bearbeiten"); @@ -678,12 +664,28 @@ namespace BS.Shared.Core dict.Add(UserRightType.Employee_ViewNotizen, Translator.Translate("MitarbeiterSingular") + " Notizen ansehen"); dict.Add(UserRightType.Employee_EditNotizen, Translator.Translate("MitarbeiterSingular") + " Notizen bearbeiten"); dict.Add(UserRightType.Employee_DeleteNotizen, Translator.Translate("MitarbeiterSingular") + " Notizen löschen"); + dict.Add(UserRightType.OrganisationView_Create, Translator.Translate("Organisationen anlegen")); dict.Add(UserRightType.OrganisationView_Delete, Translator.Translate("Organisationen löschen")); dict.Add(UserRightType.OrganisationView_Edit, Translator.Translate("Organisationen ändern")); dict.Add(UserRightType.OrganisationView_View, Translator.Translate("Organisationen ansehen")); dict.Add(UserRightType.Organisation_AllowArchiving, Translator.Translate("Organisationen archivieren")); dict.Add(UserRightType.OrganisationView_AllowEditCostBearer, Translator.Translate("Organisationen Kostenträgerdetails bearbeiten")); + + dict.Add(UserRightType.WohnheimView_Create, Translator.Translate("Wohnprojekte anlegen")); + dict.Add(UserRightType.WohnheimView_Delete, Translator.Translate("Wohnprojekte löschen")); + dict.Add(UserRightType.WohnheimView_Edit, Translator.Translate("Wohnprojekte bearbeiten")); + dict.Add(UserRightType.WohnheimView_View, Translator.Translate("Wohnprojekte ansehen")); + dict.Add(UserRightType.Wohnheim_AllowArchiving, Translator.Translate("Wohnprojekte archivieren")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_View, Translator.Translate("Wohnprojekte-> Wohneinheit ansehen")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Create, Translator.Translate("Wohnprojekte-> Wohneinheit anlegen")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Edit, Translator.Translate("Wohnprojekte-> Wohneinheit bearbeiten")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Delete, Translator.Translate("Wohnprojekte-> Wohneinheit löschen")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_View, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung ansehen")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Create, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung anlegen")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Edit, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung bearbeiten")); + dict.Add(UserRightType.WohnheimView_Wohneinheit_Belegung_Delete, Translator.Translate("Wohnprojekte-> Wohneinheitbelegung löschen")); + dict.Add(UserRightType.PersonView_Create, Translator.Translate("Personen anlegen")); dict.Add(UserRightType.PersonView_Delete, Translator.Translate("Personen löschen")); dict.Add(UserRightType.Person_AllowArchiving, Translator.Translate("Personen archivieren")); diff --git a/TranslationUnitTest/EnumTranslation.cs b/TranslationUnitTest/EnumTranslation.cs deleted file mode 100644 index a7cc93483..000000000 --- a/TranslationUnitTest/EnumTranslation.cs +++ /dev/null @@ -1,28 +0,0 @@ -using BS.Shared; -using BS.Shared.Core; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; - -namespace TranslationUnitTest -{ - [TestClass] - public class EnumTranslation - { - [TestInitialize] - public void Init() - { - - } - - [TestMethod] - public void UserRightType2TranslationsComplete() - { - var dict = EnumTranslations.UserRightType2Translations; - foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) - { - if (item != UserRightType.None && !dict.ContainsKey(item)) - Assert.Fail($"UserRight \"{item}\" hat keine Übersetzung in {nameof(EnumTranslations.UserRightType2Translations)}"); - } - } - } -} diff --git a/TranslationUnitTest/EnumTranslationTest.cs b/TranslationUnitTest/EnumTranslationTest.cs new file mode 100644 index 000000000..d3295c82c --- /dev/null +++ b/TranslationUnitTest/EnumTranslationTest.cs @@ -0,0 +1,41 @@ +using BS.Shared; +using BS.Shared.Core; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; + +namespace TranslationUnitTest +{ + [TestClass] + public class EnumTranslationTest + { + public Dictionary Dict { get; set; } + + [TestInitialize] + public void UserRightTypeCreation() + { + Dict = EnumTranslations.UserRightType2Translations; + + var values = new Dictionary(); + foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) + { + var value = (long)item; + + if (values.ContainsKey(value)) + Assert.Fail($"\"{item}\" und \"{values[value]}\" haben den gleichen Wert \"{value}\""); + + values.Add(value, item); + } + } + + [TestMethod] + public void UserRightType2TranslationsComplete() + { + foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) + { + if (item != UserRightType.None && !Dict.ContainsKey(item)) + Assert.Fail($"UserRight \"{item}\" hat keine Übersetzung in {nameof(EnumTranslations.UserRightType2Translations)}"); + } + } + } +} diff --git a/TranslationUnitTest/TranslationUnitTest.csproj b/TranslationUnitTest/TranslationUnitTest.csproj index fbe387df2..cd2306083 100644 --- a/TranslationUnitTest/TranslationUnitTest.csproj +++ b/TranslationUnitTest/TranslationUnitTest.csproj @@ -49,7 +49,7 @@ - + From 78c21655c52284f363ae8c9afcfbc0d56e0463d6 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 6 Aug 2024 13:34:23 +0200 Subject: [PATCH 030/103] Customer Falldaten Rechte: Ansicht + Editieren --- BeWo/View/Detail/CustomerFalldatenView.xaml | 101 ++++++++++++------ .../View/Detail/CustomerFalldatenView.xaml.cs | 37 +++++++ BeWo/View/Detail/CustomerView.xaml | 2 +- BeWo/ViewModel/CustomerFalldatenVM.cs | 3 + BeWo/ViewModel/CustomerVM.cs | 4 +- Shared/BeWoEntityEnums.cs | 3 + Shared/Core/EnumTranslations.cs | 2 + TranslationUnitTest/EnumTranslationTest.cs | 9 +- 8 files changed, 122 insertions(+), 39 deletions(-) diff --git a/BeWo/View/Detail/CustomerFalldatenView.xaml b/BeWo/View/Detail/CustomerFalldatenView.xaml index 2e09f309b..0d1908403 100644 --- a/BeWo/View/Detail/CustomerFalldatenView.xaml +++ b/BeWo/View/Detail/CustomerFalldatenView.xaml @@ -47,62 +47,77 @@ @@ -125,29 +140,41 @@ - + @@ -163,13 +190,17 @@ - + - + diff --git a/BeWo/ViewModel/CustomerFalldatenVM.cs b/BeWo/ViewModel/CustomerFalldatenVM.cs index 12039a498..6033e63e1 100644 --- a/BeWo/ViewModel/CustomerFalldatenVM.cs +++ b/BeWo/ViewModel/CustomerFalldatenVM.cs @@ -50,6 +50,9 @@ namespace BeWo.ViewModel } + public bool PermissionFalldatenEdit { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Falldaten_Edit); + public bool NoPermissionFalldatenEdit => !PermissionFalldatenEdit; + public string EigenesAktenzeichen { get { return _EigenesAktenzeichen; } diff --git a/BeWo/ViewModel/CustomerVM.cs b/BeWo/ViewModel/CustomerVM.cs index 3e5d6b25b..adb39af53 100644 --- a/BeWo/ViewModel/CustomerVM.cs +++ b/BeWo/ViewModel/CustomerVM.cs @@ -296,7 +296,9 @@ namespace BeWo.ViewModel Arbeitszeiten = new ArbeitszeitListVM(DataContract.Arbeitszeiten); } - public ArbeitszeitListVM Arbeitszeiten + public bool PermissionFalldatenView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Falldaten_View); + + public ArbeitszeitListVM Arbeitszeiten { get => _Arbeitszeiten; diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index 11b26426c..f562cc577 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -512,6 +512,9 @@ namespace BS.Shared Customer_EditNotizen = 22111, Customer_DeleteNotizen = 22112, + Customer_Falldaten_View = 22120, + Customer_Falldaten_Edit = 22121, + WohnheimView_View = 22201, WohnheimView_Edit = 22202, WohnheimView_Create = 22203, diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 1e9edb2da..6926916c5 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -649,6 +649,8 @@ namespace BS.Shared.Core dict.Add(UserRightType.Customer_ViewNotizen, Translator.Translate("Klienten") + " Notizen ansehen"); dict.Add(UserRightType.Customer_EditNotizen, Translator.Translate("Klienten") + " Notizen bearbeiten"); dict.Add(UserRightType.Customer_DeleteNotizen, Translator.Translate("Klienten") + " Notizen löschen"); + dict.Add(UserRightType.Customer_Falldaten_View, Translator.Translate("Klienten") + " Falldaten ansehen"); + dict.Add(UserRightType.Customer_Falldaten_Edit, Translator.Translate("Klienten") + " Falldaten bearbeiten"); dict.Add(UserRightType.DeleteAll, Translator.Translate("Alles löschen")); dict.Add(UserRightType.EmployeeView_Create, Translator.Translate("MitarbeiterSingular") + " anlegen"); diff --git a/TranslationUnitTest/EnumTranslationTest.cs b/TranslationUnitTest/EnumTranslationTest.cs index d3295c82c..bca3e9a0a 100644 --- a/TranslationUnitTest/EnumTranslationTest.cs +++ b/TranslationUnitTest/EnumTranslationTest.cs @@ -12,10 +12,15 @@ namespace TranslationUnitTest public Dictionary Dict { get; set; } [TestInitialize] - public void UserRightTypeCreation() + public void Init() { Dict = EnumTranslations.UserRightType2Translations; + } + + [TestMethod] + public void DictionaryCreation() + { var values = new Dictionary(); foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) { @@ -29,7 +34,7 @@ namespace TranslationUnitTest } [TestMethod] - public void UserRightType2TranslationsComplete() + public void DictionaryComplete() { foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) { From 38b8ae453424b2de498806761703f8c7ea6749b2 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 6 Aug 2024 15:06:23 +0200 Subject: [PATCH 031/103] Base Schedular --- BeWo/View/Detail/WohnheimView.xaml | 24 +++++++++++++++++++++++- BeWo/ViewModel/WohnheimVM.cs | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 026422c03..053f25780 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:uvc="clr-namespace:BeWo.View.Controls" + xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" @@ -16,6 +17,7 @@ xmlns:viewmodel="clr-namespace:BeWo.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:WohnheimVM, IsDesignTimeCreatable=true}" + d:DesignHeight="800" d:DesignWidth="1400" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True" GotFocus="UserControl_GotFocus" > @@ -417,7 +419,7 @@ - + @@ -428,6 +430,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index 6648daaa8..8de690d96 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -101,7 +101,9 @@ namespace BeWo.ViewModel public bool PermissionWohneinheitBelegungCreate { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_Belegung_Create); public bool PermissionWohneinheitBelegungEdit { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_Belegung_Edit); public bool PermissionWohneinheitBelegungDelete { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_Belegung_Delete); - + + public bool Permission1 { get; } = true; + public bool IsArchived { get { return _IsArchived; } From 2ff177298f59d88ad51757e34b9b095716eb8eec Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 6 Aug 2024 15:37:45 +0200 Subject: [PATCH 032/103] Experimente --- BeWo/View/Detail/WohnheimView.xaml | 49 +++++++++++++++++++++++++-- BeWo/View/Detail/WohnheimView.xaml.cs | 5 +++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 053f25780..a5d526cc1 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -3,7 +3,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:uvc="clr-namespace:BeWo.View.Controls" + xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler" + xmlns:XtraScheduler="clr-namespace:DevExpress.XtraScheduler;assembly=DevExpress.XtraScheduler.v23.2.Core" + xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" @@ -443,8 +446,50 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 4c6d1b595..6262d64fb 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -565,5 +565,10 @@ namespace BeWo.View.Detail popup_newBelegung.IsOpen = true; } + + private void SchedulerControl_PopupMenuShowing(object sender, DevExpress.Xpf.Scheduler.SchedulerMenuEventArgs e) + { + e.Handled = true; + } } } \ No newline at end of file From 0fd7946841dc5f6770b5f8d103f5b4f4c2dd5030 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 7 Aug 2024 15:21:59 +0200 Subject: [PATCH 033/103] =?UTF-8?q?UserRightHelper=20Erg=C3=A4nzung=20+=20?= =?UTF-8?q?UnitTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWoApp.xaml.cs | 4 +- Data/Security/UserRightHelper.cs | 58 +++-- Shared/Core/EnumTranslations.cs | 9 +- TranslationUnitTest/EnumTranslationTest.cs | 239 +++++++++++++++++- .../TranslationUnitTest.csproj | 4 + 5 files changed, 291 insertions(+), 23 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 50bd7b37d..30aec748f 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -49,8 +49,8 @@ namespace BeWo public static LoginControl LoginControl; public static MainControl MainControl; - public static string ShortVersion = "3.21"; - public static string Version = "Version 3.21.3 (GKV Test)"; + public static string ShortVersion = "3.22"; + public static string Version = "Version 3.22.3 (GKV Test)"; public static int RenderTier = 0; diff --git a/Data/Security/UserRightHelper.cs b/Data/Security/UserRightHelper.cs index 76675b11e..322adc57c 100644 --- a/Data/Security/UserRightHelper.cs +++ b/Data/Security/UserRightHelper.cs @@ -12,22 +12,25 @@ namespace BeWo.Data.Security { public class UserRightHelper { - public static ApplicationUser GetLoggedInUser() - { + public static readonly string BASE_VERSION = "1.0"; - if (LoggedInUserOperationContextExt.Current != null && - LoggedInUserOperationContextExt.Current.User != null) - { - return LoggedInUserOperationContextExt.Current.User; - } - else - { - return SessionFacade.LoggedInUser; - } + public static ApplicationUser GetLoggedInUser() + { + return LoggedInUserOperationContextExt.Current?.User ?? SessionFacade.LoggedInUser; + + //if (LoggedInUserOperationContextExt.Current != null && + // LoggedInUserOperationContextExt.Current.User != null) + //{ + // return LoggedInUserOperationContextExt.Current.User; + //} + //else + //{ + // return SessionFacade.LoggedInUser; + //} - return null; - } + //return null; + } public static bool LoggedInUserHasRight(UserRightType right) { @@ -102,14 +105,14 @@ namespace BeWo.Data.Security var version = GetBeWoVersion(GetLoggedInUser().LoginName); CheckRightVersion(version, groupDC); } - + public static void CheckRightVersion(String version, UserDC userDC) - { + { foreach (var ug in userDC.UserGroups) { CheckRightVersion(version, ug); } - + } public static void CheckRightVersion(String version, UserGroupDC ug) @@ -123,7 +126,7 @@ namespace BeWo.Data.Security ug.Rights.Add(r); } } - + } public static bool IsCorrectVersion(UserRightType r, string version) @@ -155,7 +158,26 @@ namespace BeWo.Data.Security { return "3.21"; } - return "1.0"; + + var rights_3_22 = new List { + UserRightType.WohnheimView_Wohneinheit_Belegung_Create, + UserRightType.WohnheimView_Wohneinheit_Belegung_Delete, + UserRightType.WohnheimView_Wohneinheit_Belegung_Edit, + UserRightType.WohnheimView_Wohneinheit_Belegung_View, + UserRightType.WohnheimView_Wohneinheit_Create, + UserRightType.WohnheimView_Wohneinheit_Delete, + UserRightType.WohnheimView_Wohneinheit_Edit, + UserRightType.WohnheimView_Wohneinheit_View, + UserRightType.Customer_Falldaten_Edit, + UserRightType.Customer_Falldaten_View + }; + + if (rights_3_22.Contains(r)) + { + return "3.22"; + } + + return BASE_VERSION; } } } diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 6926916c5..0244fba0c 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -626,6 +626,8 @@ namespace BS.Shared.Core { var dict = new Dictionary(); + dict.Add(UserRightType.CreateAll, Translator.Translate("Alles anlegen")); + dict.Add(UserRightType.AccountingTransactionView_Create, Translator.Translate("Finanzen anlegen")); dict.Add(UserRightType.AccountingTransactionView_Delete, Translator.Translate("Finanzen löschen")); dict.Add(UserRightType.AccountingTransactionView_Edit, Translator.Translate("Finanzen ändern")); @@ -694,16 +696,19 @@ namespace BS.Shared.Core dict.Add(UserRightType.PersonView_Edit, Translator.Translate("Personen ändern")); dict.Add(UserRightType.PersonView_View, Translator.Translate("Personen ansehen")); dict.Add(UserRightType.Person_FamilyView, Translator.Translate("Personen Familienangehörige ansehen")); + dict.Add(UserRightType.GroupOfPeopleView_Edit, Translator.Translate("Gruppen bearbeiten")); dict.Add(UserRightType.GroupOfPeopleView_Create, Translator.Translate("Gruppen anlegen")); dict.Add(UserRightType.GroupOfPeopleView_Delete, Translator.Translate("Gruppen löschen")); dict.Add(UserRightType.AdditionalService_View, Translator.Translate("Ergänzende Dienste ansehen")); dict.Add(UserRightType.AdditionalService_Edit, Translator.Translate("Ergänzende Dienste bearbeiten")); dict.Add(UserRightType.OvertimeView, Translator.Translate("Überstundenverwaltung")); + dict.Add(UserRightType.QueryView_Create, Translator.Translate("Auswertungen anlegen")); dict.Add(UserRightType.QueryView_Delete, Translator.Translate("Auswertungen löschen")); dict.Add(UserRightType.QueryView_Edit, Translator.Translate("Auswertungen ändern")); dict.Add(UserRightType.QueryView_View, Translator.Translate("Auswertungen ansehen (Berichte, Stundenübersicht, Hilfeplanübersicht)")); + dict.Add(UserRightType.Analysis_Settlement_View, Translator.Translate("Finanzen Spitzabrechnung erstellen")); dict.Add(UserRightType.Analysis_EmployeeOverviewAll_View, "Auswertungen für alle " + Translator.Translate("MitarbeiterPlural") + " erstellen"); dict.Add(UserRightType.Analysis_ServiceOverview_View, Translator.Translate("Auswertungen->Quittierungsbelege")); @@ -714,18 +719,20 @@ namespace BS.Shared.Core dict.Add(UserRightType.Analysis_Auslastung_View, "Auswertungen->" + Translator.Translate("MitarbeiterPlural") + "auslastung"); dict.Add(UserRightType.Analysis_AuslastungAllEmployee_View, "Auswertungen->" + Translator.Translate("MitarbeiterPlural") + "auslastung für alle " + Translator.Translate("MitarbeiterPlural")); dict.Add(UserRightType.Analysis_AuslastungTeam_View, "Auswertungen->" + Translator.Translate("MitarbeiterPlural") + "auslastung für alle Teams"); + dict.Add(UserRightType.Kilometerauswertung_View, "Auswertungen->Kilometerauswertung (für alle " + Translator.Translate("MitarbeiterPlural") + ")"); dict.Add(UserRightType.KilometerauswertungEigene_View, Translator.Translate("Auswertungen->Kilometerauswertung (nur eigene)")); dict.Add(UserRightType.BewertungAuswertung_View, Translator.Translate("Auswertungen->Bewertung")); dict.Add(UserRightType.PivotTabelleAnsehen, Translator.Translate("Auswertungen->Pivot Tabelle")); dict.Add(UserRightType.DienstplanungAnsehen, Translator.Translate("Auswertungen->Dienstplanung")); dict.Add(UserRightType.AbwesenheitsPlanungAnsehen, Translator.Translate("Auswertungen->Urlaubsplanung")); + dict.Add(UserRightType.ResourceBookingView_Create, Translator.Translate("Ressourcen anlegen")); dict.Add(UserRightType.ResourceBookingView_Delete, Translator.Translate("Ressourcen löschen")); dict.Add(UserRightType.ResourceBookingView_Edit, Translator.Translate("Ressourcen ändern")); dict.Add(UserRightType.ResourceBookingView_View, Translator.Translate("Ressourcen ansehen")); dict.Add(UserRightType.ResourceBookingView_AllowEditResourcesFromOtherEmployees, "Ressourcen anderer " + Translator.Translate("MitarbeiterPlural") + " ändern"); - dict.Add(UserRightType.CreateAll, Translator.Translate("Alles anlegen")); + dict.Add(UserRightType.ServiceRecordView_Create, Translator.Translate("Zeiterfassung anlegen")); dict.Add(UserRightType.ServiceRecordView_Delete, Translator.Translate("Zeiterfassung löschen")); dict.Add(UserRightType.ServiceRecordView_Edit, Translator.Translate("Zeiterfassung ändern")); diff --git a/TranslationUnitTest/EnumTranslationTest.cs b/TranslationUnitTest/EnumTranslationTest.cs index bca3e9a0a..742d60131 100644 --- a/TranslationUnitTest/EnumTranslationTest.cs +++ b/TranslationUnitTest/EnumTranslationTest.cs @@ -1,4 +1,5 @@ -using BS.Shared; +using BeWo.Data.Security; +using BS.Shared; using BS.Shared.Core; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; @@ -10,13 +11,228 @@ namespace TranslationUnitTest public class EnumTranslationTest { public Dictionary Dict { get; set; } + public List UserRightTypesVersion1dot0 { get; set; } [TestInitialize] public void Init() { Dict = EnumTranslations.UserRightType2Translations; - } + UserRightTypesVersion1dot0 = new List() { + UserRightType.None, + UserRightType.DeleteAll, + UserRightType.CreateAll, + UserRightType.EditAll, + UserRightType.ViewAll, + UserRightType.ServiceRecordView_View, +UserRightType.ServiceRecordView_Edit, +UserRightType.ServiceRecordView_Create, +UserRightType.ServiceRecordView_Delete, +UserRightType.AccountingTransactionView_View, +UserRightType.AccountingTransactionView_Edit, +UserRightType.AccountingTransactionView_Create, +UserRightType.AccountingTransactionView_Delete, +UserRightType.ResourceBookingView_View, +UserRightType.ResourceBookingView_Edit, +UserRightType.ResourceBookingView_Create, +UserRightType.ResourceBookingView_Delete, +UserRightType.QueryView_View, +UserRightType.QueryView_Edit, +UserRightType.QueryView_Create, +UserRightType.QueryView_Delete, +UserRightType.SupportConceptView_View, +UserRightType.SupportConceptView_Edit, +UserRightType.SupportConceptView_Create, +UserRightType.SupportConceptView_Delete, +UserRightType.CustomerView_View, +UserRightType.CustomerView_Edit, +UserRightType.CustomerView_Create, +UserRightType.CustomerView_Delete, +UserRightType.OrganisationView_View, +UserRightType.OrganisationView_Edit, +UserRightType.OrganisationView_Create, +UserRightType.OrganisationView_Delete, +UserRightType.PersonView_View, +UserRightType.PersonView_Edit, +UserRightType.PersonView_Create, +UserRightType.PersonView_Delete, +UserRightType.EmployeeView_View, +UserRightType.EmployeeView_Edit, +UserRightType.EmployeeView_Create, +UserRightType.EmployeeView_Delete, +UserRightType.TeamView_ViewAll, +UserRightType.TeamView_Edit, +UserRightType.TeamView_Create, +UserRightType.TeamView_Delete, +UserRightType.UserView_View, +UserRightType.UserView_Edit, +UserRightType.UserView_Create, +UserRightType.UserView_Delete, +UserRightType.UserGroupView_View, +UserRightType.UserGroupView_Edit, +UserRightType.UserGroupView_Create, +UserRightType.UserGroupView_Delete, +UserRightType.AdministrationView_View, +UserRightType.AdministrationView_Edit, +UserRightType.AdministrationView_Create, +UserRightType.AdministrationView_Delete, +UserRightType.Employee_ShowFinance, +UserRightType.Analysis_Settlement_View, +UserRightType.Analysis_EmployeeOverviewAll_View, +UserRightType.Analysis_ServiceOverview_View, +UserRightType.Analysis_SupportConceptOverviewAll_View, +UserRightType.UserView_AllowChangePassword, +UserRightType.OrganisationView_AllowEditCostBearer, +UserRightType.ServiceRecord_AllowChangeWithin24Hours, +UserRightType.ServiceRecord_AllowCreateServiceRecordsForAllClients, +UserRightType.SupportConcept_ViewAllSupportConcepts, +UserRightType.SupportConcept_AllowGoalOrientedSupportConcepts, +UserRightType.Customer_ViewMyCustomers, +UserRightType.Analysis_AllowFLSOverviewForCostbearer, +UserRightType.SupportConceptView_AllowArchiving, +UserRightType.Person_AllowArchiving, +UserRightType.Customer_AllowArchiving, +UserRightType.ServiceRecord_AllowCreationForOtherEmployees, +UserRightType.ResourceBookingView_AllowEditResourcesFromOtherEmployees, +UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth, +UserRightType.AssessmentSheet_View, +UserRightType.AssessmentSheet_Edit, +UserRightType.AssessmentSheet_Create, +UserRightType.AssessmentSheet_Delete, +UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved, +UserRightType.Analysis_AuslastungAllEmployee_View, +UserRightType.Analysis_AuslastungTeam_View, +UserRightType.Analysis_Auslastung_View, +UserRightType.Analysis_AllowFLSOverviewForTeam, +UserRightType.Analysis_AllowFLSOverviewForAllTeams, +UserRightType.ServiceRecord_AllowCreateOverlappingFLS, +UserRightType.ServiceRecord_AllowCreationForOtherTeamMember, +UserRightType.BookServiceRecordOutOfSupportConcept, +UserRightType.BookServiceRecordAfterSettlementInvoice, +UserRightType.Organisation_AllowArchiving, +UserRightType.ServiceRecord_ShowHistory, +UserRightType.ServiceRecord_AllowCreateOverlappingFLSForEmployee, +UserRightType.ServiceRecord_AllowCreatingGroupBooking, +UserRightType.ServiceRecord_AllowCreatingMultiBooking, +UserRightType.TeamView_ViewMyTeams, +UserRightType.Customer_ViewMyTeams, +UserRightType.SupportConcept_ViewMyTeams, +UserRightType.Employee_AllowEditExtendedProperties, +UserRightType.Employee_AllowEditContracts, +UserRightType.Employee_AllowEditOwnEmployees, +UserRightType.Employee_AllowArchiving, +UserRightType.User_AllowOrderLicense, +UserRightType.Employee_AllowViewOwnEmployees, +UserRightType.Employee_AllowViewOwnTeam, +UserRightType.Employee_ViewNotizen, +UserRightType.Employee_EditNotizen, +UserRightType.Employee_DeleteNotizen, +UserRightType.GroupOfPeopleView_Edit, +UserRightType.GroupOfPeopleView_Create, +UserRightType.GroupOfPeopleView_Delete, +UserRightType.AdditionalService_View, +UserRightType.OvertimeView, +UserRightType.Mitarbeiterstundenkonto_ViewSelf, +UserRightType.Mitarbeiterstundenkonto_ViewAll, +UserRightType.Mitarbeiterstundenkonto_ViewTeams, +UserRightType.Auswertungen_BerichteAnsehen, +UserRightType.Auswertungen_StundenuebersichtAnsehen, +UserRightType.Auswertungen_HilfeplanuebersichtAnsehen, +UserRightType.Support_View, +UserRightType.SupportConcept_AllowEditGoals, +UserRightType.SupportConcept_AllowEditTasks, +UserRightType.ServiceRecord_AllowEditForOtherEmployees, +UserRightType.KalenderAnsehen, +UserRightType.KalenderMitarbeitertermineAnsehen, +UserRightType.KalenderMitarbeitertermineAnlegen, +UserRightType.KalenderMitarbeitertermineAendern, +UserRightType.KalenderKliententermineAlleAnsehen, +UserRightType.KalenderKliententermineAnlegen, +UserRightType.KalenderKliententermineAendern, +UserRightType.KalenderRessourcentermineAnsehen, +UserRightType.KalenderRessourcentermineAnlegen, +UserRightType.KalenderRessourcentermineAendern, +UserRightType.KalenderRessourcentermineAndererAendern, +UserRightType.KalenderInZeiterfassungUebernehmen, +UserRightType.AllowChangeOwnPassword, +UserRightType.TextbausteineAlleAnsehen, +UserRightType.TextbausteineNurEigeneAnsehen, +UserRightType.TextbausteineAlleBearbeiten, +UserRightType.TextbausteineNurEigeneBearbeiten, +UserRightType.BargeldverwaltungAnsehen, +UserRightType.BargeldverwaltungNurEigeneAnsehen, +UserRightType.BargeldverwaltungBearbeiten, +UserRightType.BargeldverwaltungAnlegen, +UserRightType.BargeldverwaltungLoeschen, +UserRightType.SupportConceptAllowReactivation, +UserRightType.CustomerAllowReactivation, +UserRightType.OrganisationAllowReactivation, +UserRightType.PersonAllowReactivation, +UserRightType.EmployeeAllowReactivation, +UserRightType.ServiceRecordAllowRebooking, +UserRightType.CostbearerAllowChange, +UserRightType.ServiceRecordAllowEditAfterMindays, +UserRightType.DocumentsAllowViewAll, +UserRightType.DocumentsDownloadAll, +UserRightType.DocumentsEditFolders, +UserRightType.DocumentsUploadAll, +UserRightType.DocumentsDeleteAll, +UserRightType.Customer_ViewMedication, +UserRightType.Customer_ViewDiagnosis, +UserRightType.Customer_ViewNotizen, +UserRightType.Customer_EditNotizen, +UserRightType.Customer_DeleteNotizen, +UserRightType.WohnheimView_View, +UserRightType.WohnheimView_Edit, +UserRightType.WohnheimView_Create, +UserRightType.WohnheimView_Delete, +UserRightType.Wohnheim_AllowArchiving, +UserRightType.Betreuungsschluessel_View, +UserRightType.Betreuungsschluessel_Edit, +UserRightType.Betreuungsschluessel_Delete, +UserRightType.Betreuungsschluessel_Create, +UserRightType.Jahresbericht, +UserRightType.DokumenteFinanzen, +UserRightType.DokumenteKlienten, +UserRightType.DokumenteMitarbeiter, +UserRightType.DokumenteOrganisationen, +UserRightType.DokumentePersonen, +UserRightType.DokumenteHilfeplaene, +UserRightType.DokumenteTeams, +UserRightType.BargeldverwaltungFinanzenAnsehen, +UserRightType.BargeldverwaltungFinanzenAnlegen, +UserRightType.BargeldverwaltungFinanzenBearbeiten, +UserRightType.BargeldverwaltungFinanzenLoeschen, +UserRightType.ChatSettings, +UserRightType.ChatAdminSettings, +UserRightType.Kilometerauswertung_View, +UserRightType.BewertungAuswertung_View, +UserRightType.BewertenInZeiterfassung, +UserRightType.PivotTabelleAnsehen, +UserRightType.DienstplanungAnsehen, +UserRightType.AbwesenheitsPlanungAnsehen, +UserRightType.KilometerauswertungEigene_View, +UserRightType.VertretungenView_View, +UserRightType.CustomerTeam_View, +UserRightType.CustomerTeam_Edit, +UserRightType.CustomerTeam_Delete, +UserRightType.CustomerTeam_Create, +UserRightType.Person_FamilyView, +UserRightType.Customer_Anonymization, +UserRightType.Customer_Full_Delete, +UserRightType.Person_Full_Delete, +UserRightType.Employee_Full_Delete, +UserRightType.Employee_Anonymization, +UserRightType.Termine_IntervalDelete, +UserRightType.ServiceRecord_AllowCreateAfterEmployeeSignature, +UserRightType.ServiceRecord_AllowEditAfterEmployeeSignature, +UserRightType.ServiceRecord_AllowDeleteAfterEmployeeSignature, +UserRightType.ConfirmationReceiptSignatures_Delete, +UserRightType.Signature_ProvideSingleSignature, +UserRightType.Signature_ProvideMonthlySignature, +UserRightType.Signature_ProvideMonthlySignatureByProxy, + }; + } [TestMethod] public void DictionaryCreation() @@ -42,5 +258,24 @@ namespace TranslationUnitTest Assert.Fail($"UserRight \"{item}\" hat keine Übersetzung in {nameof(EnumTranslations.UserRightType2Translations)}"); } } + + [TestMethod] + public void UserRightHelperComplete() + { + foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) + { + var has_base_version = UserRightHelper.GetRightVersion(item) == UserRightHelper.BASE_VERSION; + + if (!has_base_version) + continue; + + var is_base_version = UserRightTypesVersion1dot0.Contains(item); + + if (is_base_version) + continue; + + Assert.Fail($"UserRight \"{item}\" hat keine Versionierung in {nameof(UserRightHelper.GetRightVersion)} ({nameof(UserRightHelper)})"); + } + } } } diff --git a/TranslationUnitTest/TranslationUnitTest.csproj b/TranslationUnitTest/TranslationUnitTest.csproj index cd2306083..2512f3ca2 100644 --- a/TranslationUnitTest/TranslationUnitTest.csproj +++ b/TranslationUnitTest/TranslationUnitTest.csproj @@ -56,6 +56,10 @@ + + {B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE} + Data + {2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4} Shared From 482d74ad54681cba138cf4efb9d95b5101822cf6 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 9 Aug 2024 13:07:44 +0200 Subject: [PATCH 034/103] DevExpress Designer Nullpointer Exception wenn andere TimeScales verwendet werden --- .../Detail/Report/AbwesenheitsView.xaml.cs | 1 - BeWo/View/Detail/WohnheimView.xaml | 98 +++--- BeWo/View/Detail/WohnheimView.xaml.cs | 294 +++++++++++------- TranslationUnitTest/EnumTranslationTest.cs | 4 +- 4 files changed, 236 insertions(+), 161 deletions(-) diff --git a/BeWo/View/Detail/Report/AbwesenheitsView.xaml.cs b/BeWo/View/Detail/Report/AbwesenheitsView.xaml.cs index c56245c66..553c353d3 100644 --- a/BeWo/View/Detail/Report/AbwesenheitsView.xaml.cs +++ b/BeWo/View/Detail/Report/AbwesenheitsView.xaml.cs @@ -484,7 +484,6 @@ namespace BeWo.View.Detail.Report } } - linkPdfExport.NavigateUri = new Uri(url); } diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index a5d526cc1..337612310 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -4,8 +4,7 @@ xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:uvc="clr-namespace:BeWo.View.Controls" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" - xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler" - xmlns:XtraScheduler="clr-namespace:DevExpress.XtraScheduler;assembly=DevExpress.XtraScheduler.v23.2.Core" + xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduling" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" @@ -23,6 +22,21 @@ d:DesignHeight="800" d:DesignWidth="1400" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True" GotFocus="UserControl_GotFocus" > + + + + + + @@ -445,51 +459,43 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 6262d64fb..195e15c86 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.ServiceModel; using System.Text.RegularExpressions; using System.Windows; @@ -18,25 +19,30 @@ using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using BS.Shared.Translation; +using DevExpress.Mvvm; using DevExpress.Xpf.Core; using DevExpress.Xpf.Editors; using DevExpress.Xpf.Grid; +using DevExpress.Xpf.Scheduling; using DevExpress.XtraGrid.Views.Grid; +using DevExpress.XtraScheduler.Native; namespace BeWo.View.Detail { - public partial class WohnheimView : BeWoView - { - private WohnheimVM _ViewModel; + public partial class WohnheimView : BeWoView + { + private WohnheimVM _ViewModel; - private bool initTabIndex; + private bool initTabIndex; private List regelmaessigeDiensteVonMitarbeiternLoeschen; private CompactTeamDC gewaehltesTeam; public WohnheimView(WohnheimVM vm) - { - InitializeComponent(); - ViewModel = vm; + { + SchedulerControl.AllowInfiniteSize = true; + + InitializeComponent(); + ViewModel = vm; vm.WohneinheitListVM.PropertyChanged += (s, e) => datagridview.BestFitColumns(); vm.WohneinheitListVM.WohneinheitBelegungListVM.PropertyChanged += (s, e) => datagridview2.BestFitColumns(); @@ -45,20 +51,20 @@ namespace BeWo.View.Detail // HACK: Force the devexpress grid to end editing when the mouse is over savebutton // by setting the focus to another element. MouseMove += (s, e) => - { - if ((grid_EmployeeRelation == null || !grid_EmployeeRelation.IsVisible) && + { + if ((grid_EmployeeRelation == null || !grid_EmployeeRelation.IsVisible) && (grid_CustomerRelation == null || !grid_CustomerRelation.IsVisible)) - { - return; - } + { + return; + } - var p = e.GetPosition(btnSave); + var p = e.GetPosition(btnSave); - if (p.X >= 0 && p.X < btnSave.ActualWidth && p.Y >= 0 && p.Y < btnSave.ActualHeight) - { - root.Focus(); - } - }; + if (p.X >= 0 && p.X < btnSave.ActualWidth && p.Y >= 0 && p.Y < btnSave.ActualHeight) + { + root.Focus(); + } + }; var b = Convert.ToBoolean(ViewModel.PflichtbesetzungEinblenden); if (!b) @@ -81,6 +87,7 @@ namespace BeWo.View.Detail //popup_newBelegung.Wohneinheiten = ViewModel.WohneinheitListVM.VMList; InitUserRights(); + InitScheduler(); } private void UserControl_GotFocus(object sender, RoutedEventArgs e) @@ -91,59 +98,61 @@ namespace BeWo.View.Detail } } - public override bool IsDirty - { - get { return ViewModel != null && ViewModel.IsDirty; } - } + public override bool IsDirty + { + get { return ViewModel != null && ViewModel.IsDirty; } + } - public override string Title - { - get { return Translator.Translate("Wohnprojekt"); } - } + public override string Title + { + get { return Translator.Translate("Wohnprojekt"); } + } - internal override DependencyObject ValidationOnSaveRootElement - { - get { return grid_details; } - } + internal override DependencyObject ValidationOnSaveRootElement + { + get { return grid_details; } + } - internal WohnheimVM ViewModel - { - get { return _ViewModel; } + internal WohnheimVM ViewModel + { + get { return _ViewModel; } - set - { + set + { _ViewModel = value; DataContext = value; - } - } + } + } - protected override UserRightType[] GetSaveDemands() - { - return ViewModel.IsNew ? new[] {UserRightType.CreateAll, UserRightType.WohnheimView_Create} : new[] {UserRightType.EditAll, UserRightType.WohnheimView_Edit}; - } + protected override UserRightType[] GetSaveDemands() + { + return ViewModel.IsNew ? new[] { UserRightType.CreateAll, UserRightType.WohnheimView_Create } : new[] { UserRightType.EditAll, UserRightType.WohnheimView_Edit }; + } - protected override void Save() - { - var lDataContract = ViewModel.CommitToDataContract(); + protected override void Save() + { + var lDataContract = ViewModel.CommitToDataContract(); //Abfrage if Name is null or empty -> Message Bitte den Namen eingeben - if(textbox_first.Text.Equals("")){ - textbox_first.Focus(); + if (textbox_first.Text.Equals("")) + { + textbox_first.Focus(); MessageBox.Show("Bitte dem Wohnprojekt einen Namen geben."); } - else{ - //sonst - try - { - if (ViewModel.IsNew) - { - IsDoneWithInsertOrUpdate = false; + else + { + //sonst + try + { + if (ViewModel.IsNew) + { + IsDoneWithInsertOrUpdate = false; ServiceFacade.DoCustomerServiceAsync(s => s.InsertNewWohnheim(lDataContract), ReloadViewModel); - } - else - { - IsDoneWithInsertOrUpdate = false; + } + else + { + IsDoneWithInsertOrUpdate = false; ServiceFacade.DoCustomerServiceAsync(s => s.UpdateWohnheim(lDataContract, regelmaessigeDiensteVonMitarbeiternLoeschen), ReloadViewModel); } //if (regelmaessigeDiensteVonMitarbeiternLoeschen.Count > 0 && ViewModel.DataContract.WohnheimOid != null) @@ -151,17 +160,17 @@ namespace BeWo.View.Detail // ServiceFacade.DoOperationsServiceSync(s => s.DeleteRegelmaessigeDiensteOfRemovedEmployee(regelmaessigeDiensteVonMitarbeiternLoeschen, (long)ViewModel.DataContract.WohnheimOid)); //} - Cache.GetInstance().ClearEmployees(); - BeWoApp.MainControl.ResetView(UIContext.Wohnheim); - } - catch (FaultException) - { - MessageBox.Show( - "Dieser Datensatz wurde in der Zwischenzeit von " + Translator.Translate("einem anderen Benutzer") + " geändert. Klicken Sie Ok um den Datensatz erneut zu laden. Ihre Änderungen gehen dabei leider verloren."); - ReloadViewModel(lDataContract.WohnheimOid.Value); - } + Cache.GetInstance().ClearEmployees(); + BeWoApp.MainControl.ResetView(UIContext.Wohnheim); + } + catch (FaultException) + { + MessageBox.Show( + "Dieser Datensatz wurde in der Zwischenzeit von " + Translator.Translate("einem anderen Benutzer") + " geändert. Klicken Sie Ok um den Datensatz erneut zu laden. Ihre Änderungen gehen dabei leider verloren."); + ReloadViewModel(lDataContract.WohnheimOid.Value); + } } - } + } private void InitUserRights() { @@ -177,30 +186,49 @@ namespace BeWo.View.Detail chkArchiviert.Visibility = Visibility.Visible; } } + private void InitScheduler() + { + //timelineView.TimeScales.Clear(); + //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }); + //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Quarter) { MinWidth = 0 }); + //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }); + //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Week) { MinWidth = 0 }); + //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 }); - private void ReloadViewModel(long pOid) - { - VMFactory.CreateWohnheimVMAsync(pOid, cb => this.Dispatch(delegate { ViewModel = cb; })); - - IsDoneWithInsertOrUpdate = true; - } + //timelineViewYear.TimeScales.Clear(); + //timelineViewYear.TimeScales.Add(new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }); + //timelineViewYear.TimeScales.Add(new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }); + //timelineViewYear.TimeScales.Add(new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 }); - private void button_addMitarbeiterRelation_Klick(object sender, RoutedEventArgs e) - { + //timelineViewWeek.TimeScales.Clear(); + //timelineViewWeek.TimeScales.Add(new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 }); + + //timelineViewMonth.TimeScales.Clear(); + //timelineViewMonth.TimeScales.Add(new TimeScale(TimeScaleUnit.Week) { MinWidth = 0 }); + //timelineViewMonth.TimeScales.Add(new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 }); + } + + private void ReloadViewModel(long pOid) + { + VMFactory.CreateWohnheimVMAsync(pOid, cb => this.Dispatch(delegate { ViewModel = cb; })); + + IsDoneWithInsertOrUpdate = true; + } + + private void button_addMitarbeiterRelation_Klick(object sender, RoutedEventArgs e) + { popup_newEmployeeRel.IsOpen = true; - } - + } private void button_addKlientRelation_Klick(object sender, RoutedEventArgs e) { popup_newKlientRel.IsOpen = true; } - private void button_addEmployeeRelation_Click(object sender, RoutedEventArgs e) { if (ValidationTrigger.Validate(groupbox_newEmployeeRel)) { - + bool contains = false; foreach (var item in ViewModel.WohnheimEmployeeRelations.VMList) { @@ -241,7 +269,7 @@ namespace BeWo.View.Detail continue; ViewModel.WohnheimEmployeeRelations.NewVM.Employee = emp; - ViewModel.WohnheimEmployeeRelations.NewVM.Notice= notice; + ViewModel.WohnheimEmployeeRelations.NewVM.Notice = notice; ViewModel.WohnheimEmployeeRelations.AddNewVMToList(); } @@ -251,7 +279,6 @@ namespace BeWo.View.Detail { popup_newTeamRel.IsOpen = true; } - private void button_cancelEmployeeRelation_Click(object sender, RoutedEventArgs e) { popup_newEmployeeRel.IsOpen = false; @@ -268,13 +295,11 @@ namespace BeWo.View.Detail ViewModel.WohnheimEmployeeRelations.NewVM.Employee = e.Data; popup_employee.Focus(); } - private void popupedit_EmployeeRelations_PopUpClick(object sender, RoutedEventArgs e) { employeesearchview.ItemSelected += Employeesearchview_EnvironmentEmployeeSelected; popup_employee.IsOpen = true; } - private void Teamsearchview_EnvironmentTeamSelected(object sender, EventArgs e) { popup_team.IsOpen = false; @@ -291,7 +316,6 @@ namespace BeWo.View.Detail teamsearchview.ItemSelected += Teamsearchview_EnvironmentTeamSelected; popup_team.IsOpen = true; } - private void Popupedit_EmployeeRelations_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) { if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit)sender, e) || !BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View)) @@ -328,7 +352,6 @@ namespace BeWo.View.Detail BeWoWpfUtils.RefreshDXGrid(grid_EmployeeRelation); } - private void button_addKlientRelation_Click(object sender, RoutedEventArgs e) { bool contains = false; @@ -346,12 +369,10 @@ namespace BeWo.View.Detail popup_newKlientRel.IsOpen = false; ViewModel.WohnheimCustomerRelations.AddNewVMToList(); } - private void button_cancelKlientRelation_Click(object sender, RoutedEventArgs e) { popup_newKlientRel.IsOpen = false; } - private void Klientsearchview_EnvironmentKlientSelected(object sender, EventArgs e) { popup_klient.IsOpen = false; @@ -359,29 +380,25 @@ namespace BeWo.View.Detail ViewModel.WohnheimCustomerRelations.NewVM.Customer = e.Data; popup_klient.Focus(); } - private void popupedit_KlientRelations_PopUpClick(object sender, RoutedEventArgs e) { klientsearchview.ItemSelected += Klientsearchview_EnvironmentKlientSelected; popup_klient.IsOpen = true; } - private void Popupedit_KlientRelations_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) { - if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit) sender, e) || !BeWoApp.LoggedOnUser.HasRight(UserRightType.WohnheimView_View)) + if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit)sender, e) || !BeWoApp.LoggedOnUser.HasRight(UserRightType.WohnheimView_View)) { return; } CreateModalViewWindow(ViewModel.WohnheimCustomerRelations.NewVM.Customer); } - public void Button_RemoveCustomerRelation_Click(object sender, RoutedEventArgs e) { ViewModel.WohnheimCustomerRelations.VMList.Remove(grid_CustomerRelation.GetCurrentValue()); BeWoWpfUtils.RefreshDXGrid(grid_CustomerRelation); } - private void TableViewCustomer_OnRowDoubleClick(object sender, RowDoubleClickEventArgs e) { var tableView = (TableView)sender; @@ -394,11 +411,10 @@ namespace BeWo.View.Detail CreateModalViewWindow((selectedVM).Customer); } - private void TableViewEmployee_OnRowDoubleClick(object sender, RowDoubleClickEventArgs e) { - var tableView = (TableView) sender; - var selectedVM = (WohnheimEmployeeRelationVM) tableView.Grid.GetRow(e.HitInfo.RowHandle); + var tableView = (TableView)sender; + var selectedVM = (WohnheimEmployeeRelationVM)tableView.Grid.GetRow(e.HitInfo.RowHandle); if (selectedVM == null) { @@ -407,7 +423,6 @@ namespace BeWo.View.Detail CreateModalViewWindow((selectedVM).Employee); } - private void CreateModalViewWindow(T pDC) where T : IDataContract { if (pDC == null) @@ -417,13 +432,13 @@ namespace BeWo.View.Detail if (pDCType == typeof(CompactEmployeeDC)) { - VMFactory.CreateEmployeeVMAsync((pDC as CompactEmployeeDC).EmployeeOid, - cb => this.Dispatch( - () => BeWoUtils.OpenModalViewWindow(cb, this, () => this.Dispatch( - () => BeWoUtils.UpdateAllViews((pDC as CompactEmployeeDC)))))); + VMFactory.CreateEmployeeVMAsync((pDC as CompactEmployeeDC).EmployeeOid, + cb => this.Dispatch( + () => BeWoUtils.OpenModalViewWindow(cb, this, () => this.Dispatch( + () => BeWoUtils.UpdateAllViews((pDC as CompactEmployeeDC)))))); } - if (pDCType == typeof (CompactCustomerDC)) + if (pDCType == typeof(CompactCustomerDC)) { VMFactory.CreateCustomerVMAsync((pDC as CompactCustomerDC).CustomerOid, cb => this.Dispatch( @@ -431,7 +446,6 @@ namespace BeWo.View.Detail () => BeWoUtils.UpdateAllViews((pDC as CompactCustomerDC)))))); } } - private void chkStatuszeile_Checked(object sender, RoutedEventArgs e) { //textedit_pflichtStart.IsEnabled = true; @@ -446,13 +460,12 @@ namespace BeWo.View.Detail //textedit_pflichtStart.Opacity = 50; //textedit_pflichtEnde.Opacity = 50; } - private void chkStatuszeile_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { var checkbox = sender as CheckEdit; if ((bool)checkbox.EditValue == false) { - textedit_pflichtStart.IsEnabled = false; + textedit_pflichtStart.IsEnabled = false; textedit_pflichtEnde.IsEnabled = false; textedit_pflichtStart.Opacity = 50; textedit_pflichtEnde.Opacity = 50; @@ -478,7 +491,6 @@ namespace BeWo.View.Detail popup_newWohneinheit.IsOpen = true; } - private void Button_NewBelegung_Click(object sender, RoutedEventArgs e) { if (!ViewModel.PermissionWohneinheitBelegungCreate) @@ -497,7 +509,6 @@ namespace BeWo.View.Detail popup_newBelegung.IsOpen = true; } - private void btn_delete_Click(object sender, RoutedEventArgs e) { if (!ViewModel.PermissionWohneinheitDelete) @@ -512,7 +523,6 @@ namespace BeWo.View.Detail e.Handled = true; } - private void btn_belegung_delete_Click(object sender, RoutedEventArgs e) { if (!ViewModel.PermissionWohneinheitBelegungDelete) @@ -533,8 +543,7 @@ namespace BeWo.View.Detail e.Handled = true; } - - private void datagridview_RowDoubleClick(object sender, RowDoubleClickEventArgs e) + private void datagridview_RowDoubleClick(object sender, RowDoubleClickEventArgs e) { if (!ViewModel.PermissionWohneinheitEdit) return; @@ -549,7 +558,6 @@ namespace BeWo.View.Detail popup_newWohneinheit.IsOpen = true; } - private void datagridview2_RowDoubleClick(object sender, RowDoubleClickEventArgs e) { if (!ViewModel.PermissionWohneinheitBelegungEdit) @@ -566,9 +574,71 @@ namespace BeWo.View.Detail popup_newBelegung.IsOpen = true; } - private void SchedulerControl_PopupMenuShowing(object sender, DevExpress.Xpf.Scheduler.SchedulerMenuEventArgs e) + void scheduler_ActiveViewChanged(object sender, ValueChangedEventArgs e) { - e.Handled = true; + if (e.NewValue == null) return; + var selectionStart = scheduler_buchungsplan.SelectedInterval.Start; + var dates = new List() { selectionStart.Date }; + if (!CoerceDateNavigatorSelectedDates(dates)) + return; + + var min = dates.Min(); + scheduler_buchungsplan.Start = min; + var intervalDuration = dates.Max().AddDays(1) - min; + + var timeline = (TimelineView)e.NewValue; + timeline.IntervalDuration = intervalDuration; + timeline.ViewportStart = selectionStart; + timeline.Zoom = intervalDuration; + + scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); + } + bool CoerceDateNavigatorSelectedDates(IList dates) + { + if (dates.Count == 0) return false; + var start = dates.Min(); + var end = dates.Max(); + if (timelineViewWeek.IsActive) + { + var actualStart = DateTimeHelper.GetStartOfWeekUI(start, scheduler_buchungsplan.FirstDayOfWeek); + var actualEnd = actualStart.AddDays(7); + dates.Clear(); + while (actualStart < actualEnd) + { + dates.Add(actualStart); + actualStart = actualStart.AddDays(1); + } + return true; + } + if (timelineViewMonth.IsActive) + { + var actualStart = new DateTime(start.Year, start.Month, 1); + var actualEnd = actualStart.AddMonths(1); + dates.Clear(); + while (actualStart < actualEnd) + { + dates.Add(actualStart); + actualStart = actualStart.AddDays(1); + } + return true; + } + if (timelineViewYear.IsActive) + { + var actualStart = new DateTime(start.Year, 1, 1); + var actualEnd = actualStart.AddYears(1); + dates.Clear(); + while (actualStart < actualEnd) + { + dates.Add(actualStart); + actualStart = actualStart.AddDays(1); + } + return true; + } + return false; + } + private void scheduler_buchungsplan_PopupMenuShowing(object sender, DevExpress.Xpf.Scheduling.PopupMenuShowingEventArgs e) + { + e.Cancel = true; } } } \ No newline at end of file diff --git a/TranslationUnitTest/EnumTranslationTest.cs b/TranslationUnitTest/EnumTranslationTest.cs index 742d60131..04cc2deda 100644 --- a/TranslationUnitTest/EnumTranslationTest.cs +++ b/TranslationUnitTest/EnumTranslationTest.cs @@ -264,9 +264,9 @@ UserRightType.Signature_ProvideMonthlySignatureByProxy, { foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) { - var has_base_version = UserRightHelper.GetRightVersion(item) == UserRightHelper.BASE_VERSION; + var has_special_version = UserRightHelper.GetRightVersion(item) != UserRightHelper.BASE_VERSION; - if (!has_base_version) + if (has_special_version) continue; var is_base_version = UserRightTypesVersion1dot0.Contains(item); From f559f022e7b1804e3f5eac2a7b918fd58f4457f4 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 9 Aug 2024 14:09:21 +0200 Subject: [PATCH 035/103] Buchungsplan startet mit Jahresansicht - Workaround mit TimeScale.IsActive vs Scheduler.ActiceViewIndex --- BeWo/View/Detail/WohnheimView.xaml | 7 ++++--- BeWo/View/Detail/WohnheimView.xaml.cs | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 337612310..25e16af88 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -463,7 +463,7 @@ - + @@ -471,11 +471,12 @@ Grid.Row="1" Width="auto" Height="auto" + FirstDayOfWeek="Monday" dx:ThemeManager.ThemeName="Office2010Black" GroupType="Resource" PopupMenuShowing="scheduler_buchungsplan_PopupMenuShowing" ActiveViewChanged="scheduler_ActiveViewChanged" - ActiveViewIndex="0" FirstDayOfWeek="Monday" + ActiveViewIndex="1" > @@ -495,7 +496,7 @@ - + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 195e15c86..2e31db9a8 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -188,6 +188,9 @@ namespace BeWo.View.Detail } private void InitScheduler() { + radioButtonYear.IsChecked = true; + + timelineViewYear.IsActive = true; //timelineView.TimeScales.Clear(); //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }); //timelineView.TimeScales.Add(new TimeScale(TimeScaleUnit.Quarter) { MinWidth = 0 }); @@ -580,7 +583,9 @@ namespace BeWo.View.Detail var selectionStart = scheduler_buchungsplan.SelectedInterval.Start; var dates = new List() { selectionStart.Date }; if (!CoerceDateNavigatorSelectedDates(dates)) + { return; + } var min = dates.Min(); scheduler_buchungsplan.Start = min; @@ -590,7 +595,7 @@ namespace BeWo.View.Detail timeline.IntervalDuration = intervalDuration; timeline.ViewportStart = selectionStart; timeline.Zoom = intervalDuration; - + scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); } bool CoerceDateNavigatorSelectedDates(IList dates) From 8c2c3c4f37613c6cd573f2642f7530fa1673e405 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 9 Aug 2024 14:22:40 +0200 Subject: [PATCH 036/103] Ressource Mapping --- BeWo/View/Detail/WohnheimView.xaml | 12 ++++++++++-- BeWo/ViewModel/WohneinheitVM.cs | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 25e16af88..7a782b23a 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -483,7 +483,7 @@ - + @@ -496,7 +496,15 @@ - + + + + + + + diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 359daa906..3345f05a0 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -80,6 +80,7 @@ namespace BeWo.ViewModel FirePropertyChanged(nameof(Zimmername)); } } + public string Name => ToString(); public decimal Miete { get { return _Miete; } From 71067748f852f854703ac66ec8fe7ca924913007 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 09:25:10 +0200 Subject: [PATCH 037/103] Test --- BeWo/View/Detail/WohnheimView.xaml | 27 ++++++++++++++++++++++----- BeWo/View/Detail/WohnheimView.xaml.cs | 17 ++++++++++++++++- BeWo/ViewModel/WohneinheitVM.cs | 5 +++++ BeWo/ViewModel/WohnheimVM.cs | 19 +++++++++++++++++++ 4 files changed, 62 insertions(+), 6 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 7a782b23a..0f7bdbbbd 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -4,6 +4,7 @@ xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:uvc="clr-namespace:BeWo.View.Controls" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" + xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduling" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:localView="clr-namespace:BeWo.View" @@ -456,16 +457,30 @@ + - + - + + + + + + + + + + @@ -491,17 +507,18 @@ - + + - + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 2e31db9a8..dfa619da6 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -594,10 +594,14 @@ namespace BeWo.View.Detail var timeline = (TimelineView)e.NewValue; timeline.IntervalDuration = intervalDuration; timeline.ViewportStart = selectionStart; - timeline.Zoom = intervalDuration; + //timeline.Zoom = intervalDuration;// TimeSpan.MaxValue; scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); } + void dateNavigatorSettings_CustomizeSelectedDates(object sender, CustomizeSelectedDatesEventArgs e) + { + e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); + } bool CoerceDateNavigatorSelectedDates(IList dates) { if (dates.Count == 0) return false; @@ -645,5 +649,16 @@ namespace BeWo.View.Detail { e.Cancel = true; } + + private void scheduler_buchungsplan_DependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if(e.Property == SchedulerControl.SelectedIntervalProperty) + { + if(scheduler_buchungsplan.ActiveView is TimelineView timeline) + { + // timeline.ActualZoomRange = new TimeSpanRange(timeline.ZoomRange.Start, timeline.ZoomRange.End); + } + } + } } } \ No newline at end of file diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 3345f05a0..828df1d49 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -35,6 +35,11 @@ namespace BeWo.ViewModel public bool SoftDelete { get; set; } + public WohneinheitVM() + { + Wohnname = "Designer Wohnung"; + } + public WohneinheitVM(WohneinheitDC dc) : base(dc, dc.Oid == null) { diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index 8de690d96..bd85d5406 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -73,6 +73,25 @@ namespace BeWo.ViewModel PermissionWohneinheitBelegungCreate = true; PermissionWohneinheitBelegungEdit = true; PermissionWohneinheitBelegungDelete = true; + + //WohneinheitListVM = new WohneinheitListVM() + //{ + // VMList = new System.ComponentModel.BindingList() + // { + // new WohneinheitVM(), + // new WohneinheitVM() + // }, + // WohneinheitBelegungListVM = new WohneinheitBelegungListVM() + // { + // VMList = new System.ComponentModel.BindingList() + // { + // new WohneinheitBelegungVM() + // { + + // } + // } + // } + //}; } public WohnheimVM(WohnheimDC pWohnheimDC) : base(pWohnheimDC, pWohnheimDC.WohnheimOid == null) From 51246473deafc8054bd9383b4ca22df2f5c18965 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 11:44:44 +0200 Subject: [PATCH 038/103] =?UTF-8?q?Binding=20Probleme...=20Designer=20l?= =?UTF-8?q?=C3=A4dt=20TimeScales=20nicht,=20per=20Code=20behind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/View/Detail/WohnheimView.xaml | 61 ++++++++++++------ BeWo/View/Detail/WohnheimView.xaml.cs | 89 ++++++++++++++++++++++----- 2 files changed, 115 insertions(+), 35 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 0f7bdbbbd..a589470ab 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -5,6 +5,8 @@ xmlns:uvc="clr-namespace:BeWo.View.Controls" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" + xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon" + xmlns:dxa="http://schemas.devexpress.com/winfx/2008/xaml/accordion" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduling" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:localView="clr-namespace:BeWo.View" @@ -32,10 +34,32 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -460,24 +484,34 @@ + - + - + + + @@ -486,6 +520,7 @@ Grid.Row="1" Width="auto" Height="auto" + ShowBorder="False" FirstDayOfWeek="Monday" dx:ThemeManager.ThemeName="Office2010Black" GroupType="Resource" @@ -495,23 +530,11 @@ ActiveViewIndex="1" DependencyPropertyChanged="scheduler_buchungsplan_DependencyPropertyChanged" > - - - - - - - - - - - - - - - - - + + + + + () { + new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } + }); - //timelineViewMonth.TimeScales.Clear(); - //timelineViewMonth.TimeScales.Add(new TimeScale(TimeScaleUnit.Week) { MinWidth = 0 }); - //timelineViewMonth.TimeScales.Add(new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 }); + timelineViewQuartal.TimeScales.Clear(); + timelineViewQuartal.TimeScales.AddRange(new List() { + new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Quarter) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } + }); + + timelineViewMonth.TimeScales.Clear(); + timelineViewMonth.TimeScales.AddRange(new List() { + new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } + }); + + timelineViewWeek.TimeScales.Clear(); + timelineViewWeek.TimeScales.AddRange(new List() { + new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Week) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } + }); } private void ReloadViewModel(long pOid) @@ -587,6 +600,27 @@ namespace BeWo.View.Detail return; } + if (timelineViewWeek.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewMonth.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; + } + else if (timelineViewQuartal.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; + } + else if (timelineViewYear.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + } + var min = dates.Min(); scheduler_buchungsplan.Start = min; var intervalDuration = dates.Max().AddDays(1) - min; @@ -594,13 +628,24 @@ namespace BeWo.View.Detail var timeline = (TimelineView)e.NewValue; timeline.IntervalDuration = intervalDuration; timeline.ViewportStart = selectionStart; - //timeline.Zoom = intervalDuration;// TimeSpan.MaxValue; + timeline.Zoom = TimeSpan.MaxValue; scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); } void dateNavigatorSettings_CustomizeSelectedDates(object sender, CustomizeSelectedDatesEventArgs e) { e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); + + if(scheduler_buchungsplan.ActiveView is TimelineView timeline) + { + var intervalDuration = e.Dates.Max().AddDays(1) - e.Dates.Min(); + + if(timeline.IntervalDuration != intervalDuration) + { + timeline.IntervalDuration = intervalDuration; + timeline.Zoom = TimeSpan.MaxValue; + } + } } bool CoerceDateNavigatorSelectedDates(IList dates) { @@ -643,6 +688,18 @@ namespace BeWo.View.Detail } return true; } + if (timelineViewQuartal.IsActive) + { + var actualStart = new DateTime(start.Year, start.Month, 1); + var actualEnd = actualStart.AddMonths(3); + dates.Clear(); + while (actualStart < actualEnd) + { + dates.Add(actualStart); + actualStart = actualStart.AddDays(1); + } + return true; + } return false; } private void scheduler_buchungsplan_PopupMenuShowing(object sender, DevExpress.Xpf.Scheduling.PopupMenuShowingEventArgs e) From 350554c112bebe9e467c4a6c43bab70051b2bec7 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 12:23:12 +0200 Subject: [PATCH 039/103] Linkt, aber zoomt nicht raus bei Navigation -> Month Switch zb --- BeWo/View/Detail/WohnheimView.xaml.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index e5023020f..010eccf1f 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -636,16 +636,16 @@ namespace BeWo.View.Detail { e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); - if(scheduler_buchungsplan.ActiveView is TimelineView timeline) - { - var intervalDuration = e.Dates.Max().AddDays(1) - e.Dates.Min(); + //if (scheduler_buchungsplan.ActiveView is TimelineView timeline) + //{ + // var intervalDuration = e.Dates.Max().AddDays(1) - e.Dates.Min(); - if(timeline.IntervalDuration != intervalDuration) - { - timeline.IntervalDuration = intervalDuration; - timeline.Zoom = TimeSpan.MaxValue; - } - } + // if (timeline.IntervalDuration != intervalDuration) + // { + // //timeline.IntervalDuration = intervalDuration; + // timeline.Zoom = TimeSpan.MaxValue; + // } + //} } bool CoerceDateNavigatorSelectedDates(IList dates) { From fcb0eacd41fba0afc8b10430dd4829fe01b9afc5 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 12:39:31 +0200 Subject: [PATCH 040/103] Linkt korrekt --- BeWo/View/Detail/WohnheimView.xaml.cs | 22 +++++++++++++--------- BeWo/ViewModel/WohnheimVM.cs | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 010eccf1f..a25707a3f 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -636,16 +636,20 @@ namespace BeWo.View.Detail { e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); - //if (scheduler_buchungsplan.ActiveView is TimelineView timeline) - //{ - // var intervalDuration = e.Dates.Max().AddDays(1) - e.Dates.Min(); + if (scheduler_buchungsplan.ActiveView is TimelineView timeline) + { + var intervalDuration = e.Dates.Max().AddDays(1) - e.Dates.Min(); - // if (timeline.IntervalDuration != intervalDuration) - // { - // //timeline.IntervalDuration = intervalDuration; - // timeline.Zoom = TimeSpan.MaxValue; - // } - //} + if (!ViewModel.IntervalChanging && timeline.IntervalDuration != intervalDuration) + { + ViewModel.IntervalChanging = true; + + timeline.IntervalDuration = intervalDuration; + timeline.Zoom = TimeSpan.MaxValue; + + ViewModel.IntervalChanging = false; + } + } } bool CoerceDateNavigatorSelectedDates(IList dates) { diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index bd85d5406..032f14020 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -109,6 +109,8 @@ namespace BeWo.ViewModel } } + public TimeSpan IntervalRange { get; set; } + public bool IntervalChanging { get; set; } public bool PermissionWohneinheitTabitemView => PermissionWohneinheitView || PermissionWohneinheitBelegungView; public bool PermissionWohneinheitView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_View); From 225232ba276c5764125cb6759efb4a798759b34f Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 14:57:18 +0200 Subject: [PATCH 041/103] Bug: Unable to find a resource Id collection while the ResourceSharing option is enabled. Bind the ResourceId property to a field that contains a collection.: bei DevExpress.Xpf.Scheduling.Internal.MappingsHelper.AppointmentResourceIdsConvertCore(Object value) --- BeWo/BeWo.csproj | 3 +++ BeWo/View/Detail/WohnheimView.xaml | 12 ++++++++++-- BeWo/View/Detail/WohnheimView.xaml.cs | 5 +++-- BeWo/ViewModel/WohneinheitBelegungVM.cs | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 0f9848168..7ffe8f1d5 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -3239,6 +3239,9 @@ + + + diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index a589470ab..f495cf8b8 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -495,7 +495,7 @@ RowCount="3" x:Name="dateNavigator" - ShowTodayButton="False" ShowWeekNumbers="False" IsMultiSelect="True" + ShowTodayButton="False" ShowWeekNumbers="False" IsMultiSelect="False" VerticalAlignment="Top" dxlc:LayoutControl.AllowVerticalSizing="True" > @@ -539,10 +539,18 @@ + ResourceSharing="True" + AppointmentsSource="{Binding WohneinheitListVM.WohneinheitBelegungListVM.VMList}"> + + + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index a25707a3f..d87adec8e 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -41,9 +41,10 @@ namespace BeWo.View.Detail { SchedulerControl.AllowInfiniteSize = true; - InitializeComponent(); ViewModel = vm; + InitializeComponent(); + vm.WohneinheitListVM.PropertyChanged += (s, e) => datagridview.BestFitColumns(); vm.WohneinheitListVM.WohneinheitBelegungListVM.PropertyChanged += (s, e) => datagridview2.BestFitColumns(); @@ -713,7 +714,7 @@ namespace BeWo.View.Detail private void scheduler_buchungsplan_DependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs e) { - if(e.Property == SchedulerControl.SelectedIntervalProperty) + if(e.Property == SchedulerControl.StartProperty) { if(scheduler_buchungsplan.ActiveView is TimelineView timeline) { diff --git a/BeWo/ViewModel/WohneinheitBelegungVM.cs b/BeWo/ViewModel/WohneinheitBelegungVM.cs index 07dd475a2..ac2bdbf37 100644 --- a/BeWo/ViewModel/WohneinheitBelegungVM.cs +++ b/BeWo/ViewModel/WohneinheitBelegungVM.cs @@ -36,7 +36,6 @@ namespace BeWo.ViewModel public bool CanSave => Wohneinheit is object && Customer is object; - public WohneinheitVM Wohneinheit { get { return _Wohneinheit; } @@ -120,6 +119,8 @@ namespace BeWo.ViewModel } } + public DateTime EndDateDisplay => EndDate ?? DateTime.MaxValue; + public override bool Equals(object obj) { return Equals(obj as WohneinheitBelegungVM); From 24fd4c4c074d80196b257d34abe3dd3d1b2f3b89 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 13 Aug 2024 15:21:19 +0200 Subject: [PATCH 042/103] Ansicht verbessert + Appointment mapping --- BeWo/View/Detail/WohnheimView.xaml | 3 +- BeWo/View/Detail/WohnheimView.xaml.cs | 73 ++++++++++++++++++------- BeWo/ViewModel/WohneinheitBelegungVM.cs | 3 +- 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index f495cf8b8..b31c4fa99 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -513,6 +513,7 @@ + @@ -532,6 +533,7 @@ + @@ -539,7 +541,6 @@ diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index d87adec8e..41d6acd86 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -216,6 +216,14 @@ namespace BeWo.View.Detail new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } }); + timelineView4Week.TimeScales.Clear(); + timelineView4Week.TimeScales.AddRange(new List() { + new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Month) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Week) { MinWidth = 0 }, + new TimeScale(TimeScaleUnit.Day) { MinWidth = 0 } + }); + timelineViewWeek.TimeScales.Clear(); timelineViewWeek.TimeScales.AddRange(new List() { new TimeScale(TimeScaleUnit.Year) { MinWidth = 0 }, @@ -601,26 +609,7 @@ namespace BeWo.View.Detail return; } - if (timelineViewWeek.IsActive) - { - dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; - dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; - } - else if (timelineViewMonth.IsActive) - { - dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; - dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; - } - else if (timelineViewQuartal.IsActive) - { - dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; - dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Year; - } - else if (timelineViewYear.IsActive) - { - dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; - dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; - } + UpdateSelectionView(); var min = dates.Min(); scheduler_buchungsplan.Start = min; @@ -629,10 +618,39 @@ namespace BeWo.View.Detail var timeline = (TimelineView)e.NewValue; timeline.IntervalDuration = intervalDuration; timeline.ViewportStart = selectionStart; + timeline.Zoom = TimeSpan.MinValue; timeline.Zoom = TimeSpan.MaxValue; - + scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); } + private void UpdateSelectionView() + { + if (timelineViewWeek.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineView4Week.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewMonth.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewQuartal.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewYear.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + } + } void dateNavigatorSettings_CustomizeSelectedDates(object sender, CustomizeSelectedDatesEventArgs e) { e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); @@ -646,6 +664,7 @@ namespace BeWo.View.Detail ViewModel.IntervalChanging = true; timeline.IntervalDuration = intervalDuration; + timeline.Zoom = TimeSpan.MinValue; timeline.Zoom = TimeSpan.MaxValue; ViewModel.IntervalChanging = false; @@ -669,6 +688,18 @@ namespace BeWo.View.Detail } return true; } + if (timelineView4Week.IsActive) + { + var actualStart = DateTimeHelper.GetStartOfWeekUI(start, scheduler_buchungsplan.FirstDayOfWeek); + var actualEnd = actualStart.AddDays(28); + dates.Clear(); + while (actualStart < actualEnd) + { + dates.Add(actualStart); + actualStart = actualStart.AddDays(1); + } + return true; + } if (timelineViewMonth.IsActive) { var actualStart = new DateTime(start.Year, start.Month, 1); diff --git a/BeWo/ViewModel/WohneinheitBelegungVM.cs b/BeWo/ViewModel/WohneinheitBelegungVM.cs index ac2bdbf37..a785870c5 100644 --- a/BeWo/ViewModel/WohneinheitBelegungVM.cs +++ b/BeWo/ViewModel/WohneinheitBelegungVM.cs @@ -130,7 +130,8 @@ namespace BeWo.ViewModel { return other != null && Wohneinheit == other.Wohneinheit && - Customer.Equals(other.Customer) && + ((Customer == null && other.Customer == null) || + Customer.Equals(other.Customer)) && StartDate == other.StartDate && EndDate == other.EndDate && Kommentar == other.Kommentar; From 4960c87f2b947076c84360e33f6f7f001d25052f Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 14 Aug 2024 10:10:02 +0200 Subject: [PATCH 043/103] Anzeige --- BeWo/View/Detail/WohnheimView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index b31c4fa99..7527a520a 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -513,7 +513,7 @@ - + From 0373a7315986b767febfa6d78efe2593984479d5 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 14 Aug 2024 15:20:37 +0200 Subject: [PATCH 044/103] temp commit --- BeWo/View/Controls/WohneinheitEditPopup.xaml | 1 + .../Controls/WohneinheitEditPopup.xaml.cs | 31 +++++++++++++++++++ BeWo/View/Detail/WohnheimView.xaml.cs | 1 - .../ListViewModel/WohneinheitListVM.cs | 1 + BeWo/ViewModel/WohneinheitVM.cs | 25 ++++++++------- Data/Entities/Wohneinheit.cs | 4 +-- .../CompactWohnheimDC_Wohnheim.cs | 1 + .../ClientPartials/CompactWohnheimDC.cs | 2 -- .../Compact/CompactWohnheimDC.cs | 3 ++ Shared/DataContracts/WohneinheitDC.cs | 2 +- Shared/Extensions/StringExtensions.cs | 3 ++ 11 files changed, 57 insertions(+), 17 deletions(-) diff --git a/BeWo/View/Controls/WohneinheitEditPopup.xaml b/BeWo/View/Controls/WohneinheitEditPopup.xaml index dd7cafaf4..c8e264508 100644 --- a/BeWo/View/Controls/WohneinheitEditPopup.xaml +++ b/BeWo/View/Controls/WohneinheitEditPopup.xaml @@ -32,6 +32,7 @@ diff --git a/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs b/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs index 8a278a362..d63afb48b 100644 --- a/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs +++ b/BeWo/View/Controls/WohneinheitEditPopup.xaml.cs @@ -1,5 +1,6 @@ using BeWo.ViewModel; using BeWo.ViewModel.ListViewModel; +using BS.Shared.Extensions; using System; using System.Collections.Generic; using System.Linq; @@ -106,5 +107,35 @@ namespace BeWo.View.Controls } } } + + private void combobox_wohnungsname_DropDownClosed(object sender, EventArgs e) + { + var vm = ViewModel.WohneinheitListVM.CurrentVM; + + if (vm is null) + return; + + var selected_item = combobox_wohnungsname.SelectedItem as string; + + var selected_vm = ViewModel.WohneinheitListVM.VMList.FirstOrDefault(x => x.Wohnname == selected_item); + + SetValuesFromParent(vm, selected_vm); + } + + private void SetValuesFromParent(WohneinheitVM vm, WohneinheitVM parent_vm) + { + if (vm is null || parent_vm is null) + return; + + if (vm.Stock.IsNullOrEmpty() && parent_vm.Stock.IsNotNullOrEmpty()) + { + vm.Stock = parent_vm.Stock; + } + + if (!vm.Baujahr.HasValue && parent_vm.Baujahr.HasValue) + { + vm.Baujahr = parent_vm.Baujahr; + } + } } } diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 41d6acd86..f6f3d32b4 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -512,7 +512,6 @@ namespace BeWo.View.Detail var vmlist = ViewModel.WohneinheitListVM; vmlist.CurrentVM = vmlist.NewVM; - vmlist.NewVM.Baujahr = 1900; popup_newWohneinheit.IsOpen = true; } diff --git a/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs b/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs index ea754ae2a..c2314642b 100644 --- a/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs +++ b/BeWo/ViewModel/ListViewModel/WohneinheitListVM.cs @@ -63,6 +63,7 @@ namespace BeWo.ViewModel.ListViewModel public List GetWohnungsnamen() => VMList? .Where(x => !string.IsNullOrEmpty(x.Wohnname)) + .Where(x => !string.IsNullOrEmpty(x.Zimmername)) .Select(x => x.Wohnname)? .Distinct() .OrderBy(x => x) diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 828df1d49..d26893da0 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -27,7 +27,7 @@ namespace BeWo.ViewModel private decimal _SonstigeKosten; private decimal _Kaution; private decimal _QM; - private int _Baujahr; + private int? _Baujahr; private string _Mobilierung; private string _Zusatznotiz; private string _Stock; @@ -86,7 +86,7 @@ namespace BeWo.ViewModel } } public string Name => ToString(); - public decimal Miete + public decimal? Miete { get { return _Miete; } set @@ -99,7 +99,7 @@ namespace BeWo.ViewModel FirePropertyChanged(nameof(Brutto)); } } - public decimal Heizung + public decimal? Heizung { get { return _Heizung; } set @@ -113,7 +113,7 @@ namespace BeWo.ViewModel } } } - public decimal Strom + public decimal? Strom { get { return _Strom; } set @@ -127,7 +127,7 @@ namespace BeWo.ViewModel } } } - public decimal Betriebskosten + public decimal? Betriebskosten { get { return _Betriebskosten; } set @@ -141,7 +141,7 @@ namespace BeWo.ViewModel } } } - public decimal SonstigeKosten + public decimal? SonstigeKosten { get { return _SonstigeKosten; } set @@ -155,7 +155,7 @@ namespace BeWo.ViewModel } } } - public decimal Kaution + public decimal? Kaution { get { return _Kaution; } set @@ -168,14 +168,17 @@ namespace BeWo.ViewModel } } } - public decimal Brutto + public decimal? Brutto { get { + if (!Miete.HasValue & !Heizung.HasValue && !Strom.HasValue && !Betriebskosten.HasValue && !SonstigeKosten.HasValue) + return null; + return Miete + Heizung + Strom + Betriebskosten + SonstigeKosten; } } - public decimal QM + public decimal? QM { get { return _QM; } set @@ -189,8 +192,8 @@ namespace BeWo.ViewModel } } } - public string FlacheString => QM.ToString("########0.00 qm"); - public int Baujahr + public string FlacheString => QM?.ToString("########0.00 qm"); + public int? Baujahr { get { return _Baujahr; } set diff --git a/Data/Entities/Wohneinheit.cs b/Data/Entities/Wohneinheit.cs index 43990b37c..35ee80502 100644 --- a/Data/Entities/Wohneinheit.cs +++ b/Data/Entities/Wohneinheit.cs @@ -36,7 +36,7 @@ namespace BeWo.Data.Entities private decimal _SonstigeKosten; private decimal _Kaution; private decimal _QM; - private int _Baujahr; + private int? _Baujahr; private string _Mobilierung; private string _Zusatznotiz; private string _Stock; @@ -212,7 +212,7 @@ namespace BeWo.Data.Entities } } } - public virtual int Baujahr + public virtual int? Baujahr { get { diff --git a/Service/DCEntityMapper/CompactWohnheimDC_Wohnheim.cs b/Service/DCEntityMapper/CompactWohnheimDC_Wohnheim.cs index 86f1afe8f..75d0b5406 100644 --- a/Service/DCEntityMapper/CompactWohnheimDC_Wohnheim.cs +++ b/Service/DCEntityMapper/CompactWohnheimDC_Wohnheim.cs @@ -10,6 +10,7 @@ namespace BeWo.Service.DCEntityMapper public override CompactWohnheimDC MergeWithDC(Wohnheim pEntity, CompactWohnheimDC pDataContract) { pDataContract.WohnheimOid = pEntity.Oid.Value; + pDataContract.Version = pEntity.Version.Value; pDataContract.WohnheimName = pEntity.WohnheimName; pDataContract.Strasse = pEntity.Strasse; pDataContract.PLZ = pEntity.PLZ; diff --git a/Shared/DataContracts/Compact/ClientPartials/CompactWohnheimDC.cs b/Shared/DataContracts/Compact/ClientPartials/CompactWohnheimDC.cs index f4acf5b01..bdeaa022d 100644 --- a/Shared/DataContracts/Compact/ClientPartials/CompactWohnheimDC.cs +++ b/Shared/DataContracts/Compact/ClientPartials/CompactWohnheimDC.cs @@ -15,8 +15,6 @@ namespace BS.Shared.DataContracts.Compact public bool SupportsActivationType { get{ return true; } set { } } - public long Version { get; set; } - public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } } public string AddressString diff --git a/Shared/DataContracts/Compact/CompactWohnheimDC.cs b/Shared/DataContracts/Compact/CompactWohnheimDC.cs index 805da9299..aebd3492c 100644 --- a/Shared/DataContracts/Compact/CompactWohnheimDC.cs +++ b/Shared/DataContracts/Compact/CompactWohnheimDC.cs @@ -13,6 +13,9 @@ namespace BS.Shared.DataContracts.Compact [DataMember] public string WohnheimName { get; set; } + [DataMember] + public long Version { get; set; } + [DataMember] public ActivationTypeId ActivationType { get; set; } diff --git a/Shared/DataContracts/WohneinheitDC.cs b/Shared/DataContracts/WohneinheitDC.cs index 8bc0402f1..7d05bd799 100644 --- a/Shared/DataContracts/WohneinheitDC.cs +++ b/Shared/DataContracts/WohneinheitDC.cs @@ -18,7 +18,7 @@ namespace BS.Shared.DataContracts [DataMember] public decimal SonstigeKosten { get; set; } [DataMember] public decimal Kaution { get; set; } [DataMember] public decimal QM { get; set; } - [DataMember] public int Baujahr { get; set; } + [DataMember] public int? Baujahr { get; set; } [DataMember] public string Mobilierung { get; set; } [DataMember] public string Zusatznotiz { get; set; } [DataMember] public string Stock { get; set; } diff --git a/Shared/Extensions/StringExtensions.cs b/Shared/Extensions/StringExtensions.cs index c1a4795b1..c210a5bf5 100644 --- a/Shared/Extensions/StringExtensions.cs +++ b/Shared/Extensions/StringExtensions.cs @@ -23,6 +23,9 @@ namespace BS.Shared.Extensions return true; } + public static bool IsNotNullOrEmpty(this string pString) + => !IsNullOrEmpty(pString); + public static bool IsNullOrEmpty(this string pString) { return String.IsNullOrEmpty(pString); From 70c13645e5216d0bbff8ae9969c8e7f18b8f10de Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 14 Aug 2024 16:44:17 +0200 Subject: [PATCH 045/103] Label Mapping --- BeWo/View/Detail/WohnheimView.xaml | 13 ++++-- BeWo/View/Detail/WohnheimView.xaml.cs | 5 ++- .../Navigation/WohnheimNavigationView.xaml.cs | 7 ++- BeWo/ViewModel/VMFactory.cs | 12 ++--- BeWo/ViewModel/WohneinheitVM.cs | 45 +++++++++++-------- BeWo/ViewModel/WohnheimVM.cs | 6 ++- Data/Entities/Wohneinheit.cs | 28 ++++++------ .../CustomerServiceImp.cs | 4 +- Shared/DataContracts/WohneinheitDC.cs | 14 +++--- 9 files changed, 79 insertions(+), 55 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index 7527a520a..df6fdb662 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -540,17 +540,24 @@ + ResourcesSource="{Binding WohneinheitListVM.VMList}" + AppointmentLabelsSource="{Binding Customers}" + AppointmentsSource="{Binding WohneinheitListVM.WohneinheitBelegungListVM.VMList}"> + + + + + + ResourceId="Wohneinheit.Oid" + LabelId="Customer.CustomerOid"/> diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index f6f3d32b4..63cb0b338 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -32,6 +32,7 @@ namespace BeWo.View.Detail public partial class WohnheimView : BeWoView { private WohnheimVM _ViewModel; + private List _Customers; private bool initTabIndex; private List regelmaessigeDiensteVonMitarbeiternLoeschen; @@ -43,6 +44,8 @@ namespace BeWo.View.Detail ViewModel = vm; + _Customers = vm.Customers; + InitializeComponent(); vm.WohneinheitListVM.PropertyChanged += (s, e) => datagridview.BestFitColumns(); @@ -235,7 +238,7 @@ namespace BeWo.View.Detail private void ReloadViewModel(long pOid) { - VMFactory.CreateWohnheimVMAsync(pOid, cb => this.Dispatch(delegate { ViewModel = cb; })); + VMFactory.CreateWohnheimVMAsync(pOid, _Customers, cb => this.Dispatch(delegate { ViewModel = cb; }));; IsDoneWithInsertOrUpdate = true; } diff --git a/BeWo/View/Navigation/WohnheimNavigationView.xaml.cs b/BeWo/View/Navigation/WohnheimNavigationView.xaml.cs index c1a82930d..a26b258a7 100644 --- a/BeWo/View/Navigation/WohnheimNavigationView.xaml.cs +++ b/BeWo/View/Navigation/WohnheimNavigationView.xaml.cs @@ -23,6 +23,7 @@ namespace BeWo.View.Navigation /// public partial class WohnheimNavigationView : BeWoView { + private List _Customers; private IEnumerable objectList;// = null; private IEnumerable recentList = null; @@ -81,7 +82,7 @@ namespace BeWo.View.Navigation private void wohnheimNavigationView_CreateNewObject() { - VMFactory.CreateWohnheimVMAsync(cb => this.Dispatch(delegate { this.MainControl.NavigateTo(new WohnheimView(cb) { ParentView = this }); })); + VMFactory.CreateWohnheimVMAsync(_Customers, cb => this.Dispatch(delegate { this.MainControl.NavigateTo(new WohnheimView(cb) { ParentView = this }); })); } private bool wohnheimNavigationView_DeleteObject(IFilterableDC obj) @@ -129,7 +130,7 @@ namespace BeWo.View.Navigation CompactWohnheimDC dc = ofbj as CompactWohnheimDC; if (dc != null) { - VMFactory.CreateWohnheimVMAsync(dc.WohnheimOid, cb => this.Dispatch(delegate { this.MainControl.NavigateTo(new WohnheimView(cb) { ParentView = this }); })); + VMFactory.CreateWohnheimVMAsync(dc.WohnheimOid, _Customers, cb => this.Dispatch(delegate { this.MainControl.NavigateTo(new WohnheimView(cb) { ParentView = this }); })); } } @@ -161,6 +162,8 @@ namespace BeWo.View.Navigation recentList = r.Cast(); this.wohnheimNavigationView.ShowHistory(recentList); })); + + ServiceFacade.DoCustomerServiceAsync(c => c.GetAllCompactCustomers(), cb => _Customers = cb); } else { diff --git a/BeWo/ViewModel/VMFactory.cs b/BeWo/ViewModel/VMFactory.cs index 578d11d7e..7e025f85f 100644 --- a/BeWo/ViewModel/VMFactory.cs +++ b/BeWo/ViewModel/VMFactory.cs @@ -213,24 +213,24 @@ namespace BeWo.ViewModel CreateEmployeeVMAsync(new EmployeeDC(), pCallBack); } - public static void CreateWohnheimVMAsync(long pOid, Action pCallBack) + public static void CreateWohnheimVMAsync(long pOid, List customers, Action pCallBack) { ServiceFacade.DoWohnheimServiceAsync( s => s.LoadWohnheim(pOid), r => { - CreateWohnheimVMAsync(r, pCallBack); + CreateWohnheimVMAsync(r, customers, pCallBack); }); } - public static void CreateWohnheimVMAsync(WohnheimDC pWohnheimDC, Action pCallBack) + public static void CreateWohnheimVMAsync(WohnheimDC pWohnheimDC, List customers, Action pCallBack) { - pCallBack(new WohnheimVM(pWohnheimDC)); + pCallBack(new WohnheimVM(pWohnheimDC, customers)); } - public static void CreateWohnheimVMAsync(Action pCallBack) + public static void CreateWohnheimVMAsync(List customers, Action pCallBack) { - CreateWohnheimVMAsync(new WohnheimDC(), pCallBack); + CreateWohnheimVMAsync(new WohnheimDC(), customers, pCallBack); } public static void CreateEquityInvoiceBaselListVMAsync(long supportconeptOid, Action callback) diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index d26893da0..eb26a7d2e 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -20,21 +20,19 @@ namespace BeWo.ViewModel private WohnheimVM _Wohnheim; private string _Wohnname; private string _Zimmername; - private decimal _Miete; - private decimal _Heizung; - private decimal _Strom; - private decimal _Betriebskosten; - private decimal _SonstigeKosten; - private decimal _Kaution; - private decimal _QM; + private decimal? _Miete; + private decimal? _Heizung; + private decimal? _Strom; + private decimal? _Betriebskosten; + private decimal? _SonstigeKosten; + private decimal? _Kaution; + private decimal? _QM; private int? _Baujahr; private string _Mobilierung; private string _Zusatznotiz; private string _Stock; private WohneinheitBelegungListVM _Belegungen; - public bool SoftDelete { get; set; } - public WohneinheitVM() { Wohnname = "Designer Wohnung"; @@ -172,10 +170,18 @@ namespace BeWo.ViewModel { get { - if (!Miete.HasValue & !Heizung.HasValue && !Strom.HasValue && !Betriebskosten.HasValue && !SonstigeKosten.HasValue) + if (!Miete.HasValue + && !Heizung.HasValue + && !Strom.HasValue + && !Betriebskosten.HasValue + && !SonstigeKosten.HasValue) return null; - return Miete + Heizung + Strom + Betriebskosten + SonstigeKosten; + return (Miete ?? 0) + + (Heizung ?? 0) + + (Strom ?? 0) + + (Betriebskosten ?? 0) + + (SonstigeKosten ?? 0); } } public decimal? QM @@ -183,13 +189,16 @@ namespace BeWo.ViewModel get { return _QM; } set { - if (AreDifferent(QM, value)) - { - _QM = value; - StoreDirtyInformation(AreDifferent(DataContract.QM, value), nameof(QM)); - FirePropertyChanged(nameof(QM)); - FirePropertyChanged(nameof(FlacheString)); - } + if (!AreDifferent(QM, value)) + return; + + if (value == 0) + value = null; + + _QM = value; + StoreDirtyInformation(AreDifferent(DataContract.QM, value), nameof(QM)); + FirePropertyChanged(nameof(QM)); + FirePropertyChanged(nameof(FlacheString)); } } public string FlacheString => QM?.ToString("########0.00 qm"); diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index 032f14020..9cba3229b 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -93,10 +93,10 @@ namespace BeWo.ViewModel // } //}; } - public WohnheimVM(WohnheimDC pWohnheimDC) + public WohnheimVM(WohnheimDC pWohnheimDC, List customers) : base(pWohnheimDC, pWohnheimDC.WohnheimOid == null) { - + Customers = customers; } public override bool IsDirty @@ -109,6 +109,8 @@ namespace BeWo.ViewModel } } + public List Customers { get; set; } + public TimeSpan IntervalRange { get; set; } public bool IntervalChanging { get; set; } public bool PermissionWohneinheitTabitemView => PermissionWohneinheitView || PermissionWohneinheitBelegungView; diff --git a/Data/Entities/Wohneinheit.cs b/Data/Entities/Wohneinheit.cs index 35ee80502..70bd12196 100644 --- a/Data/Entities/Wohneinheit.cs +++ b/Data/Entities/Wohneinheit.cs @@ -29,13 +29,13 @@ namespace BeWo.Data.Entities //private long? _WohnheimOid; private string _Wohnname; private string _Zimmername; - private decimal _Miete; - private decimal _Heizung; - private decimal _Strom; - private decimal _Betriebskosten; - private decimal _SonstigeKosten; - private decimal _Kaution; - private decimal _QM; + private decimal? _Miete; + private decimal? _Heizung; + private decimal? _Strom; + private decimal? _Betriebskosten; + private decimal? _SonstigeKosten; + private decimal? _Kaution; + private decimal? _QM; private int? _Baujahr; private string _Mobilierung; private string _Zusatznotiz; @@ -107,7 +107,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal Miete + public virtual decimal? Miete { get { @@ -122,7 +122,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal Heizung + public virtual decimal? Heizung { get { @@ -137,7 +137,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal Strom + public virtual decimal? Strom { get { @@ -152,7 +152,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal Betriebskosten + public virtual decimal? Betriebskosten { get { @@ -167,7 +167,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal SonstigeKosten + public virtual decimal? SonstigeKosten { get { @@ -182,7 +182,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal Kaution + public virtual decimal? Kaution { get { @@ -197,7 +197,7 @@ namespace BeWo.Data.Entities } } } - public virtual decimal QM + public virtual decimal? QM { get { diff --git a/Service/ServiceImplementations/CustomerServiceImp.cs b/Service/ServiceImplementations/CustomerServiceImp.cs index 79b3ea3f1..d6480760f 100644 --- a/Service/ServiceImplementations/CustomerServiceImp.cs +++ b/Service/ServiceImplementations/CustomerServiceImp.cs @@ -2592,8 +2592,8 @@ namespace BeWo.Service.ServiceImplementations { try { - var e = DAOFactory.GenericDAO.LoadByID(pOid); - e.IsActive = ActivationTypeId.Archived; + //var e = DAOFactory.GenericDAO.LoadByID(pOid); + //e.IsActive = ActivationTypeId.Archived; ServiceLogic.SetActivationType(pOid, pVersion, ActivationTypeId.Archived); diff --git a/Shared/DataContracts/WohneinheitDC.cs b/Shared/DataContracts/WohneinheitDC.cs index 7d05bd799..91963e38c 100644 --- a/Shared/DataContracts/WohneinheitDC.cs +++ b/Shared/DataContracts/WohneinheitDC.cs @@ -11,13 +11,13 @@ namespace BS.Shared.DataContracts { [DataMember] public string Wohnname { get; set; } [DataMember] public string Zimmername { get; set; } - [DataMember] public decimal Miete { get; set; } - [DataMember] public decimal Heizung { get; set; } - [DataMember] public decimal Strom { get; set; } - [DataMember] public decimal Betriebskosten { get; set; } - [DataMember] public decimal SonstigeKosten { get; set; } - [DataMember] public decimal Kaution { get; set; } - [DataMember] public decimal QM { get; set; } + [DataMember] public decimal? Miete { get; set; } + [DataMember] public decimal? Heizung { get; set; } + [DataMember] public decimal? Strom { get; set; } + [DataMember] public decimal? Betriebskosten { get; set; } + [DataMember] public decimal? SonstigeKosten { get; set; } + [DataMember] public decimal? Kaution { get; set; } + [DataMember] public decimal? QM { get; set; } [DataMember] public int? Baujahr { get; set; } [DataMember] public string Mobilierung { get; set; } [DataMember] public string Zusatznotiz { get; set; } From bb5f5700d8de5dfa481942c54d686b135f24e97c Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 14 Aug 2024 19:02:17 +0200 Subject: [PATCH 046/103] Converter + ValueConverterGroup --- BeWo/BeWo.csproj | 3 ++ BeWo/BeWoApp.xaml | 6 ++++ ...BoolEnabledToTabitemBackgroundConverter.cs | 25 +++++++++++++++++ .../BoolToParameterReturnConverter.cs | 28 +++++++++++++++++++ BeWo/Converter/ValueConverterGroup.cs | 26 +++++++++++++++++ BeWo/Styles/OrangeBlack.xaml | 1 + BeWo/View/Detail/WohnheimView.xaml | 12 ++++++-- 7 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 BeWo/Converter/BoolEnabledToTabitemBackgroundConverter.cs create mode 100644 BeWo/Converter/BoolToParameterReturnConverter.cs create mode 100644 BeWo/Converter/ValueConverterGroup.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 7ffe8f1d5..cd81f6814 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -848,6 +848,8 @@ + + @@ -868,6 +870,7 @@ + diff --git a/BeWo/BeWoApp.xaml b/BeWo/BeWoApp.xaml index b3f8d1735..f27dcb636 100644 --- a/BeWo/BeWoApp.xaml +++ b/BeWo/BeWoApp.xaml @@ -62,6 +62,12 @@ + + + + + + diff --git a/BeWo/Converter/BoolEnabledToTabitemBackgroundConverter.cs b/BeWo/Converter/BoolEnabledToTabitemBackgroundConverter.cs new file mode 100644 index 000000000..13b4182ee --- /dev/null +++ b/BeWo/Converter/BoolEnabledToTabitemBackgroundConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace BeWo.Converter +{ + public class BoolEnabledToTabitemBackgroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return Application.Current.Resources["TabItemTextBrush"]; + } + + return (bool)value ? Application.Current.Resources["TabItemTextBrush"] : Application.Current.Resources["TabItemTextBrushDisabled"]; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/BeWo/Converter/BoolToParameterReturnConverter.cs b/BeWo/Converter/BoolToParameterReturnConverter.cs new file mode 100644 index 000000000..867c94b82 --- /dev/null +++ b/BeWo/Converter/BoolToParameterReturnConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace BeWo.Converter +{ + public class BoolToParameterReturnConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return null; + } + + return (bool)value ? parameter : null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Converter/ValueConverterGroup.cs b/BeWo/Converter/ValueConverterGroup.cs new file mode 100644 index 000000000..bb4315d90 --- /dev/null +++ b/BeWo/Converter/ValueConverterGroup.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace BeWo.Converter +{ + public class ValueConverterGroup : List, IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return this.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture)); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/BeWo/Styles/OrangeBlack.xaml b/BeWo/Styles/OrangeBlack.xaml index a53795b28..b5b318182 100644 --- a/BeWo/Styles/OrangeBlack.xaml +++ b/BeWo/Styles/OrangeBlack.xaml @@ -3277,6 +3277,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs index 08fc05595..b7f6bfc67 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs @@ -1,5 +1,8 @@ -using System; +using BS.Shared.DataContracts; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -18,11 +21,57 @@ namespace BeWo.View.Detail.Wohneinheit /// /// Interaktionslogik für WohneinheitGrundrissControl.xaml /// - public partial class WohneinheitGrundrissControl : UserControl + public partial class WohneinheitGrundrissControl : BeWoView { - public WohneinheitGrundrissControl() + public ObservableCollection Images { get; set; } + + public WohneinheitGrundrissControl(ObservableCollection images) { InitializeComponent(); + + this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, + (s, e) => + { + BeWoApp.MainControl.CloseCurrentPopUp(); + })); + + Images = images; + + DataContext = Images; + } + + private void MenuItem_Add_Click(object sender, RoutedEventArgs e) + { + var dialog = new Microsoft.Win32.OpenFileDialog(); + dialog.Title = "Wähle einen Grundriss aus"; + dialog.Filter = "ALL supported Graphics| *.jpeg; *.jpg;*.png;"; + + // Show open file dialog box + bool? result = dialog.ShowDialog(); + + // Process open file dialog box results + if (result == true) + { + // Open document + string filename = dialog.FileName; + + var dc = new ImageDC(); + + dc.Filename = filename; + dc.ImageData = File.ReadAllBytes(filename); + + Images.Add(dc); + } + } + + private void MenuItem_Del_Click(object sender, RoutedEventArgs e) + { + var t = PhotosListBox.SelectedItem as ImageDC; + + if (t is null) + return; + + Images.Remove(t); } } } diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 3ab098219..551c27641 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -848,18 +848,17 @@ namespace BeWo.View.Detail private void btn_gallery_Click(object sender, RoutedEventArgs e) { - if (!ViewModel.PermissionWohneinheitDelete) + if (!ViewModel.PermissionWohneinheitGallery) return; - if (ViewModel.WohneinheitListVM.EditVM is object) + if (BeWoApp.MainControl.IsModalPopupOpen) return; var vm = datagrid_wohneinheiten.GetCurrentValue(); - if (MessageBox.Show($"Möchten Sie Wohneinheit '{vm}' wirklich löschen?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) - { - ViewModel.WohneinheitListVM.RemoveVM(vm); - } + var control = new WohneinheitGrundrissControl(vm.Grundrisse); + + BeWoApp.MainControl.ShowControlAsModalPopup(control); e.Handled = true; } diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index e18c16422..21316679b 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -3,6 +3,7 @@ using BS.Shared; using BS.Shared.DataContracts; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; @@ -30,6 +31,7 @@ namespace BeWo.ViewModel private string _Mobilierung; private string _Zusatznotiz; private string _Stock; + private ObservableCollection _Grundrisse; public WohneinheitVM() { @@ -244,6 +246,15 @@ namespace BeWo.ViewModel } } } + public ObservableCollection Grundrisse + { + get => _Grundrisse ?? (_Grundrisse = new ObservableCollection()); + set + { + _Grundrisse = value; + FirePropertyChanged(nameof(Grundrisse)); + } + } public bool IsEinzelwohnung => string.IsNullOrEmpty(Zimmername); @@ -294,6 +305,9 @@ namespace BeWo.ViewModel _Mobilierung = pDataContract.Mobilierung; _Zusatznotiz = pDataContract.Zusatznotiz; _Stock = pDataContract.Stock; + + if(pDataContract.Grundrisse != null) + _Grundrisse = new ObservableCollection(pDataContract.Grundrisse); } protected override WohneinheitDC MapToDataContract(WohneinheitDC bDataContract, bool doCommit) { @@ -317,6 +331,8 @@ namespace BeWo.ViewModel bDataContract.Belegungen = null; + bDataContract.Grundrisse = Grundrisse.ToList(); + return bDataContract; } diff --git a/Shared/DataContracts/ImageDC.cs b/Shared/DataContracts/ImageDC.cs index 4c738c252..5a86b5d2b 100644 --- a/Shared/DataContracts/ImageDC.cs +++ b/Shared/DataContracts/ImageDC.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; +using System.Windows.Media.Imaging; namespace BS.Shared.DataContracts { @@ -16,5 +17,26 @@ namespace BS.Shared.DataContracts [DataMember] public string Filename { get; set; } [DataMember] public byte[] ImageData { get; set; } + + public BitmapImage BitmapImage + { + get + { + if (ImageData != null) + { + using (var ms = new System.IO.MemoryStream(ImageData)) + { + var image = new BitmapImage(); + image.BeginInit(); + image.CacheOption = BitmapCacheOption.OnLoad; // here + image.StreamSource = ms; + image.EndInit(); + return image; + } + } + + return null; + } + } } } From f451c63926f1b87fa923f7e4bd49c0717dfd1a38 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 26 Aug 2024 14:13:21 +0200 Subject: [PATCH 071/103] IsDirty bei ObservColl ImageDC --- .../WohneinheitGrundrissControl.xaml | 63 +++++++++++-------- .../WohneinheitGrundrissControl.xaml.cs | 24 +++---- BeWo/ViewModel/WohneinheitVM.cs | 18 +++++- Shared/DataContracts/ImageDC.cs | 1 + 4 files changed, 69 insertions(+), 37 deletions(-) diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml index 02a72c86e..1156cfaec 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml @@ -8,10 +8,18 @@ mc:Ignorable="d"> + - + @@ -22,38 +30,43 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs index b7f6bfc67..8d3df2276 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs @@ -32,7 +32,7 @@ namespace BeWo.View.Detail.Wohneinheit this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => { - BeWoApp.MainControl.CloseCurrentPopUp(); + BeWoApp.MainControl.CloseCurrentPopUp(); })); Images = images; @@ -49,19 +49,21 @@ namespace BeWo.View.Detail.Wohneinheit // Show open file dialog box bool? result = dialog.ShowDialog(); - // Process open file dialog box results - if (result == true) - { - // Open document - string filename = dialog.FileName; + if (result != true) + return; - var dc = new ImageDC(); + var info = new FileInfo(dialog.FileName); - dc.Filename = filename; - dc.ImageData = File.ReadAllBytes(filename); + if (!info.Exists) + return; - Images.Add(dc); - } + var dc = new ImageDC(); + + dc.Filename = info.Name; + dc.Fullname = info.FullName; + dc.ImageData = File.ReadAllBytes(info.FullName); + + Images.Add(dc); } private void MenuItem_Del_Click(object sender, RoutedEventArgs e) diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 21316679b..8602e678d 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -32,6 +32,7 @@ namespace BeWo.ViewModel private string _Zusatznotiz; private string _Stock; private ObservableCollection _Grundrisse; + private bool _GrundrisseIsDirty; public WohneinheitVM() { @@ -248,14 +249,29 @@ namespace BeWo.ViewModel } public ObservableCollection Grundrisse { - get => _Grundrisse ?? (_Grundrisse = new ObservableCollection()); + get => _Grundrisse ?? (Grundrisse = new ObservableCollection()); set { + if (_Grundrisse is object) + _Grundrisse.CollectionChanged -= GrundrisseCollectionChanged; + _Grundrisse = value; + + if (_Grundrisse is object) + _Grundrisse.CollectionChanged += GrundrisseCollectionChanged; + FirePropertyChanged(nameof(Grundrisse)); } } + public void GrundrisseCollectionChanged(object sender, EventArgs e) + { + _GrundrisseIsDirty = true; + FirePropertyChanged(nameof(IsDirty)); + } + + public override bool IsDirty => base.IsDirty || _GrundrisseIsDirty; + public bool IsEinzelwohnung => string.IsNullOrEmpty(Zimmername); public string Caption => IsEinzelwohnung ? Wohnname : Zimmername ; diff --git a/Shared/DataContracts/ImageDC.cs b/Shared/DataContracts/ImageDC.cs index 5a86b5d2b..fcfb8422b 100644 --- a/Shared/DataContracts/ImageDC.cs +++ b/Shared/DataContracts/ImageDC.cs @@ -16,6 +16,7 @@ namespace BS.Shared.DataContracts //[DataMember] public long OwnerOid { get; set; } [DataMember] public string Filename { get; set; } + [DataMember] public string Fullname { get; set; } [DataMember] public byte[] ImageData { get; set; } public BitmapImage BitmapImage From 30ac5a97ecea205131e5133468b3c35945aca2a3 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 26 Aug 2024 14:31:05 +0200 Subject: [PATCH 072/103] ImageVM + ImageVMList --- BeWo/BeWo.csproj | 2 + .../WohneinheitGrundrissControl.xaml.cs | 24 ++-- BeWo/View/Detail/WohnheimView.xaml.cs | 2 +- BeWo/ViewModel/ImageVM.cs | 103 ++++++++++++++++++ BeWo/ViewModel/ListViewModel/ImageListVM.cs | 17 +++ BeWo/ViewModel/WohneinheitVM.cs | 33 ++---- Shared/DataContracts/ImageDC.cs | 21 ---- 7 files changed, 147 insertions(+), 55 deletions(-) create mode 100644 BeWo/ViewModel/ImageVM.cs create mode 100644 BeWo/ViewModel/ListViewModel/ImageListVM.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 0b1d5e6bf..ed49ae5b0 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -1067,6 +1067,8 @@ + + diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs index 8d3df2276..83b6e34e4 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml.cs @@ -1,4 +1,6 @@ -using BS.Shared.DataContracts; +using BeWo.ViewModel; +using BeWo.ViewModel.ListViewModel; +using BS.Shared.DataContracts; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -23,9 +25,9 @@ namespace BeWo.View.Detail.Wohneinheit /// public partial class WohneinheitGrundrissControl : BeWoView { - public ObservableCollection Images { get; set; } + public ImageListVM Images { get; set; } - public WohneinheitGrundrissControl(ObservableCollection images) + public WohneinheitGrundrissControl(ImageListVM images) { InitializeComponent(); @@ -37,7 +39,7 @@ namespace BeWo.View.Detail.Wohneinheit Images = images; - DataContext = Images; + DataContext = Images.VMList; } private void MenuItem_Add_Click(object sender, RoutedEventArgs e) @@ -57,23 +59,23 @@ namespace BeWo.View.Detail.Wohneinheit if (!info.Exists) return; - var dc = new ImageDC(); + var vm = new ImageVM(); - dc.Filename = info.Name; - dc.Fullname = info.FullName; - dc.ImageData = File.ReadAllBytes(info.FullName); + vm.Filename = info.Name; + vm.Fullname = info.FullName; + vm.ImageData = File.ReadAllBytes(info.FullName); - Images.Add(dc); + Images.VMList.Add(vm); } private void MenuItem_Del_Click(object sender, RoutedEventArgs e) { - var t = PhotosListBox.SelectedItem as ImageDC; + var t = PhotosListBox.SelectedItem as ImageVM; if (t is null) return; - Images.Remove(t); + Images.VMList.Remove(t); } } } diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 551c27641..09b0b7229 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -856,7 +856,7 @@ namespace BeWo.View.Detail var vm = datagrid_wohneinheiten.GetCurrentValue(); - var control = new WohneinheitGrundrissControl(vm.Grundrisse); + var control = new WohneinheitGrundrissControl(vm.ImageListVM); BeWoApp.MainControl.ShowControlAsModalPopup(control); diff --git a/BeWo/ViewModel/ImageVM.cs b/BeWo/ViewModel/ImageVM.cs new file mode 100644 index 000000000..b6654976b --- /dev/null +++ b/BeWo/ViewModel/ImageVM.cs @@ -0,0 +1,103 @@ +using System; +using System.Windows.Media.Imaging; +using BS.Shared; +using BS.Shared.DataContracts; + +namespace BeWo.ViewModel +{ + public class ImageVM : AbstractDCMapperVM + { + private string _Filename; + private string _Fullname; + private byte[] _ImageData; + + public ImageVM() : this(new ImageDC()) + { + + } + public ImageVM(ImageDC dc) : base(dc, dc.Oid == null) + { + + } + + public string Filename + { + get { return _Filename; } + set + { + if (!AreDifferent(_Filename, value)) + return; + + _Filename = value; + StoreDirtyInformation(AreDifferent(DataContract.Filename, value), nameof(Filename)); + FirePropertyChanged(nameof(Filename)); + } + } + + public string Fullname + { + get { return _Fullname; } + set + { + if (!AreDifferent(_Fullname, value)) + return; + + _Fullname = value; + StoreDirtyInformation(AreDifferent(DataContract.Fullname, value), nameof(Fullname)); + FirePropertyChanged(nameof(Fullname)); + } + } + + public byte[] ImageData + { + get { return _ImageData; } + set + { + if (!AreDifferent(_ImageData, value)) + return; + + _ImageData = value; + StoreDirtyInformation(AreDifferent(DataContract.ImageData, value), nameof(ImageData)); + FirePropertyChanged(nameof(ImageData)); + FirePropertyChanged(nameof(BitmapImage)); + } + } + + public BitmapImage BitmapImage + { + get + { + if (ImageData != null) + { + using (var ms = new System.IO.MemoryStream(ImageData)) + { + var image = new BitmapImage(); + image.BeginInit(); + image.CacheOption = BitmapCacheOption.OnLoad; // here + image.StreamSource = ms; + image.EndInit(); + return image; + } + } + + return null; + } + } + + protected override void InitByDataContract(ImageDC pDataContract) + { + _Filename = pDataContract.Filename; + _Fullname = pDataContract.Fullname; + _ImageData = pDataContract.ImageData; + } + + protected override ImageDC MapToDataContract(ImageDC pDataContract, bool doCommit) + { + pDataContract.Filename = _Filename; + pDataContract.Fullname = _Fullname; + pDataContract.ImageData = _ImageData; + + return pDataContract; + } + } +} diff --git a/BeWo/ViewModel/ListViewModel/ImageListVM.cs b/BeWo/ViewModel/ListViewModel/ImageListVM.cs new file mode 100644 index 000000000..39f4b1601 --- /dev/null +++ b/BeWo/ViewModel/ListViewModel/ImageListVM.cs @@ -0,0 +1,17 @@ +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.ViewModel.ListViewModel +{ + public class ImageListVM : AbstractDCListMapperVM + { + public ImageListVM(List pDCs) : base(pDCs) + { + + } + } +} diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 8602e678d..9c2993e60 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -31,8 +31,7 @@ namespace BeWo.ViewModel private string _Mobilierung; private string _Zusatznotiz; private string _Stock; - private ObservableCollection _Grundrisse; - private bool _GrundrisseIsDirty; + private ImageListVM _ImageListVM; public WohneinheitVM() { @@ -247,30 +246,21 @@ namespace BeWo.ViewModel } } } - public ObservableCollection Grundrisse + public ImageListVM ImageListVM { - get => _Grundrisse ?? (Grundrisse = new ObservableCollection()); + get { return _ImageListVM; } + set { - if (_Grundrisse is object) - _Grundrisse.CollectionChanged -= GrundrisseCollectionChanged; + if (_ImageListVM == value) + return; - _Grundrisse = value; - - if (_Grundrisse is object) - _Grundrisse.CollectionChanged += GrundrisseCollectionChanged; - - FirePropertyChanged(nameof(Grundrisse)); + _ImageListVM = value; + FirePropertyChanged(nameof(ImageListVM)); } } - public void GrundrisseCollectionChanged(object sender, EventArgs e) - { - _GrundrisseIsDirty = true; - FirePropertyChanged(nameof(IsDirty)); - } - - public override bool IsDirty => base.IsDirty || _GrundrisseIsDirty; + public override bool IsDirty => base.IsDirty || ImageListVM.IsDirty; public bool IsEinzelwohnung => string.IsNullOrEmpty(Zimmername); @@ -322,8 +312,7 @@ namespace BeWo.ViewModel _Zusatznotiz = pDataContract.Zusatznotiz; _Stock = pDataContract.Stock; - if(pDataContract.Grundrisse != null) - _Grundrisse = new ObservableCollection(pDataContract.Grundrisse); + _ImageListVM = new ImageListVM(pDataContract.Grundrisse ?? (pDataContract.Grundrisse = new List())); } protected override WohneinheitDC MapToDataContract(WohneinheitDC bDataContract, bool doCommit) { @@ -347,7 +336,7 @@ namespace BeWo.ViewModel bDataContract.Belegungen = null; - bDataContract.Grundrisse = Grundrisse.ToList(); + bDataContract.Grundrisse = ImageListVM.CopyToDCList(doCommit); return bDataContract; } diff --git a/Shared/DataContracts/ImageDC.cs b/Shared/DataContracts/ImageDC.cs index fcfb8422b..4e52c270d 100644 --- a/Shared/DataContracts/ImageDC.cs +++ b/Shared/DataContracts/ImageDC.cs @@ -18,26 +18,5 @@ namespace BS.Shared.DataContracts [DataMember] public string Filename { get; set; } [DataMember] public string Fullname { get; set; } [DataMember] public byte[] ImageData { get; set; } - - public BitmapImage BitmapImage - { - get - { - if (ImageData != null) - { - using (var ms = new System.IO.MemoryStream(ImageData)) - { - var image = new BitmapImage(); - image.BeginInit(); - image.CacheOption = BitmapCacheOption.OnLoad; // here - image.StreamSource = ms; - image.EndInit(); - return image; - } - } - - return null; - } - } } } From 1382b97c81765a1f0edec639867d322f1c49291b Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 26 Aug 2024 15:51:36 +0200 Subject: [PATCH 073/103] Enitty + Mapper --- Data/Data.csproj | 1 + Data/Entities/ImageSimple.cs | 70 +++++++++++++++++++ Service/DCEntityMapper/ImageDC_ImageSimple.cs | 56 +++++++++++++++ Service/DCEntityMapper/MapperFactory.cs | 5 ++ Service/Service.csproj | 1 + Shared/BeWoEntityEnums.cs | 3 +- 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 Data/Entities/ImageSimple.cs create mode 100644 Service/DCEntityMapper/ImageDC_ImageSimple.cs diff --git a/Data/Data.csproj b/Data/Data.csproj index 78ca41230..d8923a623 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -220,6 +220,7 @@ + diff --git a/Data/Entities/ImageSimple.cs b/Data/Entities/ImageSimple.cs new file mode 100644 index 000000000..dbc1277c7 --- /dev/null +++ b/Data/Entities/ImageSimple.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; + +using BS.Shared; +using BS.Shared.Core; + +namespace BeWo.Data.Entities +{ + public class ImageSimple : BeWoEntityBase + { + private BeWoEntityBase _Parent; + + private string _Filename; + private string _Fullname; + private byte[] _ImageData; + + public ImageSimple() + { + _Tid = TableID.ImageSimple; + } + + public virtual BeWoEntityBase Parent + { + get { return _Parent; } + set + { + if (!AreDifferent(_Parent, value)) + return; + + _Parent = value; + } + } + + public virtual string Filename + { + get { return _Filename; } + set + { + if (!AreDifferent(_Filename, value)) + return; + + _Filename = value; + } + } + + public virtual string Fullname + { + get { return _Fullname; } + set + { + if (!AreDifferent(_Fullname, value)) + return; + + _Fullname = value; + } + } + + public virtual byte[] ImageData + { + get { return _ImageData; } + set + { + if (!AreDifferent(_ImageData, value)) + return; + + _ImageData = value; + } + } + } +} diff --git a/Service/DCEntityMapper/ImageDC_ImageSimple.cs b/Service/DCEntityMapper/ImageDC_ImageSimple.cs new file mode 100644 index 000000000..a48eac4e4 --- /dev/null +++ b/Service/DCEntityMapper/ImageDC_ImageSimple.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Linq; + +using BeWo.Data.Access; +using BeWo.Data.Entities; + +using BS.Shared; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Wohnhilfe; + +namespace BeWo.Service.DCEntityMapper +{ + public class ImageDC_ImageSimple : AbstractIDCEntityMapper + { + public ImageDC MergeWithDC(ImageSimple pEntity, ImageDC pDataContract, WohneinheitDC wohneinheit) + { + pDataContract.Filename = pEntity.Filename; + pDataContract.Fullname = pEntity.Fullname; + pDataContract.ImageData = pEntity.ImageData; + + if (wohneinheit.Grundrisse is null) + wohneinheit.Grundrisse = new List(); + + wohneinheit.Grundrisse.Add(pDataContract); + + return pDataContract; + } + + public ImageSimple MergeWithEntity(ImageDC pDataContract, ImageSimple pEntity, Wohneinheit wohneinheit) + { + pEntity.Filename = pDataContract.Filename; + pEntity.Fullname = pDataContract.Fullname; + pEntity.ImageData = pDataContract.ImageData; + + pEntity.Parent = wohneinheit; + + return pEntity; + } + + public override ImageDC MergeWithDC(ImageSimple pEntity, ImageDC pDataContract) + { + throw new System.NotImplementedException(); + } + + public override ImageSimple MergeWithEntity(ImageDC pDataContract, ImageSimple pEntity) + { + throw new System.NotImplementedException(); + } + + protected override bool AreDCAndEntityEqual(ImageDC pDC, ImageSimple pEntity) + { + throw new System.NotImplementedException(); + } + } +} diff --git a/Service/DCEntityMapper/MapperFactory.cs b/Service/DCEntityMapper/MapperFactory.cs index ff15934d2..382c71006 100644 --- a/Service/DCEntityMapper/MapperFactory.cs +++ b/Service/DCEntityMapper/MapperFactory.cs @@ -304,6 +304,8 @@ namespace BeWo.Service.DCEntityMapper private static FalldatenDC_CustomerFalldaten _FalldatenDC_CustomerFalldaten; + private static ImageDC_ImageSimple _ImageDC_ImageSimple; + public static MedRecordDC_MedRecord MedRecordDC_MedRecord => _MedRecordDC_MedRecord ?? (_MedRecordDC_MedRecord = new MedRecordDC_MedRecord()); @@ -763,5 +765,8 @@ namespace BeWo.Service.DCEntityMapper public static FalldatenDC_CustomerFalldaten FalldatenDC_CustomerFalldaten => _FalldatenDC_CustomerFalldaten ?? (_FalldatenDC_CustomerFalldaten = new FalldatenDC_CustomerFalldaten()); + + public static ImageDC_ImageSimple ImageDC_ImageSimple => + _ImageDC_ImageSimple ?? (_ImageDC_ImageSimple = new ImageDC_ImageSimple()); } } \ No newline at end of file diff --git a/Service/Service.csproj b/Service/Service.csproj index 7b75651b0..bd6e3df84 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -227,6 +227,7 @@ + diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index 67bb0bb87..e7db77c30 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -174,7 +174,8 @@ namespace BS.Shared GkvTransferprotokoll = 167, Wohneinheit = 168, WohneinheitBelegung = 169, - CustomerFalldaten = 170 + CustomerFalldaten = 170, + ImageSimple = 171 } public enum SystemEntryID From 46a64082115f0e7853dee29dd90adee146f37be4 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 27 Aug 2024 11:43:11 +0200 Subject: [PATCH 074/103] Style ausgelagert --- .../WohneinheitGrundrissControl.xaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml index 1156cfaec..e1ba3cff2 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitGrundrissControl.xaml @@ -9,6 +9,11 @@ + + + @@ -81,7 +137,7 @@ AllowReminders="False" AllowAppointmentConflicts="False" AppointmentWindowShowing="scheduler_buchungsplan_AppointmentWindowShowing" > - + diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungSchedulerView.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungSchedulerView.xaml.cs index 84d838901..e19377313 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungSchedulerView.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungSchedulerView.xaml.cs @@ -1,4 +1,11 @@ -using System; +using BeWo.ViewModel; +using BS.Shared.Translation; +using DevExpress.Mvvm; +using DevExpress.Xpf.Bars; +using DevExpress.Xpf.Core; +using DevExpress.Xpf.Scheduling; +using DevExpress.XtraScheduler.Native; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +19,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using ViewBase = DevExpress.Xpf.Scheduling.ViewBase; namespace BeWo.View.Detail.Wohneinheit { @@ -20,6 +28,10 @@ namespace BeWo.View.Detail.Wohneinheit /// public partial class WohneinheitBelegungSchedulerView : UserControl { + public WohnheimVM ViewModel => DataContext as WohnheimVM; + + private Window _BelegungPopupWindow; + public WohneinheitBelegungSchedulerView() { InitializeComponent(); @@ -103,6 +115,36 @@ namespace BeWo.View.Detail.Wohneinheit scheduler_buchungsplan.SelectedInterval = new DateTimeRange(selectionStart, TimeSpan.Zero); } + + private void UpdateSelectionView() + { + if (timelineViewWeek.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineView4Week.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewMonth.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewQuartal.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Month; + } + else if (timelineViewYear.IsActive) + { + dateNavigator.CalendarView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + dateNavigator.SelectionView = DevExpress.Xpf.Editors.DateNavigator.DateNavigatorCalendarView.Years; + } + } + void dateNavigatorSettings_CustomizeSelectedDates(object sender, CustomizeSelectedDatesEventArgs e) { e.Handled = CoerceDateNavigatorSelectedDates(e.Dates); @@ -212,5 +254,30 @@ namespace BeWo.View.Detail.Wohneinheit barItem.Content = Translator.TranslateKey(barItem.Name, "???"); } } + + private void scheduler_buchungsplan_AppointmentWindowShowing(object sender, AppointmentWindowShowingEventArgs e) + { + if (_BelegungPopupWindow is object && _BelegungPopupWindow.IsVisible) + { + e.Handled = true; + e.Cancel = true; + return; + } + + var vm = e.Appointment.SourceObject as WohneinheitBelegungVM; + + bool success = vm.IsNew ? ViewModel.AddBelegung(e.Appointment.ResourceId, e.Appointment.Start.Date) : ViewModel.EditBelegung(vm); + + if (success) + { + _BelegungPopupWindow = e.Window; + + e.Window.DataContext = ViewModel; + } + else + { + e.Cancel = true; + } + } } } diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml index eb6677f24..e35c8acdb 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml @@ -9,6 +9,8 @@ xmlns:local="clr-namespace:BeWo.View.Detail.Wohneinheit" xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:viewmodel="clr-namespace:BeWo.ViewModel" + DataContextChanged="UserControl_DataContextChanged" + mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=viewmodel:WohnheimVM, IsDesignTimeCreatable=true}" diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml.cs index d74b9b074..bb7ef6790 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitBelegungTableView.xaml.cs @@ -1,4 +1,7 @@ -using System; +using BeWo.ViewModel; +using BS.Shared.Extensions; +using DevExpress.Xpf.Grid; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,9 +23,11 @@ namespace BeWo.View.Detail.Wohneinheit /// public partial class WohneinheitBelegungTableView : UserControl { + public WohnheimVM ViewModel => DataContext as WohnheimVM; + public WohneinheitBelegungTableView() { - InitializeComponent(); + InitializeComponent(); } private void Button_NewBelegung_Click(object sender, RoutedEventArgs e) @@ -35,5 +40,48 @@ namespace BeWo.View.Detail.Wohneinheit if (success) popup_newBelegung.IsOpen = true; } + + private void btn_belegung_delete_Click(object sender, RoutedEventArgs e) + { + if (!ViewModel.PermissionWohneinheitBelegungDelete) + return; + + var listvm = ViewModel.WohneinheitBelegungListVM; + + if (listvm.EditVM is object) + return; + + var vm = datagrid_belegung.GetCurrentValue(); + + _ = listvm.VMList.Remove(vm); + + e.Handled = true; + } + + private void datagridview2_RowDoubleClick(object sender, RowDoubleClickEventArgs e) + { + if (popup_newBelegung.IsOpen) + return; + + var vm = datagrid_belegung.GetCurrentValue(); + + var success = ViewModel.EditBelegung(vm); + + if (success) + popup_newBelegung.IsOpen = true; + } + + private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (e.OldValue is WohnheimVM vm) + { + vm.WohneinheitBelegungListVM.PropertyChanged -= (s, args) => datagridview2.BestFitColumns(); + } + + if (e.NewValue is WohnheimVM vm2) + { + vm2.WohneinheitBelegungListVM.PropertyChanged += (s, args) => datagridview2.BestFitColumns(); + } + } } } diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitEditPopup.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitEditPopup.xaml.cs index c55e7cb2f..0278fffda 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitEditPopup.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitEditPopup.xaml.cs @@ -108,20 +108,6 @@ namespace BeWo.View.Detail.Wohneinheit } } - private void combobox_wohnungsname_DropDownClosed(object sender, EventArgs e) - { - var vm = ViewModel.WohneinheitListVM.CurrentVM; - - if (vm is null) - return; - - var selected_item = combobox_wohnungsname.SelectedItem as string; - - var selected_vm = ViewModel.WohneinheitListVM.VMList.FirstOrDefault(x => x.Wohnname == selected_item); - - SetValuesFromParent(vm, selected_vm); - } - private void SetValuesFromParent(WohneinheitVM vm, WohneinheitVM parent_vm) { if (vm is null || parent_vm is null) @@ -137,5 +123,19 @@ namespace BeWo.View.Detail.Wohneinheit vm.Baujahr = parent_vm.Baujahr; } } + + private void combobox_wohnungsname_DropDownClosed(object sender, EventArgs e) + { + var vm = ViewModel.WohneinheitListVM.CurrentVM; + + if (vm is null) + return; + + var selected_item = combobox_wohnungsname.SelectedItem as string; + + var selected_vm = ViewModel.WohneinheitListVM.VMList.FirstOrDefault(x => x.Wohnname == selected_item); + + SetValuesFromParent(vm, selected_vm); + } } } diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml index 4d72c8682..89cf58dfe 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml @@ -8,8 +8,8 @@ xmlns:local="clr-namespace:BeWo.View.Detail.Wohneinheit" xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:viewmodel="clr-namespace:BeWo.ViewModel" + DataContextChanged="UserControl_DataContextChanged" mc:Ignorable="d" - d:DataContext="{d:DesignInstance Type=viewmodel:WohnheimVM, IsDesignTimeCreatable=true}" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml.cs index d65ab4b3d..508243d5e 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV1.xaml.cs @@ -65,12 +65,39 @@ namespace BeWo.View.Detail.Wohneinheit var vm = datagrid_wohneinheiten.GetCurrentValue(); - if (MessageBox.Show($"Möchten Sie Wohneinheit '{vm}' wirklich löschen?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) - { - ViewModel.WohneinheitListVM.RemoveVM(vm); - } + ViewModel.WohneinheitListVM.AskRemoveVM(vm); e.Handled = true; } + + private void btn_gallery_Click(object sender, RoutedEventArgs e) + { + if (!ViewModel.PermissionWohneinheitGallery) + return; + + if (BeWoApp.MainControl.IsModalPopupOpen) + return; + + var vm = datagrid_wohneinheiten.GetCurrentValue(); + + var control = new WohneinheitGrundrissModalPopup(vm.ImageListVM); + + BeWoApp.MainControl.ShowControlAsModalPopup(control); + + e.Handled = true; + } + + private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if(e.OldValue is WohnheimVM vm) + { + vm.WohneinheitListVM.PropertyChanged -= (s, args) => datagridview.BestFitColumns(); + } + + if (e.NewValue is WohnheimVM vm2) + { + vm2.WohneinheitListVM.PropertyChanged += (s, args) => datagridview.BestFitColumns(); + } + } } } diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml index 1d4736544..2107c4fef 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml @@ -25,17 +25,121 @@ - + + + + + + + + + Hinzufügen + - - + - - - - - - - - - - + + + + + + + - - + + - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + Übernehmen + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/CustomerWohnhilfeView.xaml.cs b/BeWo/View/Detail/CustomerWohnhilfeView.xaml.cs new file mode 100644 index 000000000..11d4aa7b4 --- /dev/null +++ b/BeWo/View/Detail/CustomerWohnhilfeView.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Detail +{ + /// + /// Interaktionslogik für CustomerWohnhilfeView.xaml + /// + public partial class CustomerWohnhilfeView : UserControl + { + public bool PermissionCustomerWohnhilfeEdit { get; } = BeWoApp.HasLoggedOnUserRight(BS.Shared.UserRightType.Customer_Wohnhilfe_Edit); + public bool PermissionCustomerWohnhilfeDelete { get; } = BeWoApp.HasLoggedOnUserRight(BS.Shared.UserRightType.Customer_Wohnhilfe_Delete); + + public CustomerWohnhilfeView() + { + InitializeComponent(); + } + } +} diff --git a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml.cs b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml.cs index 622689783..53001612c 100644 --- a/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml.cs +++ b/BeWo/View/Detail/Wohneinheit/WohneinheitVerwaltungViewV2.xaml.cs @@ -61,7 +61,6 @@ namespace BeWo.View.Detail.Wohneinheit private void Button_Click(object sender, RoutedEventArgs e) { - var newvm = ViewModel.WohneinheitListVM.NewVM; ViewModel.WohneinheitListVM.AddNewVMToList(true); } diff --git a/BeWo/ViewModel/AbstractBaseVM.cs b/BeWo/ViewModel/AbstractBaseVM.cs index e5aa4082e..688cb62eb 100644 --- a/BeWo/ViewModel/AbstractBaseVM.cs +++ b/BeWo/ViewModel/AbstractBaseVM.cs @@ -1,6 +1,6 @@ using System; using System.ComponentModel; - +using BS.Shared; using BS.Shared.Core; namespace BeWo.ViewModel @@ -49,6 +49,11 @@ namespace BeWo.ViewModel : !lResult.Different; } + //public bool HasLoggedOnUserRight(UserRightType type) + // { + // return BeWoApp.HasLoggedOnUserRight(type); + // } + protected virtual void FirePropertyChanged(string pPropertyName) { FirePropertyChanged(PropertyChanged, this, pPropertyName); diff --git a/BeWo/ViewModel/CustomerFalldatenVM.cs b/BeWo/ViewModel/CustomerFalldatenVM.cs index 7cf106d0a..f20f80641 100644 --- a/BeWo/ViewModel/CustomerFalldatenVM.cs +++ b/BeWo/ViewModel/CustomerFalldatenVM.cs @@ -46,11 +46,13 @@ namespace BeWo.ViewModel private bool _BesonderheitVermittlungAusHaft; private bool _BesonderheitDurchBGBWAufgesucht; - public CustomerFalldatenVM(FalldatenDC dc) : base(dc, dc.IsNew) + public CustomerFalldatenVM(CustomerVM cust, FalldatenDC dc) : base(dc, dc.IsNew) { - + Customer = cust; } + public CustomerVM Customer { get; set; } + public bool PermissionFalldatenEdit { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Falldaten_Edit); public bool NoPermissionFalldatenEdit => !PermissionFalldatenEdit; diff --git a/BeWo/ViewModel/CustomerVM.cs b/BeWo/ViewModel/CustomerVM.cs index 9e0c6ee7a..cf8b5a40c 100644 --- a/BeWo/ViewModel/CustomerVM.cs +++ b/BeWo/ViewModel/CustomerVM.cs @@ -237,8 +237,14 @@ namespace BeWo.ViewModel private SubstitutionNeed _SubstitutionNeed; private CustomerFalldatenVM _CustomerFalldatenVM; + private CustomerWohnhilfeListVM _CustomerWohnhilfeListVM; + public CustomerVM() + { + // Designer + InitByDataContract(new CustomerDC()); + } public CustomerVM(CustomerDC pDataContract, IEnumerable pValueList, List pPossibleASCs, List pPossibleASVs, List pPossibleMedArten) : base(pDataContract, pDataContract.CustomerOid == null) { var possibleDisabilities = pValueList.Where(vle => vle.Type == ValueListEntryType.DisabilityType); @@ -298,6 +304,7 @@ namespace BeWo.ViewModel } public bool PermissionFalldatenView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Falldaten_View); + public bool PermissionWohnhilfeView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_View); public ArbeitszeitListVM Arbeitszeiten { @@ -309,8 +316,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Arbeitszeiten); } } - - public SubstitutionNeed SubstitutionNeed { get => _SubstitutionNeed; @@ -325,7 +330,6 @@ namespace BeWo.ViewModel } } } - //Wird noch benötigt //public BargeldverwaltungsVM Bargeldverwaltung //{ @@ -338,7 +342,6 @@ namespace BeWo.ViewModel // FirePropertyChanged(PropertyName_Bargeldverwaltung); // } //} - public AbsenceTimeListVM AbsenceTimes { get => _AbsenceTimes; @@ -349,7 +352,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_AbsenceTimes); } } - public CompactPersonDC Ansprechpartner { get { return _Ansprechpartner; } @@ -364,7 +366,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Ansprechpartner); } } - public BindingList MedArten { get { return _MedArten; } @@ -374,7 +375,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_MedArten); } } - public BindingList AssessmentSheetCategories { get { return _AssessmentSheetCategories; } @@ -385,7 +385,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_AssessmentSheetCategories); } } - public AssessmentSheetCategoryListVM IndividualAssessmentSheetCategories { get { return _IndividualAssessmentSheetCategories; } @@ -396,7 +395,6 @@ namespace BeWo.ViewModel FirePropertyChanged("IndividualAssessmentSheetCategories"); } } - public string Childs { get { return _Childs; } @@ -413,7 +411,6 @@ namespace BeWo.ViewModel } } } - public CustomerCostBearerRelationListVM CostBearers { get { return _CostBearers; } @@ -424,12 +421,10 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_CostBearers); } } - public ObservableSortCollection CustomerCareTypes { get { return _CustomerCareTypes ?? (_CustomerCareTypes = new ObservableSortCollection(Comparer.ValueListEntryDCComparer)); } } - public DateTime? DateOfBirth { get { return _DateOfBirth; } @@ -446,7 +441,6 @@ namespace BeWo.ViewModel } } } - public DateTime? AufenthaltGueltigBis { get { return _AufenthaltGueltigBis; } @@ -463,8 +457,6 @@ namespace BeWo.ViewModel } } } - - public string DebitorNumber { get { return _DebitorNumber; } @@ -481,7 +473,6 @@ namespace BeWo.ViewModel } } } - public string CostCenter { get { return _CostCenter; } @@ -498,7 +489,6 @@ namespace BeWo.ViewModel } } } - public string Diagnosis { get { return _Diagnosis; } @@ -515,12 +505,10 @@ namespace BeWo.ViewModel } } } - public ObservableSortCollection Disabilities { get { return _Disabilities ?? (_Disabilities = new ObservableSortCollection(Comparer.ValueListEntryDCComparer)); } } - public string EMail { get { return _EMail; } @@ -538,7 +526,6 @@ namespace BeWo.ViewModel } } } - public CustomerEmployeeRelationListVM EmployeeRelations { get { return _EmployeeRelations; } @@ -549,7 +536,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_EmployeeRelations); } } - public WohnheimCustomerRelationListVM WohnheimRelations { get { return _WohnheimRelations; } @@ -560,7 +546,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_WohnheimRelations); } } - public CustomerTeamRelationListVM TeamRelations { get { return _TeamRelations; } @@ -570,8 +555,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_TeamRelations); } } - - public CustomerPersonRelationListVM EnvironmentPersons { get @@ -585,8 +568,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_EnvironmentPersons); } } - - public CustomerPersonRelationListVM EnvironmentPersonsWithFamily { get @@ -599,7 +580,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_EnvironmentPersonsWithFamily); } } - public CustomerOrganisationRelationListVM EnvironmentOrganisations { get { return _EnvironmentOrganisations; } @@ -610,7 +590,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_EnvironmentOrganisations); } } - public string EquityContribution { get { return String.Format("{0:n}", _EquityContribution); } @@ -629,7 +608,6 @@ namespace BeWo.ViewModel } } } - public FamilyStatus? FamilyStatus { get { return _FamilyStatus; } @@ -644,7 +622,6 @@ namespace BeWo.ViewModel } } } - public string Fax { get { return _Fax; } @@ -680,9 +657,7 @@ namespace BeWo.ViewModel } } } - public BindingList ICD10Codes { get; set; } - public string ICD10Diagnosis { get { return _ICD10Diagnosis; } @@ -699,7 +674,6 @@ namespace BeWo.ViewModel } } } - public string InvoiceAddressLine1 { get { return _InvoiceAddressLine1; } @@ -714,7 +688,6 @@ namespace BeWo.ViewModel } } } - public string InvoiceAddressLine2 { get { return _InvoiceAddressLine2; } @@ -729,7 +702,6 @@ namespace BeWo.ViewModel } } } - public string InvoiceAddressPostalCode { get { return _InvoiceAddressPostalCode; } @@ -744,7 +716,6 @@ namespace BeWo.ViewModel } } } - public string InvoiceAddressStreet { get { return _InvoiceAddressStreet; } @@ -759,7 +730,6 @@ namespace BeWo.ViewModel } } } - public string InvoiceAddressTown { get { return _InvoiceAddressTown; } @@ -774,7 +744,6 @@ namespace BeWo.ViewModel } } } - public bool IsAdvised { get { return _IsAdvised; } @@ -793,7 +762,6 @@ namespace BeWo.ViewModel } } } - public bool IsArchived { get => _IsArchived; @@ -810,7 +778,6 @@ namespace BeWo.ViewModel } } } - public ActivationTypeId ActivationType { get => _ActivationType; @@ -825,8 +792,7 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_ActivationType); } } - } - + } public bool IsMigrant { get { return _IsMigrant; } @@ -841,7 +807,6 @@ namespace BeWo.ViewModel } } } - public bool IsAttended { get { return _IsAttended; } @@ -860,7 +825,6 @@ namespace BeWo.ViewModel } } } - public override bool IsDirty { get @@ -876,7 +840,6 @@ namespace BeWo.ViewModel _PlacementList.IsDirty || _MedVerordnungslisten.IsDirty || _EnvironmentPersonsWithFamily.IsDirty || _Arbeitszeiten.IsDirty || _CustomerFalldatenVM.IsDirty; } } - public bool IsFemale { get { return _IsFemale; } @@ -897,7 +860,6 @@ namespace BeWo.ViewModel } } } - public bool IsMale { get { return _IsMale; } @@ -918,7 +880,6 @@ namespace BeWo.ViewModel } } } - public bool IsDivers { get { return _IsDivers; } @@ -939,7 +900,6 @@ namespace BeWo.ViewModel } } } - [Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)] public string LastName { @@ -957,7 +917,6 @@ namespace BeWo.ViewModel } } } - public string Medication { get { return _Medication; } @@ -972,7 +931,6 @@ namespace BeWo.ViewModel } } } - public string VersichertenStatus { get { return _VersichertenStatus; } @@ -987,7 +945,6 @@ namespace BeWo.ViewModel } } } - public string Environment { get { return _Environment; } @@ -1002,7 +959,6 @@ namespace BeWo.ViewModel } } } - public string MobilePhone { get { return _MobilePhone; } @@ -1021,7 +977,6 @@ namespace BeWo.ViewModel } } } - public string Migrationshintergrund { get { return this._Migrationshintergrund; } @@ -1038,7 +993,6 @@ namespace BeWo.ViewModel } } } - public string Notice { get { return _Notice; } @@ -1059,7 +1013,6 @@ namespace BeWo.ViewModel } } } - public CompactOrganisationDC Jugendamt { get { return _Jugendamt; } @@ -1074,7 +1027,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Jugendamt); } } - public string Phone { get { return _Phone; } @@ -1092,7 +1044,6 @@ namespace BeWo.ViewModel } } } - public PlacementListVM PlacementList { get { return _PlacementList; } @@ -1103,7 +1054,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_PlacementList); } } - public ObservableSortCollection PlacementObjectives { get @@ -1116,17 +1066,14 @@ namespace BeWo.ViewModel return _PlacementObjectives; } } - public ObservableSortCollection PossibleCustomerCareTypes { get { return _PossibleCustomerCareTypes; } } - public ObservableSortCollection PossibleDisabilities { get { return _PossibleDisabilities; } } - public string PostalCode { get { return _PostalCode; } @@ -1143,7 +1090,6 @@ namespace BeWo.ViewModel } } } - public string Profession { get { return _Profession; } @@ -1160,7 +1106,6 @@ namespace BeWo.ViewModel } } } - public string ReferenceNumber { get { return _ReferenceNumber; } @@ -1177,7 +1122,6 @@ namespace BeWo.ViewModel } } } - public string Street { get { return _Street; } @@ -1194,7 +1138,6 @@ namespace BeWo.ViewModel } } } - public int? DistanceInMeter { get { return _DistanceInMeter; } @@ -1209,7 +1152,6 @@ namespace BeWo.ViewModel } } } - public string AddressLine1 { get { return this._AddressLine1; } @@ -1224,7 +1166,6 @@ namespace BeWo.ViewModel } } } - public string Kindesmutter { get { return _Kindesmutter; } @@ -1239,7 +1180,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Kindesmutter); } } - public string Kindesvater { get { return _Kindesvater; } @@ -1254,7 +1194,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Kindesvater); } } - public string Geschwister { get { return _Geschwister; } @@ -1269,7 +1208,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Geschwister); } } - public string Vormund { get { return _Vormund; } @@ -1284,7 +1222,6 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_Vormund); } } - public DateTime? TerminationDate { get { return _TerminationDate; } @@ -1301,7 +1238,6 @@ namespace BeWo.ViewModel } } } - public DateTime? AssistanceBegin { get { return _AssistanceBegin; } @@ -1318,7 +1254,6 @@ namespace BeWo.ViewModel } } } - public ValueListEntryDC TerminationReason { get { return _TerminationReason; } @@ -1335,12 +1270,10 @@ namespace BeWo.ViewModel } } } - public ObservableSortCollection TerminationReasons { get { return _TerminationReasons ?? (_TerminationReasons = new ObservableSortCollection()); } } - public string Town { get { return _Town; } @@ -1357,7 +1290,6 @@ namespace BeWo.ViewModel } } } - public VarFieldListVM VarFields { get { return _VarFields; } @@ -1371,7 +1303,6 @@ namespace BeWo.ViewModel } } } - public string AusstVersAmt { get { return _AusstVersAmt; } @@ -1386,8 +1317,7 @@ namespace BeWo.ViewModel } } } - - public DateTime? AusweisGueltigVon + public DateTime? AusweisGueltigVon { get { return _AusweisGueltigVon; } @@ -1401,7 +1331,6 @@ namespace BeWo.ViewModel } } } - public DateTime? AusweisGueltigBis { get { return _AusweisGueltigBis; } @@ -1416,7 +1345,6 @@ namespace BeWo.ViewModel } } } - public bool AusweisUnbefristetGueltig { get { return _AusweisUnbefristetGueltig; } @@ -1437,7 +1365,6 @@ namespace BeWo.ViewModel } } } - public string AusweisAktenzeichen { get { return _AusweisAktenzeichen; } @@ -1454,7 +1381,6 @@ namespace BeWo.ViewModel } } } - public DateTime? BeiblattGueltigBis { get { return _BeiblattGueltigBis; } @@ -1469,7 +1395,6 @@ namespace BeWo.ViewModel } } } - public string GradDerBehinderung { get { return _GradDerBehinderung; } @@ -1483,8 +1408,7 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_GradDerBehinderung); } } - } - + } public Byte[] CustomerImage { get { return _CustomerImage; } @@ -1499,7 +1423,6 @@ namespace BeWo.ViewModel } } } - public ValueListEntryDC Nationalitaet { get { return this._Nationalitaet; } @@ -1516,7 +1439,6 @@ namespace BeWo.ViewModel } } } - public ValueListEntryDC AufenthaltsStatus { get { return this._AufenthaltsStatus; } @@ -1533,7 +1455,6 @@ namespace BeWo.ViewModel } } } - public ObservableSortCollection Nationalitaeten { get @@ -1546,7 +1467,6 @@ namespace BeWo.ViewModel return this._Nationalitaeten; } } - public ObservableSortCollection RoleInFamilys { get @@ -1559,7 +1479,6 @@ namespace BeWo.ViewModel return this._RoleInFamilys; } } - public ObservableSortCollection AufenthaltsStatuse { get @@ -1572,7 +1491,6 @@ namespace BeWo.ViewModel return this._AufenthaltsStatuse; } } - public ObservableCollection BehinderungsartenListe { get { return _BehinderungsartenListe ?? (_BehinderungsartenListe = new ObservableCollection()); } @@ -1588,7 +1506,6 @@ namespace BeWo.ViewModel } } } - public ObservableCollection MerkzeichenListe { get { return _MerkzeichenListe ?? (_MerkzeichenListe = new ObservableCollection()); } @@ -1604,13 +1521,11 @@ namespace BeWo.ViewModel } } } - public void EnableLogging(bool enable, StringBuilder log) { _EnableLogging = enable; _Log = log; } - public bool VertretungGewuenscht { get { return _VertretungGewuenscht; } @@ -1625,7 +1540,6 @@ namespace BeWo.ViewModel } } } - public int AbWelchemKrankheitsTag { get @@ -1645,8 +1559,7 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_AbWelchemKrankheitsTag); } } - } - + } public bool VertretungDringendErforderlich { get { return _VertretungDringendErforderlich ; } @@ -1661,7 +1574,6 @@ namespace BeWo.ViewModel } } } - public bool Pflege { get { return _Pflege; } @@ -1676,8 +1588,7 @@ namespace BeWo.ViewModel } } } - - public bool Toilettengang + public bool Toilettengang { get { return _Toilettengang; } @@ -1691,7 +1602,6 @@ namespace BeWo.ViewModel } } } - public bool Aggressiv { get { return _Aggressiv; } @@ -1706,7 +1616,6 @@ namespace BeWo.ViewModel } } } - public bool Hygienebelehrung { get { return _Hygienebelehrung; } @@ -1721,7 +1630,6 @@ namespace BeWo.ViewModel } } } - public string Schutzstufe { get { return _Schutzstufe; } @@ -1736,7 +1644,6 @@ namespace BeWo.ViewModel } } } - public string Uebernahmeort { get { return _Uebernahmeort; } @@ -1751,7 +1658,6 @@ namespace BeWo.ViewModel } } } - public string Verhalten { get { return _Verhalten; } @@ -1766,7 +1672,6 @@ namespace BeWo.ViewModel } } } - public string Betreuungsbedarf { get { return _Betreuungsbedarf; } @@ -1781,7 +1686,6 @@ namespace BeWo.ViewModel } } } - public string BemerkungenSbd { get { return _BemerkungenSbd; } @@ -1796,7 +1700,6 @@ namespace BeWo.ViewModel } } } - public string HealthInsurance { get { return _HealthInsurance; } @@ -1825,7 +1728,6 @@ namespace BeWo.ViewModel } } } - public ObservableSortCollection EintragKategorien { get => _EintragKategorien; @@ -1839,7 +1741,6 @@ namespace BeWo.ViewModel } } } - public CustomerFalldatenVM CustomerFalldatenVM { get { return _CustomerFalldatenVM; } @@ -1852,6 +1753,19 @@ namespace BeWo.ViewModel FirePropertyChanged(nameof(CustomerFalldatenVM)); } } + public CustomerWohnhilfeListVM CustomerWohnhilfeListVM + { + get { return _CustomerWohnhilfeListVM; } + + set + { + if (!AreDifferent(CustomerWohnhilfeListVM, value)) + return; + _CustomerWohnhilfeListVM = value; + FirePropertyChanged(nameof(CustomerWohnhilfeListVM)); + } + } + #region Medikamentenverordnungslisten @@ -1887,17 +1801,14 @@ namespace BeWo.ViewModel { get { return MedVerordnungslisten.VMList.FirstOrDefault(vm => vm.Gueltig && false == vm.MedListType); } } - public MedikamentenverordnungslisteVM Bedarfsmedikamentenverordnungsliste { get { return MedVerordnungslisten.VMList.FirstOrDefault(vm => vm.Gueltig && vm.MedListType); } } - public List UngueltigeVerordnungen { get { return MedVerordnungslisten.VMList.Where(vm => !vm.Gueltig).ToList(); } } - public string CustomerAlias { get { return _CustomerAlias; } @@ -1911,8 +1822,7 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_CustomerAlias); } } - } - + } public Pflegegrad? Pflegegrad { get { return _Pflegegrad; } @@ -2088,7 +1998,7 @@ namespace BeWo.ViewModel } } - CustomerFalldatenVM = new CustomerFalldatenVM(pDataContract.FalldatenDC ?? (pDataContract.FalldatenDC = new FalldatenDC(true))); + CustomerFalldatenVM = new CustomerFalldatenVM(this, pDataContract.FalldatenDC ?? (pDataContract.FalldatenDC = new FalldatenDC(true))); EnvironmentPersons = VMFactory.CreateCustomerEnvironmentPersonRelListVM(dcListUmfeld, ValueListEntryType.EnvironmentPersonType); EnvironmentPersonsWithFamily = VMFactory.CreateCustomerEnvironmentPersonRelListVM(dcListFamily, ValueListEntryType.RoleInFamily); @@ -2107,8 +2017,16 @@ namespace BeWo.ViewModel ICD10Codes.ListChanged += (s, e) => StoreDirtyInformation(true, "ICD10Codes"); MedVerordnungslisten = VMFactory.CreateMedikementenverordnungslisteListVM(pDataContract.Medikamentenverordnungslisten); - } + pDataContract.CustomerWohnhilfeDC = new List(); + pDataContract.CustomerWohnhilfeDC.Add(new CustomerWohnhilfeDC()); + pDataContract.CustomerWohnhilfeDC.Add(new CustomerWohnhilfeDC()); + pDataContract.CustomerWohnhilfeDC.Add(new CustomerWohnhilfeDC()); + pDataContract.CustomerWohnhilfeDC.Add(new CustomerWohnhilfeDC()); + pDataContract.CustomerWohnhilfeDC.Add(new CustomerWohnhilfeDC()); + + CustomerWohnhilfeListVM = new CustomerWohnhilfeListVM(this, pDataContract.CustomerWohnhilfeDC ?? (pDataContract.CustomerWohnhilfeDC = new List())); + } protected override CustomerDC MapToDataContract(CustomerDC pDataContract, bool doCommit) { pDataContract.DateOfBirth = _DateOfBirth; @@ -2280,9 +2198,13 @@ namespace BeWo.ViewModel pDataContract.Arbeitszeiten = _Arbeitszeiten.CopyToDCList(doCommit); } + if(_CustomerWohnhilfeListVM != null) + { + pDataContract.CustomerWohnhilfeDC = _CustomerWohnhilfeListVM.CopyToDCList(doCommit); + } + return pDataContract; } - private void CommitContact(string pValue, ContactType pContactType) { var lOldContactDCs = DataContract.ContactInformations != null ? DataContract.ContactInformations.ToList() : new List(); @@ -2310,7 +2232,6 @@ namespace BeWo.ViewModel DataContract.ContactInformations = lOldContactDCs; } - private void Log(string log) { if (_EnableLogging && _Log != null) diff --git a/BeWo/ViewModel/CustomerWohnhilfeVM.cs b/BeWo/ViewModel/CustomerWohnhilfeVM.cs new file mode 100644 index 000000000..7b2b4b416 --- /dev/null +++ b/BeWo/ViewModel/CustomerWohnhilfeVM.cs @@ -0,0 +1,45 @@ +using BS.Shared.DataContracts; +using DevExpress.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.ViewModel +{ + public class CustomerWohnhilfeVM : AbstractDCMapperVM + { + private static int counter = 0; + + private string _Displayname; + + public CustomerWohnhilfeVM(CustomerWohnhilfeDC dc) : base(dc, dc.Oid == null) + { + + } + + public string Displayname + { + get { return _Displayname; } + set + { + if (!AreDifferent(Displayname, value)) + return; + + _Displayname = value; + FirePropertyChanged(nameof(Displayname)); + } + } + + protected override void InitByDataContract(CustomerWohnhilfeDC pDataContract) + { + Displayname = "Test " + counter++; + } + + protected override CustomerWohnhilfeDC MapToDataContract(CustomerWohnhilfeDC pDataContract, bool doCommit) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs index a9a378779..a44b5533e 100644 --- a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs +++ b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs @@ -21,6 +21,8 @@ namespace BeWo.ViewModel.ListViewModel private VMType _NewVM; + private VMType _SelectedVM; + private BindingList _VMList; //public AbstractDCListMapperVM(IEnumerable> listVMs, bool ignore) @@ -84,6 +86,16 @@ namespace BeWo.ViewModel.ListViewModel } } + public VMType SelectedVM + { + get => _SelectedVM; + set + { + _SelectedVM = value; + FirePropertyChanged(nameof(SelectedVM)); + } + } + public override bool IsDirty { get @@ -144,11 +156,11 @@ namespace BeWo.ViewModel.ListViewModel public virtual VMType AddNewVMToList() { - this.VMList.Add(this.NewVM); + VMList.Add(NewVM); // VMList.Sort(); - VMType lVM = this.NewVM; - this.NewVM = null; + VMType lVM = NewVM; + NewVM = null; //FirePropertyChanged("VMList"); return lVM; @@ -156,16 +168,19 @@ namespace BeWo.ViewModel.ListViewModel public VMType AddNewVMToList(bool pSetAsEdit) { - this._VMList.Add(this._NewVM); + // Muss hier _NewVM oder kann auch NewVM? + // Fall: _NevVM is null + // Mache unten mal neue Methode, falls das Verhalten gewünscht ist + _VMList.Add(_NewVM); // _VMList.Sort(); if (pSetAsEdit) { - this.EditVM = this._NewVM; + EditVM = _NewVM; } - this.NewVM = null; - return this.EditVM; + NewVM = null; + return EditVM; } public virtual List CommitAdded() @@ -196,6 +211,19 @@ namespace BeWo.ViewModel.ListViewModel this.EditVM = null; } + public void DeleteSelectedVM(string displayname = null) + { + if (displayname is object) + { + var res = MessageBox.Show($"Möchten Sie {displayname} wirklich löschen?", "Löschen bestätigen", MessageBoxButton.YesNo); + + if (res != MessageBoxResult.Yes) + return; + } + + VMList.Remove(SelectedVM); + } + public virtual List GetRemoved() { return this._DCBackup.Where(dc => !this._VMList.Select(vm => vm.DataContract).Contains(dc)).ToList(); diff --git a/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs b/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs new file mode 100644 index 000000000..06a91d8a8 --- /dev/null +++ b/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs @@ -0,0 +1,39 @@ +using BS.Shared; +using BS.Shared.DataContracts; +using DevExpress.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.ViewModel.ListViewModel +{ + public class CustomerWohnhilfeListVM : AbstractDCListMapperVM + { + public DelegateCommand AddWohnhilfeCommand { get; set; } + public DelegateCommand DeleteWohnhilfeCommand { get; set; } + + public CustomerVM Customer { get; set; } + + public CustomerWohnhilfeListVM(CustomerVM vm, IEnumerable wohnhilfe) : base(wohnhilfe) + { + Customer = vm; + + AddWohnhilfeCommand = new DelegateCommand(() => AddNewVMToList(), CanAddWohnhilfe); + + DeleteWohnhilfeCommand = new DelegateCommand(() => DeleteSelectedVM($"Wohnhilfe '{SelectedVM.Displayname}'"), CanDeleteWohnhilfe); + //AddWohnhilfeCommand.RaiseCanExecuteChanged(); + } + + public bool CanAddWohnhilfe() + { + return BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_Create); + } + + public bool CanDeleteWohnhilfe() + { + return BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_Delete); + } + } +} diff --git a/Data/Security/UserRightHelper.cs b/Data/Security/UserRightHelper.cs index 1958dc92c..f6c0a6577 100644 --- a/Data/Security/UserRightHelper.cs +++ b/Data/Security/UserRightHelper.cs @@ -169,8 +169,14 @@ namespace BeWo.Data.Security UserRightType.WohnheimView_Wohneinheit_View, UserRightType.WohnheimView_Wohneinheit_Gallery_Edit, UserRightType.WohnheimView_Wohneinheit_Gallery_View, + UserRightType.Customer_Falldaten_View, + UserRightType.Customer_Falldaten_Create, UserRightType.Customer_Falldaten_Edit, - UserRightType.Customer_Falldaten_View + UserRightType.Customer_Falldaten_Delete, + UserRightType.Customer_Wohnhilfe_View, + UserRightType.Customer_Wohnhilfe_Create, + UserRightType.Customer_Wohnhilfe_Edit, + UserRightType.Customer_Wohnhilfe_Delete }; if (rights_3_22.Contains(r)) diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index dd2b65c10..cbf80941d 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -514,7 +514,14 @@ namespace BS.Shared Customer_DeleteNotizen = 22112, Customer_Falldaten_View = 22120, - Customer_Falldaten_Edit = 22121, + Customer_Falldaten_Create = 22121, + Customer_Falldaten_Edit = 22122, + Customer_Falldaten_Delete = 22123, + + Customer_Wohnhilfe_View = 22130, + Customer_Wohnhilfe_Create = 22131, + Customer_Wohnhilfe_Edit = 22132, + Customer_Wohnhilfe_Delete = 22133, WohnheimView_View = 22201, WohnheimView_Edit = 22202, diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 022a9dfe3..7e38efefb 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -631,6 +631,8 @@ namespace BS.Shared.Core { var dict = new Dictionary(); + var action_keywords = new string[] { "ansehen", "anlegen", "bearbeiten", "löschen" }; + dict.Add(UserRightType.CreateAll, Translator.Translate("Alles anlegen")); dict.Add(UserRightType.AccountingTransactionView_Create, Translator.Translate("Finanzen anlegen")); @@ -656,8 +658,16 @@ namespace BS.Shared.Core dict.Add(UserRightType.Customer_ViewNotizen, Translator.Translate("Klienten") + " Notizen ansehen"); dict.Add(UserRightType.Customer_EditNotizen, Translator.Translate("Klienten") + " Notizen bearbeiten"); dict.Add(UserRightType.Customer_DeleteNotizen, Translator.Translate("Klienten") + " Notizen löschen"); - dict.Add(UserRightType.Customer_Falldaten_View, Translator.Translate("Klienten") + " Falldaten ansehen"); - dict.Add(UserRightType.Customer_Falldaten_Edit, Translator.Translate("Klienten") + " Falldaten bearbeiten"); + + dict.Add(UserRightType.Customer_Falldaten_View, $"{Translator.Translate("Klienten")} {Translator.Translate("Falldaten")} {action_keywords[0]}"); + dict.Add(UserRightType.Customer_Falldaten_Create, $"{Translator.Translate("Klienten")} {Translator.Translate("Falldaten")} {action_keywords[1]}"); + dict.Add(UserRightType.Customer_Falldaten_Edit, $"{Translator.Translate("Klienten")} {Translator.Translate("Falldaten")} {action_keywords[2]}"); + dict.Add(UserRightType.Customer_Falldaten_Delete, $"{Translator.Translate("Klienten")} {Translator.Translate("Falldaten")} {action_keywords[3]}"); + + dict.Add(UserRightType.Customer_Wohnhilfe_View, $"{Translator.Translate("Klienten")} {Translator.Translate("Wohnhilfe")} {action_keywords[0]}"); + dict.Add(UserRightType.Customer_Wohnhilfe_Create, $"{Translator.Translate("Klienten")} {Translator.Translate("Wohnhilfe")} {action_keywords[1]}"); + dict.Add(UserRightType.Customer_Wohnhilfe_Edit, $"{Translator.Translate("Klienten")} {Translator.Translate("Wohnhilfe")} {action_keywords[2]}"); + dict.Add(UserRightType.Customer_Wohnhilfe_Delete, $"{Translator.Translate("Klienten")} {Translator.Translate("Wohnhilfe")} {action_keywords[3]}"); dict.Add(UserRightType.DeleteAll, Translator.Translate("Alles löschen")); dict.Add(UserRightType.EmployeeView_Create, Translator.Translate("MitarbeiterSingular") + " anlegen"); @@ -958,7 +968,6 @@ namespace BS.Shared.Core dict.Add(EigenesBankkonto.Nein, "nein"); dict.Add(EigenesBankkonto.NichtAbgefragt, "nicht angefragt"); - dict.Add(Uberschuldung.Ja, "ja"); dict.Add(Uberschuldung.KeineAngabe, "keine Angabe"); dict.Add(Uberschuldung.Nein, "nein"); diff --git a/Shared/DataContracts/CustomerDC.cs b/Shared/DataContracts/CustomerDC.cs index 61d5b3aa6..1d546c467 100644 --- a/Shared/DataContracts/CustomerDC.cs +++ b/Shared/DataContracts/CustomerDC.cs @@ -11,213 +11,78 @@ namespace BS.Shared.DataContracts [DataContract] public class CustomerDC : PersonDC { - [DataMember] - public List AbsenceTimes { get; set; } - - [DataMember] - public List AssessmentSheetCategoryDCs { get; set; } - - [DataMember] - public String Childs { get; set; } - - [DataMember] - public List CostBearers { get; set; } - - [DataMember] - public List CustomerCareTypes { get; set; } - - [DataMember] - public long? CustomerOid { get; set; } - - [DataMember] - public List CustomerVarFields { get; set; } - - [DataMember] - public long? CustomerVersion { get; set; } - - [DataMember] - public String DebitorNumber { get; set; } - - [DataMember] - public String CostCenter { get; set; } - - [DataMember] - public String Diagnosis { get; set; } - - [DataMember] - public List Disabilities { get; set; } - - [DataMember] - public List EnvironmentPersons { get; set; } - - [DataMember] - public List EnvironmentOrganisations { get; set; } - - [DataMember] - public List Medikamentenverordnungslisten { get; set; } - - [DataMember] - public decimal? EquityContribution { get; set; } - - [DataMember] - public String ICD10Code { get; set; } - - [DataMember] - public String ICD10Diagnosis { get; set; } - - [DataMember] - public List ICD10DiagnosisCodes { get; set; } - - [DataMember] - public bool? IsAdvisedOrAttended { get; set; } - - [DataMember] - public String Medication { get; set; } - - [DataMember] - public String Notice { get; set; } - - [DataMember] - public String ReferenceNumber { get; set; } - - [DataMember] - public List PlacementList { get; set; } - - [DataMember] - public String Environment { get; set; } - - [DataMember] - public List RelatedEmployees { get; set; } - - [DataMember] - public List RelatedTeams { get; set; } - - [DataMember] - public DateTime? AssistanceBegin { get; set; } - - [DataMember] - public DateTime? TerminationDate { get; set; } - - [DataMember] - public ValueListEntryDC TerminationReason { get; set; } - - [DataMember] - public long? FamilyDataOid { get; set; } - - [DataMember] - public long? FamilyDataVersion {get; set; } - - [DataMember] - public String Kindesmutter { get; set; } - - [DataMember] - public String Kindesvater { get; set; } - - [DataMember] - public String Geschwister { get; set; } - - [DataMember] - public String Vormund { get; set; } - + [DataMember] public List AbsenceTimes { get; set; } + [DataMember] public List AssessmentSheetCategoryDCs { get; set; } + [DataMember] public String Childs { get; set; } + [DataMember] public List CostBearers { get; set; } + [DataMember] public List CustomerCareTypes { get; set; } + [DataMember] public long? CustomerOid { get; set; } + [DataMember] public List CustomerVarFields { get; set; } + [DataMember] public long? CustomerVersion { get; set; } + [DataMember] public String DebitorNumber { get; set; } + [DataMember] public String CostCenter { get; set; } + [DataMember] public String Diagnosis { get; set; } + [DataMember] public List Disabilities { get; set; } + [DataMember] public List EnvironmentPersons { get; set; } + [DataMember] public List EnvironmentOrganisations { get; set; } + [DataMember] public List Medikamentenverordnungslisten { get; set; } + [DataMember] public decimal? EquityContribution { get; set; } + [DataMember] public String ICD10Code { get; set; } + [DataMember] public String ICD10Diagnosis { get; set; } + [DataMember] public List ICD10DiagnosisCodes { get; set; } + [DataMember] public bool? IsAdvisedOrAttended { get; set; } + [DataMember] public String Medication { get; set; } + [DataMember] public String Notice { get; set; } + [DataMember] public String ReferenceNumber { get; set; } + [DataMember] public List PlacementList { get; set; } + [DataMember] public String Environment { get; set; } + [DataMember] public List RelatedEmployees { get; set; } + [DataMember] public List RelatedTeams { get; set; } + [DataMember] public DateTime? AssistanceBegin { get; set; } + [DataMember] public DateTime? TerminationDate { get; set; } + [DataMember] public ValueListEntryDC TerminationReason { get; set; } + [DataMember] public long? FamilyDataOid { get; set; } + [DataMember] public long? FamilyDataVersion { get; set; } + [DataMember] public String Kindesmutter { get; set; } + [DataMember] public String Kindesvater { get; set; } + [DataMember] public String Geschwister { get; set; } + [DataMember] public String Vormund { get; set; } public bool ContainsFamilyDataData() { return !Utils.AreAllNullOrEmpty(Kindesmutter, Kindesvater, Geschwister, Vormund); } - - [DataMember] - public CompactOrganisationDC Jugendamt { get; set; } - - [DataMember] - public CompactPersonDC Ansprechpartner { get; set; } - - [DataMember] - public int? DistanceInMeter { get; set; } - - [DataMember] - public String AusstVersAmt { get; set; } - - [DataMember] - public DateTime? AusweisGueltigVon { get; set; } - - [DataMember] - public DateTime? AusweisGueltigBis { get; set; } - - [DataMember] - public bool? AusweisUnbefristetGueltig { get; set; } - - [DataMember] - public String AusweisAktenzeichen { get; set; } - - [DataMember] - public DateTime? BeiblattGueltigBis { get; set; } - - [DataMember] - public String GradDerBehinderung { get; set; } - - [DataMember] - public List BehinderungsartenListe { get; set; } - - [DataMember] - public List MerkzeichenListe { get; set; } - - [DataMember] - public String CustomerAlias { get; set; } - - [DataMember] - public Pflegegrad? Pflegegrad { get; set; } - - [DataMember] - public bool VertretungGewuenscht { get; set; } - - [DataMember] - public int AbWelchemKrankheitsTag { get; set; } - - [DataMember] - public bool VertretungDringendErforderlich { get; set; } - - [DataMember] - public bool Pflege { get; set; } - - [DataMember] - public bool Toilettengang { get; set; } - - [DataMember] - public bool Aggressiv { get; set; } - - [DataMember] - public bool Hygienebelehrung { get; set; } - - [DataMember] - public String Schutzstufe { get; set; } - - [DataMember] - public String Uebernahmeort { get; set; } - - [DataMember] - public String Verhalten { get; set; } - - [DataMember] - public String Betreuungsbedarf { get; set; } - - [DataMember] - public String BemerkungenSbd { get; set; } - - [DataMember] - public List Arbeitszeiten { get; set; } - - [DataMember] - public SubstitutionNeed SubstitutionNeed { get; set; } - - [DataMember] - public string HealthInsurance { get; set; } - - [DataMember] - public string InsuranceNumber { get; set; } - - [DataMember] - public string VersichertenStatus { get; set; } - - [DataMember] - public FalldatenDC FalldatenDC { get; set; } + [DataMember] public CompactOrganisationDC Jugendamt { get; set; } + [DataMember] public CompactPersonDC Ansprechpartner { get; set; } + [DataMember] public int? DistanceInMeter { get; set; } + [DataMember] public String AusstVersAmt { get; set; } + [DataMember] public DateTime? AusweisGueltigVon { get; set; } + [DataMember] public DateTime? AusweisGueltigBis { get; set; } + [DataMember] public bool? AusweisUnbefristetGueltig { get; set; } + [DataMember] public String AusweisAktenzeichen { get; set; } + [DataMember] public DateTime? BeiblattGueltigBis { get; set; } + [DataMember] public String GradDerBehinderung { get; set; } + [DataMember] public List BehinderungsartenListe { get; set; } + [DataMember] public List MerkzeichenListe { get; set; } + [DataMember] public String CustomerAlias { get; set; } + [DataMember] public Pflegegrad? Pflegegrad { get; set; } + [DataMember] public bool VertretungGewuenscht { get; set; } + [DataMember] public int AbWelchemKrankheitsTag { get; set; } + [DataMember] public bool VertretungDringendErforderlich { get; set; } + [DataMember] public bool Pflege { get; set; } + [DataMember] public bool Toilettengang { get; set; } + [DataMember] public bool Aggressiv { get; set; } + [DataMember] public bool Hygienebelehrung { get; set; } + [DataMember] public String Schutzstufe { get; set; } + [DataMember] public String Uebernahmeort { get; set; } + [DataMember] public String Verhalten { get; set; } + [DataMember] public String Betreuungsbedarf { get; set; } + [DataMember] public String BemerkungenSbd { get; set; } + [DataMember] public List Arbeitszeiten { get; set; } + [DataMember] public SubstitutionNeed SubstitutionNeed { get; set; } + [DataMember] public string HealthInsurance { get; set; } + [DataMember] public string InsuranceNumber { get; set; } + [DataMember] public string VersichertenStatus { get; set; } + [DataMember] public FalldatenDC FalldatenDC { get; set; } + [DataMember] public List CustomerWohnhilfeDC { get; set; } } } \ No newline at end of file diff --git a/Shared/DataContracts/CustomerWohnhilfeDC.cs b/Shared/DataContracts/CustomerWohnhilfeDC.cs new file mode 100644 index 000000000..0d01057b5 --- /dev/null +++ b/Shared/DataContracts/CustomerWohnhilfeDC.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + public class CustomerWohnhilfeDC : BeWoDataContract + { + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index f294cf4c4..24975c940 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -170,6 +170,7 @@ + From f2d61799a3323cf046be62b7ea0df5d4733a431c Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 30 Aug 2024 13:35:16 +0200 Subject: [PATCH 085/103] Auto Select Textbox --- BeWo/View/Detail/CustomerWohnhilfeView.xaml | 16 +++++++++++++++- BeWo/View/Detail/CustomerWohnhilfeView.xaml.cs | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/BeWo/View/Detail/CustomerWohnhilfeView.xaml b/BeWo/View/Detail/CustomerWohnhilfeView.xaml index ded5c024a..2b6066c47 100644 --- a/BeWo/View/Detail/CustomerWohnhilfeView.xaml +++ b/BeWo/View/Detail/CustomerWohnhilfeView.xaml @@ -36,7 +36,8 @@