diff options
author | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-01 22:44:50 +0200 |
---|---|---|
committer | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-01 22:44:50 +0200 |
commit | 357e0df3f1bd5a0b53acac2f99c3642c95a160ec (patch) | |
tree | d4ce9918a2ade32ace4efb7a4223dd8cbeca2716 | |
parent | fff5c24514cbd86078bec8883561b9b74a65edba (diff) |
database update
-rw-r--r-- | ApartmentManager/ApartmentManager/ApartmentManager.csproj | 2 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Model/CatalogSingleton.cs | 11 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Model/Resident.cs | 3 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/View/ApartmentPage.xaml | 2 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs | 5 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/View/PersonalInfoPage.xaml | 2 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/View/PlanPage.xaml | 2 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/View/ResidentsPage.xaml | 41 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs | 15 | ||||
-rw-r--r-- | HousingDatabase.ldf | bin | 8388608 -> 8388608 bytes | |||
-rw-r--r-- | HousingDatabase.mdf | bin | 8388608 -> 8388608 bytes |
11 files changed, 58 insertions, 25 deletions
diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index bca2bbc..21b1952 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -178,7 +178,7 @@ </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> - <Version>5.2.2</Version> + <Version>5.3.1</Version> </PackageReference> </ItemGroup> <ItemGroup /> diff --git a/ApartmentManager/ApartmentManager/Model/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Model/CatalogSingleton.cs index 160d332..2d001fa 100644 --- a/ApartmentManager/ApartmentManager/Model/CatalogSingleton.cs +++ b/ApartmentManager/ApartmentManager/Model/CatalogSingleton.cs @@ -15,13 +15,18 @@ namespace ApartmentManager.Model public ObservableCollection<User> User { get; set; } public ObservableCollection<Apartment> Apartment { get; set; } - + public ObservableCollection<Resident> Residents { get; set; } private CatalogSingleton() { - Apartment = new ObservableCollection<Apartment>(); User = new ObservableCollection<User>(); - User.Add(new User("Bibis","Kiausiai",3214568, new DateTime(2017, 1, 5, 2, 27, 0),"Bibis@mail.com",1)); + User.Add(new User("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); + Apartment = new ObservableCollection<Apartment>(); Apartment.Add(new Apartment(1,"30 Square meters",2,"200",0,"adresas")); + Residents = new ObservableCollection<Resident>(); + Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); + Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); + Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); + Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 2, 27, 0), "Bibis@mail.com", 1)); } } } diff --git a/ApartmentManager/ApartmentManager/Model/Resident.cs b/ApartmentManager/ApartmentManager/Model/Resident.cs index b86cf03..58ff5f4 100644 --- a/ApartmentManager/ApartmentManager/Model/Resident.cs +++ b/ApartmentManager/ApartmentManager/Model/Resident.cs @@ -7,7 +7,7 @@ using Windows.UI.Xaml.Controls; namespace ApartmentManager.Model { - class Resident + public class Resident { public string Name { get; set; } public string LastName { get; set; } @@ -17,6 +17,7 @@ namespace ApartmentManager.Model public Image Picture { get; set; } public int ApartmentNr { get; set; } + public Resident() { } public Resident(string Name, string LastName, int Phone, DateTime BirthDate, string Email, int ApartmentNr) { this.Name = Name; diff --git a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml index 9f20238..385e580 100644 --- a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml +++ b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml @@ -45,7 +45,7 @@ <StackPanel Width="400" Height="300" VerticalAlignment="Top" HorizontalAlignment="Right"> <Button Margin="0,10,0,10" Content="Apartment Plan" HorizontalAlignment="Stretch" Click="click"/> <Button Margin="0,10,0,10" Content="Personal Info" HorizontalAlignment="Stretch" Click="GotoPernalInfoPage"/> - <Button Margin="0,10,0,10" Content="Residents" HorizontalAlignment="Stretch"/> + <Button Margin="0,10,0,10" Content="Residents" HorizontalAlignment="Stretch" Click="ResidentPage"/> <Button Margin="0,10,0,10" Content="Apartment Changes" HorizontalAlignment="Stretch"/> <Button Margin="0,10,0,10" Content="Apartment Defects" HorizontalAlignment="Stretch"/> </StackPanel> diff --git a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs index 38c1673..60ab2f2 100644 --- a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs +++ b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs @@ -36,5 +36,10 @@ namespace ApartmentManager.View { Frame.Navigate(typeof(PersonalInfoPage)); } + + private void ResidentPage(object sender, RoutedEventArgs e) + { + Frame.Navigate(typeof(ResidentsPage)); + } } } diff --git a/ApartmentManager/ApartmentManager/View/PersonalInfoPage.xaml b/ApartmentManager/ApartmentManager/View/PersonalInfoPage.xaml index 2d09cb1..0886372 100644 --- a/ApartmentManager/ApartmentManager/View/PersonalInfoPage.xaml +++ b/ApartmentManager/ApartmentManager/View/PersonalInfoPage.xaml @@ -13,7 +13,7 @@ </Page.DataContext> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - <StackPanel Margin="50" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> + <StackPanel Margin="50" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top"> <StackPanel Width="400" Margin="0,0,50,0"> <TextBlock Margin="0,10,0,10" Text="First Contract Owner" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"/> <TextBlock Margin="0,10,0,10" Text="Name"/> diff --git a/ApartmentManager/ApartmentManager/View/PlanPage.xaml b/ApartmentManager/ApartmentManager/View/PlanPage.xaml index 5769290..df51ff8 100644 --- a/ApartmentManager/ApartmentManager/View/PlanPage.xaml +++ b/ApartmentManager/ApartmentManager/View/PlanPage.xaml @@ -8,7 +8,7 @@ mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - <Image Source="ms-appx:///Assets/plan.jpg" Margin="50"></Image> + <Image Source="ms-appx:///Assets/plan.jpg" Margin="50"></Image> </Grid> </Page> diff --git a/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml b/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml index cc924da..383c396 100644 --- a/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml +++ b/ApartmentManager/ApartmentManager/View/ResidentsPage.xaml @@ -1,29 +1,38 @@ <Page - x:Class="ApartmentManager.View.ResidentsPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:ApartmentManager.View" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:ViewModel="using:ApartmentManager.ViewModel" + x:Class="ApartmentManager.View.ResidentsPage" mc:Ignorable="d"> + <Page.DataContext> + <ViewModel:ApartmentViewModel/> + </Page.DataContext> + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" > - <ListView HorizontalAlignment="Left" Height="600" Margin="0,0,50,0" VerticalAlignment="Top" Width="500"/> + <StackPanel Margin="50" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="top" > + <ListView HorizontalAlignment="Left" Margin="0,0,50,0" VerticalAlignment="Top" ItemsSource="{Binding CatalogSingleton.Residents}" SelectedItem="{Binding NewResident, Mode=TwoWay}"/> <StackPanel Width="400" Margin="0,0,50,0"> - <TextBlock Margin="0,10,0,10" Text="Resident Info" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"/> - <TextBlock Margin="0,10,0,10" Text="Name"/> - <TextBox Text="{Binding CatalogSingleton.User[0].Name, Mode=TwoWay}" /> - <TextBlock Margin="0,10,0,10" Text="Last Name"/> - <TextBox Text="{Binding CatalogSingleton.User[0].LastName, Mode=TwoWay}" /> - <TextBlock Margin="0,10,0,10" Text="Birthdate"/> - <DatePicker HorizontalAlignment="Stretch" Date="{Binding CatalogSingleton.User[0].BirthDate}"/> - <TextBlock Margin="0,10,0,10" Text="Email Address"/> - <TextBox Text="{Binding CatalogSingleton.User[0].Email, Mode=TwoWay}" /> - <TextBlock Margin="0,10,0,10" Text="Phone Number"/> - <TextBox Text="{Binding CatalogSingleton.User[0].Phone, Mode=TwoWay}" /> - <Button Margin="0,10,0,10" Content="Update" HorizontalAlignment="Stretch"/> - </StackPanel> + <TextBlock Margin="0,10,0,10" Text="Resident Info" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"/> + <TextBlock Margin="0,10,0,10" Text="Name"/> + <TextBox Text="{Binding NewResident.Name, Mode=TwoWay}" /> + <TextBlock Margin="0,10,0,10" Text="Last Name"/> + <TextBox Text="{Binding NewResident.LastName, Mode=TwoWay}" /> + <TextBlock Margin="0,10,0,10" Text="Birthdate"/> + <DatePicker HorizontalAlignment="Stretch" Date="{Binding NewResident.BirthDate, Mode=TwoWay}"/> + <TextBlock Margin="0,10,0,10" Text="Email Address"/> + <TextBox Text="{Binding NewResident.Email, Mode=TwoWay}" /> + <TextBlock Margin="0,10,0,10" Text="Phone Number"/> + <TextBox Text="{Binding NewResident.Phone, Mode=TwoWay}" /> + <StackPanel Orientation="Horizontal"> + <Button Margin="0,10,12,10" Content="Create" Width="125"/> + <Button Margin="0,10,0,10" Content="Delte" Width="125"/> + <Button Margin="13,10,0,10" Content="Update" Width="125"/> + </StackPanel> + </StackPanel> </StackPanel> </Grid> </Page> diff --git a/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs index 3b2e45e..c3739e0 100644 --- a/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs +++ b/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs @@ -17,6 +17,8 @@ namespace ApartmentManager.ViewModel public CatalogSingleton CatalogSingleton { get; set; } private User _newUser; + private Resident _newResident; + public static int ApartmentNumber { get; set; } public Handler.ApartmentHandler ApartmentHandler { get; set; } //public ICommand CreateCommand { get; set; } @@ -26,8 +28,10 @@ namespace ApartmentManager.ViewModel public ApartmentViewModel() { NewUser = new User(); + NewResident = new Resident(); ApartmentHandler = new Handler.ApartmentHandler(this); CatalogSingleton = CatalogSingleton.Instance; + ApartmentNumber = CatalogSingleton.User[0].ApartmentNr; //CreateCommand = new RelayCommand(HotelHandler.CreateHotel); //DeleteCommand = new RelayCommand(HotelHandler.DeleteHotel); //UpdateCommand = new RelayCommand(HotelHandler.UpdateHotel); @@ -41,7 +45,16 @@ namespace ApartmentManager.ViewModel _newUser = value; OnPropertyChanged(); } - } + } + public Resident NewResident + { + get => _newResident; + set + { + _newResident = value; + OnPropertyChanged(); + } + } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] diff --git a/HousingDatabase.ldf b/HousingDatabase.ldf Binary files differindex 739eadf..41b54ae 100644 --- a/HousingDatabase.ldf +++ b/HousingDatabase.ldf diff --git a/HousingDatabase.mdf b/HousingDatabase.mdf Binary files differindex 7239095..4a1f64e 100644 --- a/HousingDatabase.mdf +++ b/HousingDatabase.mdf |