From c74362cc4d856ec7ee35d7681aa4ea848edfc265 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Sat, 27 May 2017 14:59:42 +0200 Subject: Removed old board member pages and classes. --- .../ApartmentManager/Handler/BoardMemberHandler.cs | 128 -------------------- .../Handler/BoardResidentsHandler.cs | 132 --------------------- .../Singletons/BoardMemberCatalogSingleton.cs | 46 ------- .../View/BoardMemberCreateApartmentPage.xaml | 35 ------ .../View/BoardMemberCreateApartmentPage.xaml.cs | 30 ----- .../View/BoardMemberManageApartment.xaml | 33 ------ .../View/BoardMemberManageApartment.xaml.cs | 56 --------- .../View/BoardMembersDefectsPage.xaml | 30 ----- .../View/BoardMembersDefectsPage.xaml.cs | 35 ------ .../View/BoardMembersMainPage.xaml | 29 ----- .../View/BoardMembersMainPage.xaml.cs | 45 ------- .../View/DefectsPicturesBoard.xaml | 30 ----- .../View/DefectsPicturesBoard.xaml.cs | 30 ----- .../ApartmentManager/View/InfoForBoardMembers.xaml | 48 -------- .../View/InfoForBoardMembers.xaml.cs | 30 ----- .../ViewModel/BoardMemberViewModel.cs | 104 ---------------- 16 files changed, 841 deletions(-) delete mode 100644 ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs delete mode 100644 ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs delete mode 100644 ApartmentManager/ApartmentManager/Singletons/BoardMemberCatalogSingleton.cs delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMembersMainPage.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/BoardMembersMainPage.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/View/DefectsPicturesBoard.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/DefectsPicturesBoard.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/View/InfoForBoardMembers.xaml delete mode 100644 ApartmentManager/ApartmentManager/View/InfoForBoardMembers.xaml.cs delete mode 100644 ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs diff --git a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs deleted file mode 100644 index c642b02..0000000 --- a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Popups; -using ApartmentManager.Model; -using ApartmentManager.Persistency; -using ApartmentManager.ViewModel; -using Newtonsoft.Json; - -namespace ApartmentManager.Handler -{ - public class BoardMemberHandler - { - public BoardMemberViewModel BoardMemberViewModel { get; set; } - - public BoardMemberHandler(BoardMemberViewModel boardMemberViewModel) - { - BoardMemberViewModel = boardMemberViewModel; - } - - public void GetApartments() - { - Apartment apartment= new Apartment(); - apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - - var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/"); - IEnumerable apartmentslist = JsonConvert.DeserializeObject>(apartmentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear(); - BoardMemberViewModel.NewApartment = new Apartment(); - foreach (var apartment2 in apartmentslist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Add(apartment2); - } - } - - public void CreateApartment() - { - try - { - Apartment apartment = new Apartment(); - apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - apartment.Address = BoardMemberViewModel.NewApartment.Address; - apartment.Floor = BoardMemberViewModel.NewApartment.Floor; - apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge; - apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms; - apartment.Size = BoardMemberViewModel.NewApartment.Size; - - ApiClient.PostData("api/Apartments/", apartment); - - var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId); - IEnumerable apartmentlist = JsonConvert.DeserializeObject>(apartmentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear(); - BoardMemberViewModel.NewApartment = new Apartment(); - foreach (var apartment2 in apartmentlist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Add(apartment2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - public void UpdateApartment() - { - try - { - Apartment apartment = new Apartment(); - apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - apartment.Address = BoardMemberViewModel.NewApartment.Address; - apartment.Floor = BoardMemberViewModel.NewApartment.Floor; - apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge; - apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms; - apartment.Size = BoardMemberViewModel.NewApartment.Size; - - ApiClient.PutData("api/Apartments/" + apartment.ApartmentId, apartment); - var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId); - IEnumerable apartmentslist = JsonConvert.DeserializeObject>(apartmentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear(); - BoardMemberViewModel.NewApartment = new Apartment(); - foreach (var apartment2 in apartmentslist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Add(apartment2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - public void DeleteApartment() - { - try - { - Apartment apartment = new Apartment(); - apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - apartment.Address = BoardMemberViewModel.NewApartment.Address; - apartment.Floor = BoardMemberViewModel.NewApartment.Floor; - apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge; - apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms; - apartment.Size = BoardMemberViewModel.NewApartment.Size; - - ApiClient.DeleteData("api/Apartments/" + apartment.ApartmentId); - - var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId); - IEnumerable apartmentslist = JsonConvert.DeserializeObject>(apartmentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear(); - BoardMemberViewModel.NewApartment = new Apartment(); - foreach (var apartment2 in apartmentslist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Add(apartment2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - } -} diff --git a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs deleted file mode 100644 index 3f6086e..0000000 --- a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs +++ /dev/null @@ -1,132 +0,0 @@ -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.Persistency; -using ApartmentManager.ViewModel; -using Newtonsoft.Json; - -namespace ApartmentManager.Handler -{ - public class BoardResidentsHandler - { - public BoardMemberViewModel BoardMemberViewModel { get; set; } - - public BoardResidentsHandler(BoardMemberViewModel boardMemberViewModel) - { - BoardMemberViewModel = boardMemberViewModel; - } - public void GetApartmentsResidents() - { - Resident resident = new Resident(); - resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - - var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId); - IEnumerable residentlist = JsonConvert.DeserializeObject>(residentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear(); - BoardMemberViewModel.NewResident = new Resident(); - foreach (var resident2 in residentlist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Add(resident2); - } - } - - public void CreateResident() - { - try - { - Resident resident = new Resident(); - - resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - resident.FirstName = BoardMemberViewModel.NewResident.FirstName; - resident.LastName = BoardMemberViewModel.NewResident.LastName; - resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate; - resident.Email = BoardMemberViewModel.NewResident.Email; - resident.Picture = BoardMemberViewModel.NewResident.Picture; - resident.Phone = BoardMemberViewModel.NewResident.Phone; - - ApiClient.PostData("api/residents/", resident); - - var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId); - IEnumerable residentlist = JsonConvert.DeserializeObject>(residentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear(); - BoardMemberViewModel.NewResident = new Resident(); - foreach (var resident2 in residentlist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Add(resident2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - - public void DeleteResident() - { - try - { - Resident resident = new Resident(); - resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId; - resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - resident.FirstName = BoardMemberViewModel.NewResident.FirstName; - resident.LastName = BoardMemberViewModel.NewResident.LastName; - resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate; - resident.Email = BoardMemberViewModel.NewResident.Email; - resident.Picture = BoardMemberViewModel.NewResident.Picture; - resident.Phone = BoardMemberViewModel.NewResident.Phone; - - ApiClient.DeleteData("api/residents/" + resident.ResidentId); - - var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId); - IEnumerable residentlist = JsonConvert.DeserializeObject>(residentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear(); - BoardMemberViewModel.NewResident = new Resident(); - foreach (var resident2 in residentlist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Add(resident2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - public void UpdateResident() - { - try - { - Resident resident = new Resident(); - resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId; - resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber; - resident.FirstName = BoardMemberViewModel.NewResident.FirstName; - resident.LastName = BoardMemberViewModel.NewResident.LastName; - resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate; - resident.Email = BoardMemberViewModel.NewResident.Email; - resident.Picture = BoardMemberViewModel.NewResident.Picture; - resident.Phone = BoardMemberViewModel.NewResident.Phone; - - ApiClient.PutData("api/residents/" + resident.ResidentId, resident); - var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId); - IEnumerable residentlist = JsonConvert.DeserializeObject>(residentsFromDatabase); - - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear(); - BoardMemberViewModel.NewResident = new Resident(); - foreach (var resident2 in residentlist) - { - BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Add(resident2); - } - } - catch (Exception e) - { - new MessageDialog(e.Message).ShowAsync(); - } - } - } -} \ No newline at end of file diff --git a/ApartmentManager/ApartmentManager/Singletons/BoardMemberCatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/BoardMemberCatalogSingleton.cs deleted file mode 100644 index 1a563ef..0000000 --- a/ApartmentManager/ApartmentManager/Singletons/BoardMemberCatalogSingleton.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; - -namespace ApartmentManager.Model -{ - public class BoardMemberCatalogSingleton - { - private static BoardMemberCatalogSingleton instance = new BoardMemberCatalogSingleton(); - - public static BoardMemberCatalogSingleton Instance => instance; - - public ObservableCollection Apartment { get; set; } - public ObservableCollection User { get; set; } - public ObservableCollection Residents { get; set; } - public ObservableCollection Defects { get; set; } - private BoardMemberCatalogSingleton() - { - Apartment = new ObservableCollection(); - - User = new ObservableCollection(); - //User.Add(new User("Bibis", "Kiausiai", "3214568", new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); - //Apartment = new ObservableCollection(); - //Apartment.Add(new Apartment(1, "30 Square meters", 2, "200", 0, "adresas")); - //Apartment.Add(new Apartment(2, "40 Square meters", 4, "300", 1, "kvaerkebyvej")); - //Apartment.Add(new Apartment(3, "28 Square meters", 1, "125", 0, "ugandavej")); - - Residents = new ObservableCollection(); - //Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 0, 0, 0), "Bibis@mail.com", 1)); - //Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 0, 0, 0), "Bibis@mail.com", 1)); - //Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 0, 0, 0), "Bibis@mail.com", 1)); - //Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 0, 0, 0), "Bibis@mail.com", 1)); - - Defects = new ObservableCollection(); - //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "downpipe will explode, do something!", "hello", "Not fixed")); - //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "downpipe will explode, do something!", "hello", "Not fixed")); - //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "downpipe will explode, do something!", "hello", "Fixed")); - } - } -} diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml deleted file mode 100644 index d243381..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml.cs deleted file mode 100644 index 8098474..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMemberCreateApartmentPage.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace ApartmentManager.View -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class BoardMemberCreateApartmentPage : Page - { - public BoardMemberCreateApartmentPage() - { - this.InitializeComponent(); - } - } -} diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml deleted file mode 100644 index 7e164a5..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs deleted file mode 100644 index bbda517..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -using ApartmentManager.Model; -using ApartmentManager.Singletons; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace ApartmentManager.View -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class BoardMemberManageApartment : Page - { - public BoardMemberManageApartment() - { - this.InitializeComponent(); - } - - private void ButtonBase_OnClick(object sender, RoutedEventArgs e) - { - this.Frame.Navigate(typeof(InfoForBoardMembers)); - } - - private void CreateApartment(object sender, RoutedEventArgs e) - { - this.Frame.Navigate(typeof(BoardMemberCreateApartmentPage)); - } - - //private bool ApartmentFilter(object item) - //{ - // if (String.IsNullOrEmpty(TextFilter.Text)) - // return true; - // else - // return BoardMemberCatalogSingleton.Instance.Apartment.IndexOf(TextFilter.Text)); - //} - - //private void txtFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) - //{ - // CollectionViewSource.GetDefaultView(lvUsers.ItemsSource).Refresh(); - //} - } -} diff --git a/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml b/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml deleted file mode 100644 index 28766d5..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml.cs deleted file mode 100644 index d910d39..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMembersDefectsPage.xaml.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace ApartmentManager.View -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class BoardMembersDefectsPage : Page - { - public BoardMembersDefectsPage() - { - this.InitializeComponent(); - } - - private void PicturesDefects(object sender, RoutedEventArgs e) - { - this.Frame.Navigate(typeof(DefectsPicturesBoard)); - } - } -} diff --git a/ApartmentManager/ApartmentManager/View/BoardMembersMainPage.xaml b/ApartmentManager/ApartmentManager/View/BoardMembersMainPage.xaml deleted file mode 100644 index 0cc58ab..0000000 --- a/ApartmentManager/ApartmentManager/View/BoardMembersMainPage.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - + + + + + + + + diff --git a/ApartmentManager/ApartmentManager/View/BmMainPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmMainPage.xaml.cs new file mode 100644 index 0000000..5d287f1 --- /dev/null +++ b/ApartmentManager/ApartmentManager/View/BmMainPage.xaml.cs @@ -0,0 +1,16 @@ +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace ApartmentManager.View +{ + /// + /// Main page for board members. + /// + public sealed partial class BmMainPage : Page + { + public BmMainPage() + { + InitializeComponent(); + } + } +} -- cgit v1.2.3 From ab9b9a75ec6abfd85f7ccae6aee08ec9e9e35497 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Sat, 27 May 2017 15:06:12 +0200 Subject: Added apartment management functionality. --- ApartmentManager/ApartmentManager.sln | 6 +- .../ApartmentManager/ApartmentManager.csproj | 60 +++++---- ApartmentManager/ApartmentManager/AppShell.xaml.cs | 28 ++++- .../ApartmentManager/Handler/BmHandler.cs | 75 ++++++++++++ .../ApartmentManager/Model/Apartment.cs | 45 +++---- .../ApartmentManager/Singletons/BmSingleton.cs | 18 +++ .../ApartmentManager/View/BmApartmentsPage.xaml | 134 +++++++++++++++++++++ .../ApartmentManager/View/BmApartmentsPage.xaml.cs | 29 +++++ .../View/BmCreateApartmentPage.xaml | 81 +++++++++++++ .../View/BmCreateApartmentPage.xaml.cs | 15 +++ .../ApartmentManager/View/BmEditApartmentPage.xaml | 87 +++++++++++++ .../View/BmEditApartmentPage.xaml.cs | 15 +++ .../ApartmentManager/ViewModel/BmViewModel.cs | 61 ++++++++++ 13 files changed, 602 insertions(+), 52 deletions(-) create mode 100644 ApartmentManager/ApartmentManager/Handler/BmHandler.cs create mode 100644 ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs create mode 100644 ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml create mode 100644 ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs create mode 100644 ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml create mode 100644 ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml.cs create mode 100644 ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml create mode 100644 ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml.cs create mode 100644 ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs diff --git a/ApartmentManager/ApartmentManager.sln b/ApartmentManager/ApartmentManager.sln index 3cb16cf..86bb4ee 100644 --- a/ApartmentManager/ApartmentManager.sln +++ b/ApartmentManager/ApartmentManager.sln @@ -1,9 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.7 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApartmentManager", "ApartmentManager\ApartmentManager.csproj", "{95401ED6-D03C-417D-8897-81B5454D2426}" + ProjectSection(ProjectDependencies) = postProject + {D777744A-9676-4193-BD59-6F30C724C87A} = {D777744A-9676-4193-BD59-6F30C724C87A} + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HousingWebApi", "HousingWebApi\HousingWebApi.csproj", "{D777744A-9676-4193-BD59-6F30C724C87A}" EndProject @@ -42,7 +45,6 @@ Global {95401ED6-D03C-417D-8897-81B5454D2426}.Release|x86.Build.0 = Release|x86 {95401ED6-D03C-417D-8897-81B5454D2426}.Release|x86.Deploy.0 = Release|x86 {D777744A-9676-4193-BD59-6F30C724C87A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D777744A-9676-4193-BD59-6F30C724C87A}.Debug|Any CPU.Build.0 = Debug|Any CPU {D777744A-9676-4193-BD59-6F30C724C87A}.Debug|ARM.ActiveCfg = Debug|Any CPU {D777744A-9676-4193-BD59-6F30C724C87A}.Debug|ARM.Build.0 = Debug|Any CPU {D777744A-9676-4193-BD59-6F30C724C87A}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index 81f44b5..2a04477 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -100,15 +100,14 @@ - - + - + @@ -119,7 +118,7 @@ - + @@ -134,23 +133,29 @@ ApartmentPage.xaml - - BoardMemberManageApartment.xaml + + BmChangesPage.xaml - - BoardMembersDefectsPage.xaml + + BmContractOwnersPage.xaml - - BoardMembersMainPage.xaml + + BmEditApartmentPage.xaml - - BoardMemberCreateApartmentPage.xaml + + BmResidentsPage.xaml - - DefectsPicturesBoard.xaml + + BmApartmentsPage.xaml - - InfoForBoardMembers.xaml + + BmDefectsPage.xaml + + + BmMainPage.xaml + + + BmCreateApartmentPage.xaml LoginPage.xaml @@ -210,27 +215,35 @@ Designer MSBuild:Compile - + + Designer + MSBuild:Compile + + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + + Designer + MSBuild:Compile + + Designer MSBuild:Compile @@ -261,6 +274,9 @@ 5.3.3 + + 2.0.0 + diff --git a/ApartmentManager/ApartmentManager/AppShell.xaml.cs b/ApartmentManager/ApartmentManager/AppShell.xaml.cs index b1a88c6..dbe9c89 100644 --- a/ApartmentManager/ApartmentManager/AppShell.xaml.cs +++ b/ApartmentManager/ApartmentManager/AppShell.xaml.cs @@ -63,15 +63,23 @@ namespace ApartmentManager { Symbol = Symbol.Home, Label = "Home", - DestPage = typeof(BoardMembersMainPage), + DestPage = typeof(BmMainPage), IsSelected = true }, new NavMenuItem() { Symbol = Symbol.Comment, - Label = "Defects", - DestPage = typeof(BoardMembersDefectsPage), + Label = "Apartments", + DestPage = typeof(BmApartmentsPage), + IsSelected = false + }, + + new NavMenuItem() + { + Symbol = Symbol.Comment, + Label = "Contract owners", + DestPage = typeof(BmContractOwnersPage), IsSelected = false }, @@ -79,15 +87,23 @@ namespace ApartmentManager { Symbol = Symbol.Bookmarks, Label = "Residents", - DestPage = typeof(InfoForBoardMembers), + DestPage = typeof(BmResidentsPage), IsSelected = false }, new NavMenuItem() { Symbol = Symbol.Bookmarks, - Label = "Apartments", - DestPage = typeof(BoardMembersMainPage), + Label = "Defects", + DestPage = typeof(BmDefectsPage), + IsSelected = false + }, + + new NavMenuItem() + { + Symbol = Symbol.Bookmarks, + Label = "Changes", + DestPage = typeof(BmChangesPage), IsSelected = false } }); diff --git a/ApartmentManager/ApartmentManager/Handler/BmHandler.cs b/ApartmentManager/ApartmentManager/Handler/BmHandler.cs new file mode 100644 index 0000000..2b6b5b0 --- /dev/null +++ b/ApartmentManager/ApartmentManager/Handler/BmHandler.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.ObjectModel; +using Windows.UI.Popups; +using ApartmentManager.Model; +using ApartmentManager.Persistency; +using ApartmentManager.ViewModel; +using Newtonsoft.Json; +using ApartmentManager.Singletons; + +namespace ApartmentManager.Handler +{ + public class BmHandler + { + private BmViewModel _vm; + + public BmHandler(BmViewModel vm) + { + _vm = vm; + } + + public void GetApartments() + { + BmSingleton.Instance.Apartments = JsonConvert.DeserializeObject> (ApiClient.GetData("api/Apartments/")); + } + + public void CreateApartment() + { + try + { + ApiClient.PostData("api/Apartments/", _vm.ApartmentTemplate); + GetApartments(); + _vm.ApartmentTemplate = new Apartment(); + } + catch (Exception e) + { + var msg = new MessageDialog(e.Message).ShowAsync(); + } + } + public void UpdateApartment() + { + try + { + ApiClient.PutData("api/Apartments/" + _vm.ApartmentTemplate.ApartmentId, _vm.ApartmentTemplate); + GetApartments(); + } + catch (Exception e) + { + var msg = new MessageDialog(e.Message).ShowAsync(); + } + } + public void DeleteApartment() + { + try + { + ApiClient.DeleteData("api/Apartments/" + _vm.ApartmentTemplate.ApartmentId); + BmSingleton.Instance.Apartments.Remove(_vm.ApartmentTemplate); + GetApartments(); + } + catch (Exception e) + { + var msg = new MessageDialog(e.Message).ShowAsync(); + } + } + + public async void UploadApartmentPlan() + { + _vm.ApartmentTemplate.PlanPicture = await ImgurPhotoUploader.UploadPhotoAsync(); + } + + public void ClearApartmentTemplate() + { + _vm.ApartmentTemplate = new Apartment(); + } + } +} diff --git a/ApartmentManager/ApartmentManager/Model/Apartment.cs b/ApartmentManager/ApartmentManager/Model/Apartment.cs index 74fe410..a32c081 100644 --- a/ApartmentManager/ApartmentManager/Model/Apartment.cs +++ b/ApartmentManager/ApartmentManager/Model/Apartment.cs @@ -1,37 +1,38 @@ -namespace ApartmentManager.Model +using ApartmentManager.Annotations; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace ApartmentManager.Model { - public class Apartment + public class Apartment : INotifyPropertyChanged { public int ApartmentId { get; set; } - public double? Size { get; set; } - public int? NumberOfRooms { get; set; } - public double? MonthlyCharge { get; set; } - public int? Floor { get; set; } + public double Size { get; set; } + public int NumberOfRooms { get; set; } + public double MonthlyCharge { get; set; } + public int Floor { get; set; } public string Address { get; set; } - public string PlanPicture { get; set; } + private string _planPicture; public Apartment() { } - public Apartment(int apartmentId, double? size, int? numberOfRooms, double? monthlyCharge, int? floor, string address) + public string PlanPicture { - ApartmentId = apartmentId; - Size = size; - NumberOfRooms = numberOfRooms; - MonthlyCharge = monthlyCharge; - Floor = floor; - Address = address; + get => _planPicture; + set + { + _planPicture = value; + OnPropertyChanged(nameof(PlanPicture)); + } } - //public override string ToString() - //{ - // return string.Format( - // "Apartment No: {0} Size: {1} NoOfRooms: {2} MonthlyCharge: {3} Floor: {4} Address: {5}", - // ApartmentNumber, Size, NumberOfRooms, MonthlyCharge, Floor, Address); - //} + public event PropertyChangedEventHandler PropertyChanged; - public override string ToString() + [NotifyPropertyChangedInvocator] + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { - return string.Format($"Apartment number: {ApartmentId}, Size: {Size} Number of rooms: {NumberOfRooms}, Monthly charge: {MonthlyCharge}, Floor: {Floor}, Address: {Address}"); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs new file mode 100644 index 0000000..966390c --- /dev/null +++ b/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs @@ -0,0 +1,18 @@ +using ApartmentManager.Model; +using System.Collections.ObjectModel; + +namespace ApartmentManager.Singletons +{ + public class BmSingleton + { + private static BmSingleton _instance; + public static BmSingleton Instance => _instance ?? (_instance = new BmSingleton()); + + public ObservableCollection Apartments { get; set; } + public ObservableCollection Users { get; set; } + public ObservableCollection Residents { get; set; } + public ObservableCollection Defects { get; set; } + + private BmSingleton() { } + } +} diff --git a/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml new file mode 100644 index 0000000..ffc28c2 --- /dev/null +++ b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +