From fd19b684a2a43b456cbbb8c49b66ff3f1624790d Mon Sep 17 00:00:00 2001 From: Paulius Klezys Date: Mon, 22 May 2017 21:08:21 +0200 Subject: sAtyy --- .../View/BoardMemberManageApartment.xaml | 7 +------ .../View/BoardMemberManageApartment.xaml.cs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml index a6aec28..7e164a5 100644 --- a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml +++ b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml @@ -17,22 +17,17 @@ - - - - + - - diff --git a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs index 81fa3a8..e247306 100644 --- a/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs +++ b/ApartmentManager/ApartmentManager/View/BoardMemberManageApartment.xaml.cs @@ -39,17 +39,17 @@ namespace ApartmentManager.View this.Frame.Navigate(typeof(BoardMemberCreateApartmentPage)); } - private bool ApartmentFilter(object item) - { - if (String.IsNullOrEmpty(TextFilter.Text)) - return true; - else - return ((item as Apartment).BoardMemberCatalogSingleton.IndexOf(TextFilter.Text, StringComparison.OrdinalIgnoreCase) >= 0); - } + //private bool ApartmentFilter(object item) + //{ + // if (String.IsNullOrEmpty(TextFilter.Text)) + // return true; + // else + // return ((item as Apartment).BoardMemberCatalogSingleton.IndexOf(TextFilter.Text, StringComparison.OrdinalIgnoreCase) >= 0); + //} - private void txtFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) - { - CollectionViewSource.GetDefaultView(lvUsers.ItemsSource).Refresh(); - } + //private void txtFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) + //{ + // CollectionViewSource.GetDefaultView(lvUsers.ItemsSource).Refresh(); + //} } } -- cgit v1.2.3 From 3a976d603e81cc01d5c8c8f13da125bec98d3b75 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Tue, 23 May 2017 12:04:53 +0200 Subject: Added image converter. --- .../ApartmentManager/ApartmentManager.csproj | 1 + .../Common/ByteArrayToImageConverter.cs | 35 ++++++++++++++++++++++ .../View/ApartmentResidentsPage.xaml | 2 +- ApartmentManager/HousingWebApi/DataModel.cs | 17 +++++++++++ .../HousingWebApi/HousingWebApi.csproj | 5 ++-- .../HousingWebApi/Models/ApartmentResident.cs | 32 ++++++++++++++++++++ ApartmentManager/HousingWebApi/Models/Resident.cs | 1 - 7 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 ApartmentManager/ApartmentManager/Common/ByteArrayToImageConverter.cs create mode 100644 ApartmentManager/HousingWebApi/Models/ApartmentResident.cs diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index f267a50..8726694 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -98,6 +98,7 @@ AppShell.xaml + diff --git a/ApartmentManager/ApartmentManager/Common/ByteArrayToImageConverter.cs b/ApartmentManager/ApartmentManager/Common/ByteArrayToImageConverter.cs new file mode 100644 index 0000000..e1d2400 --- /dev/null +++ b/ApartmentManager/ApartmentManager/Common/ByteArrayToImageConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.Storage.Streams; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Media.Imaging; + +namespace ApartmentManager.Common +{ + class ByteArrayToImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value != null) + { + BitmapImage image = new BitmapImage(); + using (InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream()) + { + stream.AsStreamForWrite().Write((byte[])value, 0, ((byte[])value).Length); + image.SetSource(stream); + } + return image; + } + else return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} diff --git a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml index ea4711e..a9d341e 100644 --- a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml +++ b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml @@ -78,7 +78,7 @@ - + diff --git a/ApartmentManager/HousingWebApi/DataModel.cs b/ApartmentManager/HousingWebApi/DataModel.cs index 00f4811..485c697 100644 --- a/ApartmentManager/HousingWebApi/DataModel.cs +++ b/ApartmentManager/HousingWebApi/DataModel.cs @@ -23,6 +23,7 @@ namespace HousingWebApi public virtual DbSet PastUsers { get; set; } public virtual DbSet Residents { get; set; } public virtual DbSet Users { get; set; } + public virtual DbSet ApartmentResidents { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { @@ -170,6 +171,22 @@ namespace HousingWebApi modelBuilder.Entity() .Property(e => e.Email) .IsUnicode(false); + + modelBuilder.Entity() + .Property(e => e.FirstName) + .IsUnicode(false); + + modelBuilder.Entity() + .Property(e => e.LastName) + .IsUnicode(false); + + modelBuilder.Entity() + .Property(e => e.Phone) + .IsUnicode(false); + + modelBuilder.Entity() + .Property(e => e.Email) + .IsUnicode(false); } } } diff --git a/ApartmentManager/HousingWebApi/HousingWebApi.csproj b/ApartmentManager/HousingWebApi/HousingWebApi.csproj index 117dc9d..b009a06 100644 --- a/ApartmentManager/HousingWebApi/HousingWebApi.csproj +++ b/ApartmentManager/HousingWebApi/HousingWebApi.csproj @@ -153,8 +153,7 @@ - - + @@ -187,6 +186,8 @@ + + diff --git a/ApartmentManager/HousingWebApi/Models/ApartmentResident.cs b/ApartmentManager/HousingWebApi/Models/ApartmentResident.cs new file mode 100644 index 0000000..9936a5e --- /dev/null +++ b/ApartmentManager/HousingWebApi/Models/ApartmentResident.cs @@ -0,0 +1,32 @@ +namespace HousingWebApi +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; + using System.Data.Entity.Spatial; + + public partial class ApartmentResident + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int ApartmentId { get; set; } + + [StringLength(30)] + public string FirstName { get; set; } + + [StringLength(30)] + public string LastName { get; set; } + + [Column(TypeName = "date")] + public DateTime? BirthDate { get; set; } + + [StringLength(20)] + public string Phone { get; set; } + + [StringLength(50)] + public string Email { get; set; } + + public byte[] Picture { get; set; } + } +} diff --git a/ApartmentManager/HousingWebApi/Models/Resident.cs b/ApartmentManager/HousingWebApi/Models/Resident.cs index c9a698f..0509d40 100644 --- a/ApartmentManager/HousingWebApi/Models/Resident.cs +++ b/ApartmentManager/HousingWebApi/Models/Resident.cs @@ -9,7 +9,6 @@ namespace HousingWebApi [Table("Resident")] public partial class Resident { - [DatabaseGenerated(DatabaseGeneratedOption.None)] public int ResidentId { get; set; } public int ApartmentId { get; set; } -- cgit v1.2.3