From 67709a737fe9569040b0f3475767bca9bdc9707e Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 15 Jul 2024 12:01:36 +0200 Subject: [PATCH 001/377] 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/377] 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/377] 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/377] 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/377] =?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/377] 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"/>