From 8be8bd9b1131d1866778f47d206f9b475bc209b7 Mon Sep 17 00:00:00 2001 From: Donatas Adamonis Date: Wed, 10 May 2017 16:17:05 +0200 Subject: Updated residence list design, upload photo feature --- .../ApartmentManager/ApartmentManager.csproj | 7 ++ .../ApartmentManager/Handler/ApartmentHandler.cs | 16 +++- .../ApartmentManager/Model/Resident.cs | 31 ++++---- .../Singletons/CatalogSingleton.cs | 12 +-- .../ApartmentManager/View/ApartmentDefectPage.xaml | 51 ++++++++++++ .../View/ApartmentDefectPage.xaml.cs | 30 ++++++++ .../View/ApartmentResidentsPage.xaml | 90 +++++++++++----------- .../View/ApartmentResidentsPage.xaml.cs | 5 ++ .../ViewModel/ApartmenViewModel.cs | 9 ++- ApartmentManager/HousingWebApi/DataModel.cs | 1 + 10 files changed, 180 insertions(+), 72 deletions(-) create mode 100644 ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml create mode 100644 ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index f15b399..340ba6c 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -120,6 +120,9 @@ + + ApartmentDefectPage.xaml + ApartmentNewDefect.xaml @@ -183,6 +186,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs index 7c27686..0310f80 100644 --- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs +++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs @@ -138,6 +138,20 @@ namespace ApartmentManager.Handler { new MessageDialog(e.Message).ShowAsync(); } - } + } + + public async void UploadResidentPhoto() + { + try + { + ApartmentViewModel.NewResident.Picture = await ImgurPhotoUploader.UploadPhotoAsync(); + } + catch (Exception e) + { + + + } + + } } } diff --git a/ApartmentManager/ApartmentManager/Model/Resident.cs b/ApartmentManager/ApartmentManager/Model/Resident.cs index e9f39cd..e5ee2fb 100644 --- a/ApartmentManager/ApartmentManager/Model/Resident.cs +++ b/ApartmentManager/ApartmentManager/Model/Resident.cs @@ -12,26 +12,27 @@ namespace ApartmentManager.Model public string FirstName { get; set; } public string LastName { get; set; } public int Phone { get; set; } - public DateTime BirthDate { get; set; } + public DateTimeOffset BirthDate { get; set; } public string Email { get; set; } - public Image Picture { get; set; } + public string Picture { get; set; } public int ApartmentNr { get; set; } public int ResidentNr { get; set; } - + public Resident() { } - public Resident(string FirstName, string LastName, int Phone, DateTime BirthDate, string Email, int ApartmentNr ,int ResidentNr) - { - this.FirstName = FirstName; - this.LastName = LastName; - this.Phone = Phone; - this.BirthDate = BirthDate; - this.Email = Email; - this.ApartmentNr = ApartmentNr; - this.ResidentNr = ResidentNr; - } - public override string ToString() + public Resident(string firstName, string lastName, int phone, DateTimeOffset birthDate, string email, int apartmentNr ,int residentNr, string picture) { - return string.Format($"Name: {FirstName}, LastName: {LastName}, Birth Date: {BirthDate}, Phone {Phone}, Email {Email} "); + FirstName = firstName; + LastName = lastName; + Phone = phone; + BirthDate = birthDate; + Email = email; + ApartmentNr = apartmentNr; + ResidentNr = residentNr; + Picture = picture; } + //public override string ToString() + //{ + // return string.Format($"Name: {FirstName}, LastName: {LastName}, Birth Date: {BirthDate.Date}, Phone {Phone}, Email {Email} "); + //} } } diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs index f2a45be..998bfb3 100644 --- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs +++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.ObjectModel; +using ApartmentManager.Model; -namespace ApartmentManager.Model +namespace ApartmentManager.Singletons { public class CatalogSingleton { @@ -18,8 +14,8 @@ namespace ApartmentManager.Model public ObservableCollection Residents { get; set; } private CatalogSingleton() { + Residents = new ObservableCollection(); - Residents.Add(new Resident("Donis","banana",12345,new DateTime(1990,07,26,0,0,0,0), "Donis@donis.lt",1,1)); } } } diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml new file mode 100644 index 0000000..405576c --- /dev/null +++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs new file mode 100644 index 0000000..7a157ab --- /dev/null +++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml.cs @@ -0,0 +1,30 @@ +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 ApartmentDefectPage : Page + { + public ApartmentDefectPage() + { + this.InitializeComponent(); + } + } +} diff --git a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml index 7997d39..0214ba7 100644 --- a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml +++ b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml @@ -14,8 +14,8 @@ - - + + @@ -23,65 +23,57 @@ - + + - + + - + + - + + - - - - - - - - - - - - - + + + + + + + + + + + + - - Review score: + + + + - - - - - - - - - + + + + - - - - - - - - - - - + + + - - + + - + @@ -93,15 +85,19 @@ - + +