From 783c339ad3c2e7d5a071fe68613f1962fb022072 Mon Sep 17 00:00:00 2001 From: Donatas Adamonis Date: Wed, 3 May 2017 18:50:00 +0200 Subject: resident --- .../ApartmentManager/ApartmentManager.csproj | 2 +- .../ApartmentManager/Handler/ApartmentHandler.cs | 19 ------- .../ApartmentManager/Handler/ResidentsHandler.cs | 55 +++++++++++++++++++++ .../ApartmentManager/View/ResidentsPage.xaml | 4 +- .../ViewModel/ApartmenViewModel.cs | 18 +++---- HousingDatabase.ldf | Bin 8388608 -> 8388608 bytes HousingDatabase.mdf | Bin 8388608 -> 8388608 bytes 7 files changed, 66 insertions(+), 32 deletions(-) delete mode 100644 ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs create mode 100644 ApartmentManager/ApartmentManager/Handler/ResidentsHandler.cs diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index 21b1952..24202c3 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -100,7 +100,7 @@ - + diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs deleted file mode 100644 index e93d192..0000000 --- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ApartmentManager.ViewModel; - -namespace ApartmentManager.Handler -{ - public class ApartmentHandler - { - public ApartmentViewModel ApartmentViewModel { get; set; } - - public ApartmentHandler(ApartmentViewModel apartmenViewModel) - { - ApartmentViewModel = apartmenViewModel; - } - } -} diff --git a/ApartmentManager/ApartmentManager/Handler/ResidentsHandler.cs b/ApartmentManager/ApartmentManager/Handler/ResidentsHandler.cs new file mode 100644 index 0000000..26a4f04 --- /dev/null +++ b/ApartmentManager/ApartmentManager/Handler/ResidentsHandler.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.UI.Popups; +using ApartmentManager.Model; +using ApartmentManager.ViewModel; + +namespace ApartmentManager.Handler +{ + public class ResidentsHandler + { + public ApartmentViewModel ApartmentViewModel { get; set; } + + public ResidentsHandler(ApartmentViewModel apartmenViewModel) + { + ApartmentViewModel = apartmenViewModel; + } + + public void CreateResident() + { + try + { + Resident resident = new Resident(); + resident.ApartmentNr = ApartmentViewModel.ApartmentNumber; + resident.Name = ApartmentViewModel.NewResident.Name; + resident.LastName = ApartmentViewModel.NewResident.LastName; + resident.BirthDate = ApartmentViewModel.NewResident.BirthDate; + resident.Email = ApartmentViewModel.NewResident.Email; + resident.Picture = ApartmentViewModel.NewResident.Picture; + resident.Phone = ApartmentViewModel.NewResident.Phone; + + //new PersistenceFacade().CreateHotel(hotel); + + ////HotelViewModel.Hotels.Hotels.Add(hotel); + //var hotelsFromDatabase = new PersistenceFacade().GetHotels(); + + //HotelViewModel.HotelCatalogSingleton.Hotels.Clear(); + //foreach (var hotel1 in hotelsFromDatabase) + //{ + // ApartmentViewModel.HotelCatalogSingleton.Hotels.Add(hotel1); + + //} + } + catch (Exception e) + { + new MessageDialog(e.Message).ShowAsync(); + } + + + + } + } +} diff --git a/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml b/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml index 383c396..268d2f7 100644 --- a/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml +++ b/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml @@ -14,7 +14,7 @@ - + @@ -28,7 +28,7 @@ -