aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ApartmentManager/ApartmentManager/Model/Defect.cs12
-rw-r--r--ApartmentManager/ApartmentManager/Singletons/ApartmentsCatalogSingleton.cs6
-rw-r--r--ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs19
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml113
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml25
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentPage.xaml2
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs5
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs18
8 files changed, 137 insertions, 63 deletions
diff --git a/ApartmentManager/ApartmentManager/Model/Defect.cs b/ApartmentManager/ApartmentManager/Model/Defect.cs
index f695c95..5d97831 100644
--- a/ApartmentManager/ApartmentManager/Model/Defect.cs
+++ b/ApartmentManager/ApartmentManager/Model/Defect.cs
@@ -7,24 +7,24 @@ using Windows.UI.Xaml.Controls;
namespace ApartmentManager.Model
{
- class Defect
+ public class Defect
{
public int DefectNumber { get; set; }
public int ApartmentNumber { get; set; }
public string Name { get; set; }
public DateTime DateUploaded { get; set; }
- public Image Picture { get; set; }
- public Image Picture2 { get; set; }
- public Image Picture3 { get; set; }
+ public string Picture { get; set; }
+ public string Picture2 { get; set; }
+ public string Picture3 { get; set; }
public string Description { get; set; }
public string Comment { get; set; }
public string Status { get; set; }
public Defect() { }
- public Defect(int DefectNumber, int ApartmentNumber, string Name, DateTime DateUploaded, Image Picture, Image Picture2, Image Picture3, string Description, string Comment, string Status)
+ public Defect( int ApartmentNumber, string Name, DateTime DateUploaded, string Picture, string Picture2, string Picture3, string Description, string Comment, string Status)
{
- this.DefectNumber = DefectNumber;
+
this.ApartmentNumber = ApartmentNumber;
this.Name = Name;
this.DateUploaded = DateUploaded;
diff --git a/ApartmentManager/ApartmentManager/Singletons/ApartmentsCatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/ApartmentsCatalogSingleton.cs
index c65c241..bcdd13c 100644
--- a/ApartmentManager/ApartmentManager/Singletons/ApartmentsCatalogSingleton.cs
+++ b/ApartmentManager/ApartmentManager/Singletons/ApartmentsCatalogSingleton.cs
@@ -37,9 +37,9 @@ namespace ApartmentManager.Model
//Residents.Add(new Resident("Bibis", "Kiausiai", 3214568, new DateTime(2017, 1, 5, 0, 0, 0), "Bibis@mail.com", 1));
Defects = new ObservableCollection<Defect>();
- Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Not fixed"));
- Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Not fixed"));
- Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Fixed"));
+ //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Not fixed"));
+ //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Not fixed"));
+ //Defects.Add(new Defect(1, 2, "Leaking downpipe", DateTime.Now, new Image(), new Image(), new Image(), "Ze fokin daun paip iz aboot to ekslpod bois", "Iditi vse naxui", "Fixed"));
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
index 998bfb3..490ac49 100644
--- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
+++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
@@ -1,4 +1,5 @@
-using System.Collections.ObjectModel;
+using System;
+using System.Collections.ObjectModel;
using ApartmentManager.Model;
namespace ApartmentManager.Singletons
@@ -9,13 +10,21 @@ namespace ApartmentManager.Singletons
public static CatalogSingleton Instance => instance;
-
+
public Apartment Apartment { get; set; }
public ObservableCollection<Resident> Residents { get; set; }
+ public ObservableCollection<Defect> Defects { get; set; }
private CatalogSingleton()
- {
- Residents = new ObservableCollection<Resident>();
-
+ {
+ Residents = new ObservableCollection<Resident>();
+ Defects = new ObservableCollection<Defect>();
+ Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
+ Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
+ Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
+ Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
+
+ Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
+
}
}
}
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
index 760d56f..a69fe96 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
@@ -1,46 +1,91 @@
<Page
- x:Class="ApartmentManager.View.ApartmentDefectPage"
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.ApartmentDefectPage"
mc:Ignorable="d">
+ <Page.DataContext>
+ <ViewModel:ApartmentViewModel/>
+ </Page.DataContext>
+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <StackPanel Margin="10">
+ <TextBlock Text="Apartment Defects" HorizontalAlignment="Center" FontSize="30" FontWeight="Bold"></TextBlock>
+ <ListView ItemsSource="{Binding CatalogSingleton.Defects}" Height="615" SelectedItem="{Binding NewDefect, Mode=TwoWay}" >
+ <ListView.ItemContainerStyle>
+ <Style TargetType="ListViewItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+ </Style>
+ </ListView.ItemContainerStyle>
+
+ <ListView.ItemTemplate>
+
+ <DataTemplate>
+ <Grid Background="LightGray" Height="200" Margin="0,0,0,5">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="200"/>
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid Grid.Column="0" Background="Gray" BorderThickness="0,0,2,0" BorderBrush="#CCFFFFFF" >
+ <Image Stretch="Fill" Source="{Binding Picture}" />
+ </Grid>
+ <Grid Grid.Column="1" Margin="2">
+ <StackPanel Margin="10">
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Name :" Margin="0,0,10,0" FontSize="30" FontWeight="Bold"/>
+ <TextBlock Text="{Binding Name}" Margin="0,0,10,0" FontSize="30"/>
+
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="0,0,10,0" FontSize="20" Height="108" Width="800"/>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal"/>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Status :" Margin="0,0,10,0" FontSize="25"/>
+ <TextBlock Text="{Binding Status}" Margin="0,0,10,0" FontSize="25"/>
+
+ <TextBlock Text="Date Submitted :" Margin="700,0,10,0" FontSize="25" HorizontalAlignment="Left"/>
+ <TextBlock Text="{Binding DateUploaded}" Margin="0,0,10,0" FontSize="25"/>
+ </StackPanel>
+
+ </StackPanel>
+
+
+ </Grid>
+ </Grid>
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0">
+ <Button Content="New Defect" Width="200" Margin="0,0,100,0" ></Button>
+ <Button Content="View Defect" Width="200" Margin="0,0,100,0" ></Button>
+ </StackPanel>
+
+ </StackPanel>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- <Grid Background="LightGray" Height="200" Margin="0,0,0,5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200"/>
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid Grid.Column="0" Background="Gray" BorderThickness="0,0,2,0" BorderBrush="#CCFFFFFF" >
- <Image Stretch="Fill"/>
- </Grid>
- <Grid Grid.Column="1" Margin="2">
- <StackPanel Margin="10">
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Name :" Margin="0,0,10,0" FontSize="30" FontWeight="Bold"></TextBlock>
- <TextBlock Text="Broken Pipe" Margin="0,0,10,0" FontSize="30"></TextBlock>
-
- </StackPanel>
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="text text text text text text text text text text text text text texttext text text text text texttext text text text text texttext text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text " TextWrapping="Wrap" Margin="0,0,10,0" FontSize="20" Width="800"></TextBlock>
- </StackPanel>
-
- <StackPanel Orientation="Horizontal"/>
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Status" Margin="0,0,10,0" FontSize="25"></TextBlock>
- <TextBlock Text="Date" Margin="700,0,10,0" FontSize="25" HorizontalAlignment="Left"></TextBlock>
- </StackPanel>
-
- </StackPanel>
-
-
- </Grid>
- </Grid>
</Grid>
</Page>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
index b67aad6..c6332e1 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
@@ -1,12 +1,17 @@
<Page
- x:Class="ApartmentManager.View.ApartmentNewDefect"
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.ApartmentNewDefect"
mc:Ignorable="d">
+ <Page.DataContext>
+ <ViewModel:ApartmentViewModel/>
+ </Page.DataContext>
+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
@@ -16,29 +21,29 @@
<StackPanel Margin="0,5,30,0">
<StackPanel Orientation="Horizontal" >
- <Image Height="200" Width="355" ></Image>
- <Button Content="Upload Picture" Margin="30,0,0,0"></Button>
+ <Image Height="200" Width="355" Source="{Binding NewDefect.Picture}" />
+ <Button Content="Upload Picture" Margin="30,0,0,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,30,0,0">
- <Image Height="200" Width="355" ></Image>
- <Button Content="Upload Picture" Margin="30,0,0,0"></Button>
+ <Image Height="200" Width="355" Source="{Binding NewDefect.Picture2}" />
+ <Button Content="Upload Picture" Margin="30,0,0,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,30,0,0">
- <Image Height="200" Width="355" ></Image>
- <Button Content="Upload Picture" Margin="30,0,0,0"></Button>
+ <Image Height="200" Width="355" Source="{Binding NewDefect.Picture3}" />
+ <Button Content="Upload Picture" Margin="30,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Width="400" Margin="0,0,50,0">
<TextBlock Margin="0,10,0,10" Text="Name"/>
- <TextBox Text="sa" />
+ <TextBox Text="{Binding NewDefect.Name, Mode=TwoWay}" />
<TextBlock Margin="0,10,0,10" Text="Description"/>
- <TextBox Text="j" Height="140" />
+ <TextBox Text="{Binding NewDefect.Description, Mode=TwoWay}" Height="140" />
<TextBlock Margin="0,10,0,10" Text="Comment"/>
- <TextBox Text="asd" Height="300" />
+ <TextBox Text="{Binding NewDefect.Comment, Mode=TwoWay}" Height="300" />
<Button Margin="0,20,0,0" Content="Create" HorizontalAlignment="Stretch"/>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
index 14e67f7..acf1cbc 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
@@ -62,7 +62,7 @@
<Button Margin="0,10,0,10" Content="Personal Info" HorizontalAlignment="Stretch" Click="GotoPernalInfoPage"/>
<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"/>
+ <Button Margin="0,10,0,10" Content="Apartment Defects" HorizontalAlignment="Stretch" Click="DefectPage" />
</StackPanel>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs
index 4e5d4c9..e24ad53 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml.cs
@@ -41,5 +41,10 @@ namespace ApartmentManager.View
{
Frame.Navigate(typeof(ApartmentResidentsPage));
}
+
+ private void DefectPage(object sender, RoutedEventArgs e)
+ {
+ Frame.Navigate(typeof(ApartmentDefectPage));
+ }
}
}
diff --git a/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs
index 6379de0..8d1eb10 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/ApartmenViewModel.cs
@@ -17,13 +17,16 @@ namespace ApartmentManager.ViewModel
{
public class ApartmentViewModel : INotifyPropertyChanged
{
-
+ public ApartmentHandler ApartmentHandler { get; set; }
public CatalogSingleton CatalogSingleton { get; set; }
public UserSingleton UserSingleton { get; set; }
+
private User _newUser;
private Resident _newResident;
+ private Defect _newDefect;
+
public static int ApartmentNumber { get; set; }
- public ApartmentHandler ApartmentHandler { get; set; }
+
public ICommand CreateResidentCommand { get; set; }
public ICommand DeleteResidentCommand { get; set; }
@@ -46,9 +49,16 @@ namespace ApartmentManager.ViewModel
UpdateResidentCommand = new RelayCommand(ApartmentHandler.UpdateResident);
ApartmentHandler.GetApartmentResidents();
ApartmentHandler.GetApartment();
+ }
-
-
+ public Defect NewDefect
+ {
+ get => _newDefect;
+ set
+ {
+ _newDefect = value;
+ OnPropertyChanged();
+ }
}
public User NewUser
{