aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ApartmentManager/ApartmentManager/ApartmentManager.csproj24
-rw-r--r--ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs120
-rw-r--r--ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs10
-rw-r--r--ApartmentManager/ApartmentManager/Handler/BmHandler.cs123
-rw-r--r--ApartmentManager/ApartmentManager/Handler/LoginHandler.cs1
-rw-r--r--ApartmentManager/ApartmentManager/Model/Defect.cs40
-rw-r--r--ApartmentManager/ApartmentManager/Model/DefectComment.cs (renamed from ApartmentManager/ApartmentManager/Model/DefectComments.cs)7
-rw-r--r--ApartmentManager/ApartmentManager/Persistency/ApiClient.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs118
-rw-r--r--ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs1
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml106
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentDefectViewPage.xaml111
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml61
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentPage.xaml129
-rw-r--r--ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml211
-rw-r--r--ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml14
-rw-r--r--ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs2
-rw-r--r--ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml14
-rw-r--r--ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml97
-rw-r--r--ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml.cs15
-rw-r--r--ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml132
-rw-r--r--ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml.cs13
-rw-r--r--ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml4
-rw-r--r--ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml108
-rw-r--r--ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml.cs30
-rw-r--r--ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml135
-rw-r--r--ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml.cs30
-rw-r--r--ApartmentManager/ApartmentManager/View/BmUsersPage.xaml10
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs77
-rw-r--r--ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs37
-rw-r--r--ApartmentManager/HousingWebApi/HousingWebApi.csproj2
31 files changed, 1318 insertions, 466 deletions
diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj
index 1b3c63e..0f22d96 100644
--- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj
+++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj
@@ -104,7 +104,7 @@
<Compile Include="Handler\LoginHandler.cs" />
<Compile Include="Handler\ApartmentHandler.cs" />
<Compile Include="Model\Apartment.cs" />
- <Compile Include="Model\DefectComments.cs" />
+ <Compile Include="Model\DefectComment.cs" />
<Compile Include="Model\DefectPicture.cs" />
<Compile Include="Persistency\ImgurPhotoUploader.cs" />
<Compile Include="Singletons\BmSingleton.cs" />
@@ -115,7 +115,6 @@
<Compile Include="Model\User.cs" />
<Compile Include="Singletons\UserSingleton.cs" />
<Compile Include="Persistency\ApiClient.cs" />
- <Compile Include="Persistency\PersistenceFacade.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel\BmViewModel.cs" />
@@ -136,9 +135,15 @@
<Compile Include="View\BmChangesPage.xaml.cs">
<DependentUpon>BmChangesPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="View\BmCreateDefectPage.xaml.cs">
+ <DependentUpon>BmCreateDefectPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="View\BmEditApartmentPage.xaml.cs">
<DependentUpon>BmEditApartmentPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="View\BmEditDefectPage.xaml.cs">
+ <DependentUpon>BmEditDefectPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="View\BmResidentsPage.xaml.cs">
<DependentUpon>BmResidentsPage.xaml</DependentUpon>
</Compile>
@@ -154,6 +159,9 @@
<Compile Include="View\BmCreateApartmentPage.xaml.cs">
<DependentUpon>BmCreateApartmentPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="View\BmSingleDefectPage.xaml.cs">
+ <DependentUpon>BmSingleDefectPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="View\BmUsersPage.xaml.cs">
<DependentUpon>BmUsersPage.xaml</DependentUpon>
</Compile>
@@ -215,10 +223,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="View\BmCreateDefectPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="View\BmEditApartmentPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="View\BmEditDefectPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="View\BmResidentsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -239,6 +255,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="View\BmSingleDefectPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="View\BmUsersPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs b/ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs
deleted file mode 100644
index 9591ad1..0000000
--- a/ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using System;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Media.Animation;
-
-namespace ApartmentManager.Controls
-{
- /// <summary>
- /// A specialized ListView to represent the items in the navigation menu.
- /// </summary>
- /// <remarks>
- /// This class handles the following:
- /// 1. Sizes the panel that hosts the items so they fit in the hosting pane. Otherwise, the keyboard
- /// may appear cut off on one side b/c the Pane clips instead of affecting layout.
- /// 2. Provides a single selection experience where keyboard focus can move without changing selection.
- /// Both the 'Space' and 'Enter' keys will trigger selection. The up/down arrow keys can move
- /// keyboard focus without triggering selection. This is different than the default behavior when
- /// SelectionMode == Single. The default behavior for a ListView in single selection requires using
- /// the Ctrl + arrow key to move keyboard focus without triggering selection. Users won't expect
- /// this type of keyboarding model on the nav menu.
- /// </remarks>
- public class NavMenuListView : ListView
- {
- private SplitView _splitViewHost;
-
- public NavMenuListView()
- {
- SelectionMode = ListViewSelectionMode.Single;
- IsItemClickEnabled = true;
- ItemClick += ItemClickedHandler;
-
- // Locate the hosting SplitView control
- Loaded += (s, a) =>
- {
- var parent = VisualTreeHelper.GetParent(this);
- while (parent != null && !(parent is SplitView))
- {
- parent = VisualTreeHelper.GetParent(parent);
- }
-
- if (parent != null)
- {
- _splitViewHost = parent as SplitView;
- }
- };
- }
-
- protected override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
-
- // Remove the entrance animation on the item containers.
- for (int i = 0; i < ItemContainerTransitions.Count; i++)
- {
- if (ItemContainerTransitions[i] is EntranceThemeTransition)
- {
- ItemContainerTransitions.RemoveAt(i);
- }
- }
- }
-
- /// <summary>
- /// Mark the <paramref name="item"/> as selected and ensures everything else is not.
- /// If the <paramref name="item"/> is null then everything is unselected.
- /// </summary>
- /// <param name="item"></param>
- public void SetSelectedItem(ListViewItem item)
- {
- int index = -1;
- if (item != null)
- {
- index = IndexFromContainer(item);
- }
-
- for (int i = 0; i < Items.Count; i++)
- {
- var lvi = (ListViewItem)ContainerFromIndex(i);
- if (i != index)
- {
- lvi.IsSelected = false;
- }
- else if (i == index)
- {
- lvi.IsSelected = true;
- }
- }
- }
-
- /// <summary>
- /// Occurs when an item has been selected
- /// </summary>
- public event EventHandler<ListViewItem> ItemInvoked;
-
- private void ItemClickedHandler(object sender, ItemClickEventArgs e)
- {
- // Triggered when the item is selected using something other than a keyboard
- var item = ContainerFromItem(e.ClickedItem);
- InvokeItem(item);
- }
-
- private void InvokeItem(object focusedItem)
- {
- SetSelectedItem(focusedItem as ListViewItem);
- ItemInvoked?.Invoke(this, focusedItem as ListViewItem);
-
- if (_splitViewHost.IsPaneOpen && (
- _splitViewHost.DisplayMode == SplitViewDisplayMode.CompactOverlay ||
- _splitViewHost.DisplayMode == SplitViewDisplayMode.Overlay))
- {
- _splitViewHost.IsPaneOpen = false;
- }
-
- if (focusedItem is ListViewItem)
- {
- ((ListViewItem)focusedItem).Focus(FocusState.Programmatic);
- }
- }
- }
-} \ No newline at end of file
diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
index df38ecb..34cbb7c 100644
--- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
@@ -172,7 +172,7 @@ namespace ApartmentManager.Handler
var defecttlist = JsonConvert.DeserializeObject<ObservableCollection<Defect>>(defectsFromDatabase);
foreach (var defect in defecttlist)
{
- var picturesFromDatabase = ApiClient.GetData("api/DefectPictures/" + defect.DefectId);
+ var picturesFromDatabase = ApiClient.GetData("api/DefectPicturesById/" + defect.DefectId);
if (picturesFromDatabase != "[]")
{
ApartmentViewModel.CatalogSingleton.DefectPictures = JsonConvert.DeserializeObject<ObservableCollection<DefectPicture>>(picturesFromDatabase);
@@ -246,10 +246,10 @@ namespace ApartmentManager.Handler
{
var defectFromDatabase = ApiClient.GetData("api/defects/" + ApartmentViewModel.NewDefect.DefectId);
ApartmentViewModel.CatalogSingleton.Defect = JsonConvert.DeserializeObject<Defect>(defectFromDatabase);
- var picturesFromDatabase = ApiClient.GetData("api/DefectPictures/" + ApartmentViewModel.NewDefect.DefectId);
+ var picturesFromDatabase = ApiClient.GetData("api/DefectPicturesById/" + ApartmentViewModel.NewDefect.DefectId);
ApartmentViewModel.CatalogSingleton.DefectPictures = JsonConvert.DeserializeObject<ObservableCollection<DefectPicture>>(picturesFromDatabase);
var defectComments = ApiClient.GetData("api/Defectcomments/" + ApartmentViewModel.NewDefect.DefectId);
- ApartmentViewModel.CatalogSingleton.DefectComments = JsonConvert.DeserializeObject<ObservableCollection<DefectComments>>(defectComments);
+ ApartmentViewModel.CatalogSingleton.DefectComments = JsonConvert.DeserializeObject<ObservableCollection<DefectComment>>(defectComments);
CatalogSingleton.Instance.DefectId = ApartmentViewModel.NewDefect.DefectId;
}
catch (Exception e)
@@ -263,7 +263,7 @@ namespace ApartmentManager.Handler
{
try
{
- DefectComments Comment = new DefectComments();
+ DefectComment Comment = new DefectComment();
Comment.Comment = ApartmentViewModel.NewDefectComment.Comment;
Comment.DefectId = CatalogSingleton.Instance.Defect.DefectId;
Comment.Name = UserSingleton.Instance.CurrentUser.FirstName + " " + UserSingleton.Instance.CurrentUser.LastName;
@@ -273,7 +273,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/Defectcomments/", Comment);
}
var response = ApiClient.GetData("api/Defectcomments/" + CatalogSingleton.Instance.DefectId);
- var commentlist = JsonConvert.DeserializeObject<ObservableCollection<DefectComments>>(response);
+ var commentlist = JsonConvert.DeserializeObject<ObservableCollection<DefectComment>>(response);
CatalogSingleton.Instance.DefectComments.Clear();
foreach (var comment in commentlist)
{
diff --git a/ApartmentManager/ApartmentManager/Handler/BmHandler.cs b/ApartmentManager/ApartmentManager/Handler/BmHandler.cs
index 2cbffea..8709180 100644
--- a/ApartmentManager/ApartmentManager/Handler/BmHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/BmHandler.cs
@@ -6,6 +6,7 @@ using ApartmentManager.Persistency;
using ApartmentManager.ViewModel;
using Newtonsoft.Json;
using ApartmentManager.Singletons;
+using System.Collections.Generic;
namespace ApartmentManager.Handler
{
@@ -204,5 +205,127 @@ namespace ApartmentManager.Handler
}
#endregion
+ #region DEFECTS
+
+ public void GetDefects()
+ {
+ var defects = JsonConvert.DeserializeObject<ObservableCollection<Defect>>(ApiClient.GetData("api/Defects/"));
+ BmSingleton.Instance.Defects.Clear();
+ foreach (var defect in defects)
+ {
+ defect.Pictures = JsonConvert.DeserializeObject<ObservableCollection<DefectPicture>>(ApiClient.GetData("api/DefectPicturesById/" + defect.DefectId));
+ defect.Comments = JsonConvert.DeserializeObject<ObservableCollection<DefectComment>>(ApiClient.GetData("api/DefectComments/" + defect.DefectId));
+ BmSingleton.Instance.Defects.Add(defect);
+ }
+ }
+
+ public void CreateDefect()
+ {
+ try
+ {
+ _vm.DefectTemplate.Status = "New";
+ _vm.DefectTemplate.UploadDate = DateTime.Now;
+ var response = JsonConvert.DeserializeObject<Defect>(ApiClient.PostData("api/Defects/", _vm.DefectTemplate));
+ foreach(var defectPicture in _vm.DefectTemplate.Pictures)
+ {
+ defectPicture.DefectId = response.DefectId;
+ ApiClient.PostData("api/DefectPictures", defectPicture);
+ }
+ GetDefects();
+ _vm.DefectTemplate = new Defect();
+ }
+ catch (Exception e)
+ {
+ var msg = new MessageDialog(e.Message).ShowAsync();
+ }
+ }
+ public void UpdateDefect()
+ {
+ try
+ {
+ ApiClient.PutData("api/Defects/" + _vm.DefectTemplate.DefectId, _vm.DefectTemplate);
+ var deletedDefectPictures = new List<DefectPicture>(_vm.DeletedDefectPictures);
+ var addedDefectPictures = new List<DefectPicture>(_vm.AddedDefectPictures);
+
+ foreach (var defectPicture in deletedDefectPictures)
+ {
+ ApiClient.DeleteData("api/DefectPictures/" + defectPicture.Pictureid);
+ _vm.DeletedDefectPictures.Remove(defectPicture);
+ }
+ foreach (var defectPicture in addedDefectPictures)
+ {
+ defectPicture.DefectId = _vm.DefectTemplate.DefectId;
+ ApiClient.PostData("api/DefectPictures", defectPicture);
+ addedDefectPictures.Remove(defectPicture);
+ }
+ GetDefects();
+ }
+ catch (Exception e)
+ {
+ var msg = new MessageDialog(e.Message).ShowAsync();
+ }
+ }
+ public void DeleteDefect()
+ {
+ try
+ {
+ ApiClient.DeleteData("api/Defects/" + _vm.DefectTemplate.DefectId);
+ BmSingleton.Instance.Defects.Remove(_vm.DefectTemplate);
+ GetDefects();
+ }
+ catch (Exception e)
+ {
+ var msg = new MessageDialog(e.Message).ShowAsync();
+ }
+ }
+
+ public void ClearDefectTemplate()
+ {
+ _vm.DefectTemplate = new Defect();
+ }
+
+ public async void UploadDefectPicture()
+ {
+ if (_vm.DefectTemplate.Pictures == null) _vm.DefectTemplate.Pictures = new ObservableCollection<DefectPicture>();
+ var picture = new DefectPicture() { Picture = await ImgurPhotoUploader.UploadPhotoAsync() };
+ _vm.DefectTemplate.Pictures.Add(picture);
+ _vm.AddedDefectPictures.Add(picture);
+ }
+
+ public void DeleteDefectPicture()
+ {
+ _vm.DefectTemplate.Pictures.Remove(_vm.SelectedDefectPicture);
+ }
+
+ public void DeleteDefectPictureTemp()
+ {
+ _vm.DeletedDefectPictures.Add(_vm.SelectedDefectPicture);
+ _vm.DefectTemplate.Pictures.Remove(_vm.SelectedDefectPicture);
+ }
+
+ public void CreateDefectComment()
+ {
+ try
+ {
+ var comment = new DefectComment()
+ {
+ Comment = _vm.NewDefectComment.Comment,
+ DefectId = _vm.DefectTemplate.DefectId,
+ Name = UserSingleton.Instance.CurrentUser.FirstName + " " + UserSingleton.Instance.CurrentUser.LastName,
+ Date = DateTimeOffset.Now
+ };
+ if (!string.IsNullOrEmpty(comment.Comment))
+ {
+ ApiClient.PostData("api/DefectComments/", comment);
+ _vm.DefectTemplate.Comments.Add(comment);
+ _vm.NewDefectComment = new DefectComment();
+ }
+ }
+ catch (Exception e)
+ {
+ new MessageDialog(e.Message).ShowAsync();
+ }
+ }
+ #endregion
}
}
diff --git a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
index e4d9721..4f93cc1 100644
--- a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
@@ -79,6 +79,7 @@ namespace ApartmentManager.Handler
bvm.BmHandler.GetApartments();
bvm.BmHandler.GetUsers();
bvm.BmHandler.GetResidents();
+ bvm.BmHandler.GetDefects();
appShell.AppFrame.Navigate(typeof(BmMainPage));
}
else
diff --git a/ApartmentManager/ApartmentManager/Model/Defect.cs b/ApartmentManager/ApartmentManager/Model/Defect.cs
index ea305e6..6e78e66 100644
--- a/ApartmentManager/ApartmentManager/Model/Defect.cs
+++ b/ApartmentManager/ApartmentManager/Model/Defect.cs
@@ -1,8 +1,12 @@
-using System;
+using ApartmentManager.Annotations;
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
namespace ApartmentManager.Model
{
- public class Defect
+ public class Defect : INotifyPropertyChanged
{
public int DefectId { get; set; }
public int ApartmentId { get; set; }
@@ -11,6 +15,8 @@ namespace ApartmentManager.Model
public string Description { get; set; }
public string Status { get; set; }
public string MainPicture { get; set; }
+ private ObservableCollection<DefectPicture> _pictures;
+ private ObservableCollection<DefectComment> _comments;
public Defect() { }
@@ -23,9 +29,39 @@ namespace ApartmentManager.Model
Description = description;
Status = status;
}
+
public override string ToString()
{
return string.Format($"Defect ID: {DefectId}, Apartment number: {ApartmentId}, Name: {Name}, Upload date: {UploadDate}, Description: {Description}, Status: {Status}");
}
+
+ public ObservableCollection<DefectPicture> Pictures
+ {
+ get => _pictures;
+ set
+ {
+ _pictures = value;
+ OnPropertyChanged(nameof(Pictures));
+ }
+ }
+
+ public ObservableCollection<DefectComment> Comments
+ {
+ get => _comments;
+ set
+ {
+ _comments = value;
+ OnPropertyChanged(nameof(Comments));
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ [NotifyPropertyChangedInvocator]
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+ }
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/DefectComments.cs b/ApartmentManager/ApartmentManager/Model/DefectComment.cs
index a1e6d1e..7610e0b 100644
--- a/ApartmentManager/ApartmentManager/Model/DefectComments.cs
+++ b/ApartmentManager/ApartmentManager/Model/DefectComment.cs
@@ -1,14 +1,9 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace ApartmentManager.Model
{
- public class DefectComments
+ public class DefectComment
{
-
public int CommentId { get; set; }
public int DefectId { get; set; }
public string Comment { get; set; }
diff --git a/ApartmentManager/ApartmentManager/Persistency/ApiClient.cs b/ApartmentManager/ApartmentManager/Persistency/ApiClient.cs
index b99f582..8f59a38 100644
--- a/ApartmentManager/ApartmentManager/Persistency/ApiClient.cs
+++ b/ApartmentManager/ApartmentManager/Persistency/ApiClient.cs
@@ -3,8 +3,6 @@ using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
-using ApartmentManager.Model;
-using ApartmentManager.ViewModel;
namespace ApartmentManager.Persistency
{
diff --git a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs b/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
deleted file mode 100644
index 3a6f85e..0000000
--- a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Popups;
-using ApartmentManager.Model;
-using Newtonsoft.Json;
-
-namespace ApartmentManager.Persistency
-{
- class PersistenceFacade
- {
-
- const string ServerUrl = "http://localhost:60916";
- HttpClientHandler handler;
-
- public PersistenceFacade()
- {
- handler = new HttpClientHandler();
- handler.UseDefaultCredentials = true;
- }
-
- // Get apartments
-
- public void CreateApartment(Apartment apartment)
- {
- using (var client = new HttpClient(handler))
- {
- client.BaseAddress = new Uri(ServerUrl);
- client.DefaultRequestHeaders.Clear();
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- try
- {
- string postBody = JsonConvert.SerializeObject(apartment);
- var response = client.PostAsync("api/apartments/",
- new StringContent(postBody, Encoding.UTF8, "application/json"))
- .Result;
- if (response.IsSuccessStatusCode)
- {
- new MessageDialog("Success").ShowAsync();
- }
- else
- {
- new MessageDialog("Error").ShowAsync();
- }
-
- }
- catch (Exception ex)
- {
- new MessageDialog(ex.Message).ShowAsync();
- }
- }
- }
-
- ///Get Get Residents///
- public List<Resident> GetApartmentResidents(Resident resident)
- {
- using (var client = new HttpClient(handler))
- {
- client.BaseAddress = new Uri(ServerUrl);
- client.DefaultRequestHeaders.Clear();
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- try
- {
- string residentsBody = "api/residents/" + resident.ApartmentId;
- var response = client.GetAsync(residentsBody).Result;
-
- if (response.IsSuccessStatusCode)
- {
- var residentList = response.Content.ReadAsAsync<IEnumerable<Resident>>().Result;
- return residentList.ToList();
- }
-
- }
- catch (Exception ex)
- {
- new MessageDialog(ex.Message).ShowAsync();
- }
- return null;
- }
- }
- ///Get Get Residents///
- public void CreateResident(Resident resident)
- {
- using (var client = new HttpClient(handler))
- {
- client.BaseAddress = new Uri(ServerUrl);
- client.DefaultRequestHeaders.Clear();
- client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- try
- {
- string postBody = JsonConvert.SerializeObject(resident);
- var response = client.PostAsync("api/Residents",
- new StringContent(postBody, Encoding.UTF8, "application/json"))
- .Result;
- if (response.IsSuccessStatusCode)
- {
- new MessageDialog("Success").ShowAsync();
- }
- else
- {
- new MessageDialog("Error").ShowAsync();
- }
-
- }
- catch (Exception ex)
- {
- new MessageDialog(ex.Message).ShowAsync();
- }
- }
-
- }
-
- }
-}
diff --git a/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs
index 737a1f3..5ee5019 100644
--- a/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs
+++ b/ApartmentManager/ApartmentManager/Singletons/BmSingleton.cs
@@ -17,6 +17,7 @@ namespace ApartmentManager.Singletons
{
Users = new ObservableCollection<User>();
Residents = new ObservableCollection<Resident>();
+ Defects = new ObservableCollection<Defect>();
}
}
}
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
index 001de31..7b4a853 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectPage.xaml
@@ -1,11 +1,11 @@
<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:ViewModel="using:ApartmentManager.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ViewModel="using:ApartmentManager.ViewModel"
- x:Class="ApartmentManager.View.ApartmentDefectPage"
mc:Ignorable="d">
<!--<Page.DataContext>
@@ -14,51 +14,90 @@
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Margin="10">
- <TextBlock Text="Apartment Defects" HorizontalAlignment="Center" FontSize="30" FontWeight="Bold"></TextBlock>
- <ListView ItemsSource="{Binding CatalogSingleton.Defects}" Height="500" SelectedItem="{Binding NewDefect, Mode=TwoWay}" >
+ <TextBlock
+ HorizontalAlignment="Center"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Apartment Defects" />
+ <ListView
+ Height="550"
+ ItemsSource="{Binding CatalogSingleton.Defects}"
+ SelectedItem="{Binding NewDefect, Mode=TwoWay}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
- <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
- <Grid Background="LightGray" Height="200" Margin="0,0,0,5">
+ <Grid
+ Height="200"
+ Margin="0,0,0,5"
+ Background="LightGray">
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="200"/>
+ <ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
- <Grid Grid.Column="0" Background="Gray" BorderThickness="0,0,2,0" BorderBrush="#CCFFFFFF" >
- <Image Stretch="Fill" Source="{Binding MainPicture}" />
+ <Grid
+ Grid.Column="0"
+ Background="Gray"
+ BorderBrush="#CCFFFFFF"
+ BorderThickness="0,0,2,0">
+ <Image Source="{Binding MainPicture}" 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 Text="{Binding Name}" Margin="0,0,10,0" FontSize="30"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Name :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ Text="{Binding Name}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="0,0,10,0" FontSize="20" Height="108" Width="800"/>
+ <TextBlock
+ Width="800"
+ Height="108"
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding Description}"
+ TextWrapping="Wrap" />
</StackPanel>
- <StackPanel Orientation="Horizontal"/>
+ <StackPanel Orientation="Horizontal" />
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Status :" Margin="0,0,10,0" FontSize="25" FontWeight="Bold"/>
- <TextBlock Text="{Binding Status}" Margin="0,0,10,0" FontSize="25"/>
-
- <TextBlock Text="Date Submitted :" Margin="700,0,10,0" FontSize="25" FontWeight="Bold" HorizontalAlignment="Left"/>
- <TextBlock Text="{Binding UploadDate.Year}" FontSize="25"/>
- <TextBlock Text="-" FontSize="25"/>
- <TextBlock Text="{Binding UploadDate.Month}" FontSize="25"/>
- <TextBlock Text="-" FontSize="25"/>
- <TextBlock Text="{Binding UploadDate.Day}" FontSize="25"/>
-
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="25"
+ FontWeight="Bold"
+ Text="Status :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="25"
+ Text="{Binding Status}" />
+
+ <TextBlock
+ Margin="700,0,10,0"
+ HorizontalAlignment="Left"
+ FontSize="25"
+ FontWeight="Bold"
+ Text="Date Submitted :" />
+ <TextBlock FontSize="25" Text="{Binding UploadDate.Year}" />
+ <TextBlock FontSize="25" Text="-" />
+ <TextBlock FontSize="25" Text="{Binding UploadDate.Month}" />
+ <TextBlock FontSize="25" Text="-" />
+ <TextBlock FontSize="25" Text="{Binding UploadDate.Day}" />
+
</StackPanel>
</StackPanel>
@@ -69,11 +108,22 @@
</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" Click="NavigateNewDefect" ></Button>
- <Button Content="View Defect" Width="200" Margin="0,0,100,0" Click="NavigateDefect" ></Button>
+ <StackPanel
+ Margin="0,15,0,0"
+ HorizontalAlignment="Right"
+ Orientation="Horizontal">
+ <Button
+ Width="200"
+ Margin="0,0,100,0"
+ Click="NavigateNewDefect"
+ Content="New Defect" />
+ <Button
+ Width="200"
+ Margin="0,0,100,0"
+ Click="NavigateDefect"
+ Content="View Defect" />
</StackPanel>
-
+
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPage.xaml
index 406cb8c..38a2e50 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentDefectViewPage.xaml
@@ -1,41 +1,69 @@
<Page
+ x:Class="ApartmentManager.View.ApartmentDefectViewPagexaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:ApartmentManager.View"
+ xmlns:ViewModel="using:ApartmentManager.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ViewModel="using:ApartmentManager.ViewModel"
- x:Class="ApartmentManager.View.ApartmentDefectViewPagexaml"
mc:Ignorable="d">
<Page.DataContext>
- <ViewModel:ApartmentViewModel/>
+ <ViewModel:ApartmentViewModel />
</Page.DataContext>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ScrollViewer>
<StackPanel>
- <StackPanel Orientation="Horizontal" Margin="10,10,10,0">
- <TextBlock Text="Name :" FontSize="30" FontWeight="Bold" Margin="100,0,0,0"/>
- <TextBlock Text="{Binding CatalogSingleton.Defect.Name}" FontSize="30" Margin="10,0,0,0"/>
- <TextBlock Text="Status :" FontSize="30" FontWeight="Bold" Margin="700,0,0,0"/>
- <TextBlock Text="{Binding CatalogSingleton.Defect.Status}" FontSize="30" Margin="10,0,0,0"/>
+ <StackPanel Margin="10,10,10,0" Orientation="Horizontal">
+ <TextBlock
+ Margin="100,0,0,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Name :" />
+ <TextBlock
+ Margin="10,0,0,0"
+ FontSize="30"
+ Text="{Binding CatalogSingleton.Defect.Name}" />
+ <TextBlock
+ Margin="700,0,0,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Status :" />
+ <TextBlock
+ Margin="10,0,0,0"
+ FontSize="30"
+ Text="{Binding CatalogSingleton.Defect.Status}" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="20,0,20,20">
+ <StackPanel Margin="20,0,20,20" Orientation="Horizontal">
<StackPanel Width="620" Margin="0,50,0,0">
- <GridView ItemsSource="{Binding CatalogSingleton.DefectPictures, Mode=TwoWay}" Height="420" Width="500" >
+ <GridView
+ Width="500"
+ Height="420"
+ ItemsSource="{Binding CatalogSingleton.DefectPictures, Mode=TwoWay}">
<GridView.ItemTemplate>
<DataTemplate>
- <Image Source="{Binding Picture}" Width="220" Margin="10,0,10,10"></Image>
+ <Image
+ Width="220"
+ Margin="10,0,10,10"
+ Source="{Binding Picture}" />
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</StackPanel>
<StackPanel Width="620">
- <TextBlock Text="Description" FontSize="30" FontWeight="Bold" Margin="10,0,0,10"/>
- <Grid BorderThickness="1" BorderBrush="Black">
- <TextBlock Height="400" Margin="10" TextWrapping="WrapWholeWords" Text="{Binding CatalogSingleton.Defect.Description, Mode=TwoWay}"/>
+ <TextBlock
+ Margin="10,0,0,10"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Description" />
+ <Grid BorderBrush="Black" BorderThickness="1">
+ <TextBlock
+ Height="400"
+ Margin="10"
+ Text="{Binding CatalogSingleton.Defect.Description, Mode=TwoWay}"
+ TextWrapping="WrapWholeWords" />
</Grid>
@@ -44,38 +72,55 @@
</StackPanel>
<StackPanel Width="600" Margin="0,20,0,0">
- <TextBlock Text="Comments" FontSize="30" FontWeight="Bold" Margin="10,0,0,10"/>
+ <TextBlock
+ Margin="10,0,0,10"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Comments" />
<StackPanel Orientation="Horizontal">
- <TextBox Width="500" Height="80" TextWrapping="Wrap" Text="{Binding NewDefectComment.Comment, Mode=TwoWay}"></TextBox>
- <Button Content="Comment" Margin="10,0,0,0" Command="{Binding CreateDefectComment}"></Button>
+ <TextBox
+ Width="500"
+ Height="80"
+ Text="{Binding NewDefectComment.Comment, Mode=TwoWay}"
+ TextWrapping="Wrap" />
+ <Button
+ Margin="10,0,0,0"
+ Command="{Binding CreateDefectComment}"
+ Content="Comment" />
</StackPanel>
- <ListView ItemsSource="{Binding CatalogSingleton.DefectComments}">
+ <ListView ItemsSource="{Binding CatalogSingleton.DefectComments}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
- <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
- <Grid Margin="10">
+ <Grid Margin="10">
<StackPanel>
- <TextBlock Text="{Binding Name}" FontWeight="Bold" Margin="5,0,0,0"></TextBlock>
- <TextBlock Margin="5" TextWrapping="WrapWholeWords" Text="{Binding Comment}"></TextBlock>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+ <TextBlock
+ Margin="5,0,0,0"
+ FontWeight="Bold"
+ Text="{Binding Name}" />
+ <TextBlock
+ Margin="5"
+ Text="{Binding Comment}"
+ TextWrapping="WrapWholeWords" />
+ <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Margin="0,0,0,5">
- <Run Text="{Binding Date.Year}" FontWeight="Bold"/>
- <Run Text="-" FontWeight="Bold"/>
- <Run Text="{Binding Date.Month}" FontWeight="Bold"/>
- <Run Text="-" FontWeight="Bold"/>
- <Run Text="{Binding Date.Day}" FontWeight="Bold"/>
- <Run Text=" " FontWeight="Bold"/>
- <Run Text="{Binding Date.Hour}" FontWeight="Bold"/>
- <Run Text=":" FontWeight="Bold"/>
- <Run Text="{Binding Date.Minute}" FontWeight="Bold"/>
+ <Run FontWeight="Bold" Text="{Binding Date.Year}" />
+ <Run FontWeight="Bold" Text="-" />
+ <Run FontWeight="Bold" Text="{Binding Date.Month}" />
+ <Run FontWeight="Bold" Text="-" />
+ <Run FontWeight="Bold" Text="{Binding Date.Day}" />
+ <Run FontWeight="Bold" Text=" " />
+ <Run FontWeight="Bold" Text="{Binding Date.Hour}" />
+ <Run FontWeight="Bold" Text=":" />
+ <Run FontWeight="Bold" Text="{Binding Date.Minute}" />
</TextBlock>
</StackPanel>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
index c68a36d..ab919b6 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentNewDefect.xaml
@@ -1,47 +1,72 @@
<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:ViewModel="using:ApartmentManager.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ViewModel="using:ApartmentManager.ViewModel"
- x:Class="ApartmentManager.View.ApartmentNewDefect"
mc:Ignorable="d">
-
+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
- <TextBlock Margin="0,10,0,10" Text="Defect Information" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"/>
+ <TextBlock
+ Margin="0,10,0,10"
+ HorizontalAlignment="Center"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Defect Information" />
<StackPanel Orientation="Horizontal">
<StackPanel Margin="0,5,30,0">
- <ListView ItemsSource="{Binding CatalogSingleton.DefectPictures, Mode=TwoWay}" Height="600" Width="500" SelectedItem="{Binding SelectedDefectPicture, Mode=TwoWay}">
+ <ListView
+ Width="500"
+ Height="600"
+ ItemsSource="{Binding CatalogSingleton.DefectPictures, Mode=TwoWay}"
+ SelectedItem="{Binding SelectedDefectPicture, Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate>
- <Image Source="{Binding Picture}" Width="400" Margin="10"></Image>
+ <Image
+ Width="400"
+ Margin="10"
+ Source="{Binding Picture}" />
</DataTemplate>
</ListView.ItemTemplate>
-
+
</ListView>
- <StackPanel Orientation="Horizontal" Margin="10" >
- <Button Content="Upload Picture" Margin="30,0,0,0" Command="{Binding UploadDefectPicture}"/>
- <Button Content="Delete Picture" Margin="170,0,0,0" Command="{Binding DeleteDefectPicture}"/>
+ <StackPanel Margin="10" Orientation="Horizontal">
+ <Button
+ Margin="30,0,0,0"
+ Command="{Binding UploadDefectPicture}"
+ Content="Upload Picture" />
+ <Button
+ Margin="170,0,0,0"
+ Command="{Binding DeleteDefectPicture}"
+ Content="Delete Picture" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="0,30,0,0"/>
- <StackPanel Orientation="Horizontal" Margin="0,30,0,0"/>
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
</StackPanel>
<StackPanel Width="400" Margin="0,0,50,0">
- <TextBlock Margin="0,10,0,10" Text="Name"/>
+ <TextBlock Margin="0,10,0,10" Text="Name" />
<TextBox Text="{Binding NewDefect.Name, Mode=TwoWay}" />
- <TextBlock Margin="0,10,0,10" Text="Description"/>
- <TextBox Text="{Binding NewDefect.Description, Mode=TwoWay}" Height="417" TextWrapping="Wrap"/>
- <Button Margin="0,20,0,0" Content="Create" HorizontalAlignment="Stretch" Click="Navigate"/>
+ <TextBlock Margin="0,10,0,10" Text="Description" />
+ <TextBox
+ Height="417"
+ Text="{Binding NewDefect.Description, Mode=TwoWay}"
+ TextWrapping="Wrap" />
+ <Button
+ Margin="0,20,0,0"
+ HorizontalAlignment="Stretch"
+ Click="Navigate"
+ Content="Create" />
</StackPanel>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
index 6a3f6c1..06bf787 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentPage.xaml
@@ -1,73 +1,132 @@
<Page
+ x:Class="ApartmentManager.View.ApartmentPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:ApartmentManager.View"
+ xmlns:ViewModel="using:ApartmentManager.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ViewModel="using:ApartmentManager.ViewModel"
- x:Class="ApartmentManager.View.ApartmentPage"
mc:Ignorable="d">
<Page.DataContext>
- <ViewModel:ApartmentViewModel/>
+ <ViewModel:ApartmentViewModel />
</Page.DataContext>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="50" >
+ <StackPanel
+ Margin="50"
+ VerticalAlignment="Top"
+ Orientation="Horizontal">
- <StackPanel VerticalAlignment="Top" Margin="50,0,20,0">
- <Image Source="{Binding CatalogSingleton.Apartment.PlanPicture}" MaxWidth="800" MaxHeight="650"></Image>
+ <StackPanel Margin="50,0,20,0" VerticalAlignment="Top">
+ <Image
+ MaxWidth="800"
+ MaxHeight="650"
+ Source="{Binding CatalogSingleton.Apartment.PlanPicture}" />
</StackPanel>
-
+
<StackPanel>
-
+
<StackPanel>
-
+
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Address :" FontSize="20" Margin="0,0,10,0" FontWeight="Bold" />
- <TextBlock Text="{Binding CatalogSingleton.Apartment.Address}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Address :" />
+ <TextBlock FontSize="20" Text="{Binding CatalogSingleton.Apartment.Address}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Floor :" FontSize="20" Margin="0,0,10,0" FontWeight="Bold" />
- <TextBlock Text="{Binding CatalogSingleton.Apartment.Floor}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Floor :" />
+ <TextBlock FontSize="20" Text="{Binding CatalogSingleton.Apartment.Floor}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Apartment Number :" FontSize="20" Margin="0,0,10,0" FontWeight="Bold"/>
- <TextBlock Text="{Binding CatalogSingleton.Apartment.ApartmentId}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Apartment Number :" />
+ <TextBlock FontSize="20" Text="{Binding CatalogSingleton.Apartment.ApartmentId}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Size :" FontSize="20" Margin="0,0,10,0" FontWeight="Bold"/>
- <TextBlock Text="{Binding CatalogSingleton.Apartment.Size}" FontSize="20" Margin="0,0,10,0"/>
- <TextBlock Text="m2" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Size :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding CatalogSingleton.Apartment.Size}" />
+ <TextBlock FontSize="20" Text="m2" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Number of Rooms :" FontSize="20" Margin="0,0,10,0" FontWeight="Bold"/>
- <TextBlock Text="{Binding CatalogSingleton.Apartment.NumberOfRooms}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Number of Rooms :" />
+ <TextBlock FontSize="20" Text="{Binding CatalogSingleton.Apartment.NumberOfRooms}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Monthly Charge:" FontSize="20" Margin="0,0,10,0" FontWeight="Bold"/>
- <TextBlock Text="{Binding CatalogSingleton.Apartment.MonthlyCharge}" FontSize="20" Margin="0,0,10,0"/>
- <TextBlock Text="DKK" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Monthly Charge:" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding CatalogSingleton.Apartment.MonthlyCharge}" />
+ <TextBlock FontSize="20" Text="DKK" />
</StackPanel>
-
+
</StackPanel>
-
- <StackPanel Margin="0,20,0,0" Width="250" VerticalAlignment="Top" HorizontalAlignment="Left">
- <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" Click="ResidentPage"/>
- <Button Margin="0,10,0,10" Content="Apartment Changes" HorizontalAlignment="Stretch"/>
- <Button Margin="0,10,0,10" Content="Apartment Defects" HorizontalAlignment="Stretch" Click="DefectPage" />
+
+ <StackPanel
+ Width="250"
+ Margin="0,20,0,0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Top">
+ <Button
+ Margin="0,10,0,10"
+ HorizontalAlignment="Stretch"
+ Click="click"
+ Content="Apartment Plan" />
+ <Button
+ Margin="0,10,0,10"
+ HorizontalAlignment="Stretch"
+ Click="GotoPernalInfoPage"
+ Content="Personal Info" />
+ <Button
+ Margin="0,10,0,10"
+ HorizontalAlignment="Stretch"
+ Click="ResidentPage"
+ Content="Residents" />
+ <Button
+ Margin="0,10,0,10"
+ HorizontalAlignment="Stretch"
+ Content="Apartment Changes" />
+ <Button
+ Margin="0,10,0,10"
+ HorizontalAlignment="Stretch"
+ Click="DefectPage"
+ Content="Apartment Defects" />
</StackPanel>
-
+
</StackPanel>
-
+
</StackPanel>
-
+
</Grid>
</Page>
diff --git a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml
index 8535d91..00b6a75 100644
--- a/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/ApartmentResidentsPage.xaml
@@ -1,30 +1,42 @@
<Page
+ x:Class="ApartmentManager.View.ApartmentResidentsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:ApartmentManager.View"
+ xmlns:Common="using:ApartmentManager.Common"
+ xmlns:ViewModel="using:ApartmentManager.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ViewModel="using:ApartmentManager.ViewModel"
- xmlns:Common="using:ApartmentManager.Common"
- x:Class="ApartmentManager.View.ApartmentResidentsPage"
mc:Ignorable="d">
<Page.DataContext>
- <ViewModel:ApartmentViewModel/>
+ <ViewModel:ApartmentViewModel />
</Page.DataContext>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <StackPanel Margin="10" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="top" >
+ <StackPanel
+ Margin="10"
+ HorizontalAlignment="Center"
+ VerticalAlignment="top"
+ Orientation="Horizontal">
<StackPanel Margin="10">
- <Grid Background="LightGray" Height="150" Width="800" Margin="0,0,0,5">
+ <Grid
+ Width="800"
+ Height="150"
+ Margin="0,0,0,5"
+ Background="LightGray">
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="150"/>
+ <ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
- <Grid Grid.Column="0" Background="Gray" BorderThickness="0,0,2,0" BorderBrush="#CCFFFFFF" >
- <Image Stretch="Fill" Source="{Binding UserSingleton.CurrentUser.Picture}"/>
+ <Grid
+ Grid.Column="0"
+ Background="Gray"
+ BorderBrush="#CCFFFFFF"
+ BorderThickness="0,0,2,0">
+ <Image Source="{Binding UserSingleton.CurrentUser.Picture}" Stretch="Fill" />
</Grid>
<Grid Grid.Column="1" Margin="3,3,3,3">
@@ -32,54 +44,93 @@
<StackPanel Margin="10">
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Full Name :" Margin="0,0,10,0" FontSize="30" FontWeight="Bold" />
- <TextBlock Text="{Binding UserSingleton.CurrentUser.FirstName}" Margin="0,0,10,0" FontSize="30"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.LastName}" Margin="0,0,10,0" FontSize="30"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Full Name :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ Text="{Binding UserSingleton.CurrentUser.FirstName}" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ Text="{Binding UserSingleton.CurrentUser.LastName}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Email Address :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.Email}" Margin="0,0,10,0" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Email Address :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding UserSingleton.CurrentUser.Email}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Phone Number :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.Phone}" Margin="0,0,10,0" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Phone Number :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding UserSingleton.CurrentUser.Phone}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Birth Date :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.BirthDate.Year}" FontSize="20"/>
- <TextBlock Text="-" FontSize="20"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.BirthDate.Month}" FontSize="20"/>
- <TextBlock Text="-" FontSize="20"/>
- <TextBlock Text="{Binding UserSingleton.CurrentUser.BirthDate.Day}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Birth Date :" />
+ <TextBlock FontSize="20" Text="{Binding UserSingleton.CurrentUser.BirthDate.Year}" />
+ <TextBlock FontSize="20" Text="-" />
+ <TextBlock FontSize="20" Text="{Binding UserSingleton.CurrentUser.BirthDate.Month}" />
+ <TextBlock FontSize="20" Text="-" />
+ <TextBlock FontSize="20" Text="{Binding UserSingleton.CurrentUser.BirthDate.Day}" />
</StackPanel>
</StackPanel>
</Grid>
</Grid>
- <ListView ItemsSource="{Binding CatalogSingleton.Residents}" Margin="10,10,10,116" SelectedItem="{Binding NewResident, Mode=TwoWay}" >
+ <ListView
+ Margin="10,10,10,116"
+ ItemsSource="{Binding CatalogSingleton.Residents}"
+ SelectedItem="{Binding NewResident, Mode=TwoWay}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
- <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
- <Grid Background="LightGray" Height="150" Width="800" Margin="0,0,0,5">
+ <Grid
+ Width="800"
+ Height="150"
+ Margin="0,0,0,5"
+ Background="LightGray">
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="150"/>
+ <ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
- <Grid Grid.Column="0" Background="Gray" BorderThickness="0,0,2,0" BorderBrush="#CCFFFFFF" >
- <Image Stretch="Fill" Source="{Binding Picture}"/>
+ <Grid
+ Grid.Column="0"
+ Background="Gray"
+ BorderBrush="#CCFFFFFF"
+ BorderThickness="0,0,2,0">
+ <Image Source="{Binding Picture}" Stretch="Fill" />
</Grid>
<Grid Grid.Column="1" Margin="3,3,3,3">
@@ -87,28 +138,56 @@
<StackPanel Margin="10">
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Full Name :" Margin="0,0,10,0" FontSize="30" FontWeight="Bold" />
- <TextBlock Text="{Binding FirstName}" Margin="0,0,10,0" FontSize="30"/>
- <TextBlock Text="{Binding LastName}" Margin="0,0,10,0" FontSize="30"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Full Name :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ Text="{Binding FirstName}" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="30"
+ Text="{Binding LastName}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Email Address :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding Email}" Margin="0,0,10,0" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Email Address :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding Email}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Phone Number :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding Phone}" Margin="0,0,10,0" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Phone Number :" />
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ Text="{Binding Phone}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
- <TextBlock Text="Birth Date :" Margin="0,0,10,0" FontSize="20" FontWeight="Bold"/>
- <TextBlock Text="{Binding BirthDate.Year}" FontSize="20"/>
- <TextBlock Text="-" FontSize="20"/>
- <TextBlock Text="{Binding BirthDate.Month}" FontSize="20"/>
- <TextBlock Text="-" FontSize="20"/>
- <TextBlock Text="{Binding BirthDate.Day}" FontSize="20"/>
+ <TextBlock
+ Margin="0,0,10,0"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Birth Date :" />
+ <TextBlock FontSize="20" Text="{Binding BirthDate.Year}" />
+ <TextBlock FontSize="20" Text="-" />
+ <TextBlock FontSize="20" Text="{Binding BirthDate.Month}" />
+ <TextBlock FontSize="20" Text="-" />
+ <TextBlock FontSize="20" Text="{Binding BirthDate.Day}" />
</StackPanel>
</StackPanel>
@@ -122,25 +201,49 @@
<StackPanel Width="400" Margin="0,0,50,0">
- <TextBlock Margin="0,5,0,10" Text="Resident Info" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold"/>
- <Image Source="{Binding NewResident.Picture, Mode=TwoWay}" Height="150" Width="150" />
- <Button Content="Upload Picture" HorizontalAlignment="Stretch" Margin="0,10,0,0" Command="{Binding UploadResidentPhoto}" />
- <TextBlock Margin="0,10,0,10" Text="Name"/>
+ <TextBlock
+ Margin="0,5,0,10"
+ HorizontalAlignment="Center"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Resident Info" />
+ <Image
+ Width="150"
+ Height="150"
+ Source="{Binding NewResident.Picture, Mode=TwoWay}" />
+ <Button
+ Margin="0,10,0,0"
+ HorizontalAlignment="Stretch"
+ Command="{Binding UploadResidentPhoto}"
+ Content="Upload Picture" />
+ <TextBlock Margin="0,10,0,10" Text="Name" />
<TextBox Text="{Binding NewResident.FirstName, Mode=TwoWay}" />
- <TextBlock Margin="0,10,0,10" Text="Last Name"/>
+ <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"/>
+ <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"/>
+ <TextBlock Margin="0,10,0,10" Text="Phone Number" />
<TextBox Text="{Binding NewResident.Phone, Mode=TwoWay}" />
<StackPanel Orientation="Horizontal">
- <Button Margin="0,5,12,10" Content="Create" Width="125" Command="{Binding CreateResidentCommand}"/>
- <Button Margin="0,5,0,10" Content="Delete" Width="125" Command="{Binding DeleteResidentCommand}"/>
- <Button Margin="13,5,0,10" Content="Update" Width="125" Command="{Binding UpdateResidentCommand}"/>
+ <Button
+ Width="125"
+ Margin="0,5,12,10"
+ Command="{Binding CreateResidentCommand}"
+ Content="Create" />
+ <Button
+ Width="125"
+ Margin="0,5,0,10"
+ Command="{Binding DeleteResidentCommand}"
+ Content="Delete" />
+ <Button
+ Width="125"
+ Margin="13,5,0,10"
+ Command="{Binding UpdateResidentCommand}"
+ Content="Update" />
</StackPanel>
</StackPanel>
diff --git a/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml
index ffc28c2..5dcff9e 100644
--- a/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml
@@ -11,7 +11,7 @@
mc:Ignorable="d">
<Page.Resources>
- <Style x:Key="ApartmentsListItemStyle" TargetType="ListViewItem">
+ <Style x:Key="ListItemStyle" TargetType="ListViewItem">
<Setter Property="Background" Value="White" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="12,12,12,0" />
@@ -49,11 +49,11 @@
</CommandBar.Content>
<AppBarButton
Click="GoToCreateApartmentPage"
+ Command="{Binding ClearApartmentTemplateCommand}"
Icon="Add"
- Label="Create Apartment"
- Command="{Binding ClearApartmentTemplateCommand}">
+ Label="Create Apartment">
<AppBarButton.DataContext>
- <vm:BmViewModel/>
+ <vm:BmViewModel />
</AppBarButton.DataContext>
</AppBarButton>
</CommandBar>
@@ -84,7 +84,7 @@
ItemsSource="{Binding BmSingleton.Apartments}"
SelectedItem="{Binding ApartmentTemplate, Mode=TwoWay}">
<ListView.ItemContainerStyle>
- <Style BasedOn="{StaticResource ApartmentsListItemStyle}" TargetType="ListViewItem" />
+ <Style BasedOn="{StaticResource ListItemStyle}" TargetType="ListViewItem" />
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
@@ -105,7 +105,7 @@
</StackPanel>
<Button
Grid.Column="1"
- Click="SelectApartment"
+ Click="SelectItem"
Command="{Binding DeleteApartmentCommand}"
DataContext="{Binding ElementName=ApartmentsList, Path=DataContext}"
Style="{StaticResource ActionButtonStyle}">
@@ -114,7 +114,7 @@
<Button
Grid.Column="1"
Margin="0,40,0,0"
- Click="SelectApartment"
+ Click="SelectItem"
DataContext="{Binding ElementName=ApartmentsList, Path=DataContext}"
Style="{StaticResource ActionButtonStyle}">
<SymbolIcon Symbol="Edit" ToolTipService.ToolTip="Edit" />
diff --git a/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs
index d7adedb..d7d67e6 100644
--- a/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/BmApartmentsPage.xaml.cs
@@ -13,7 +13,7 @@ namespace ApartmentManager.View
InitializeComponent();
}
- private void SelectApartment(object sender, RoutedEventArgs e)
+ private void SelectItem(object sender, RoutedEventArgs e)
{
var item = ((Grid)((Button)sender).Parent).DataContext;
var container = (ListViewItem)ApartmentsList.ContainerFromItem(item);
diff --git a/ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml
index dd19315..785310e 100644
--- a/ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/BmCreateApartmentPage.xaml
@@ -18,7 +18,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="600" />
- <ColumnDefinition Width="300"/>
+ <ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<Button
Margin="0,20,20,0"
@@ -53,10 +53,15 @@
<TextBox Text="{Binding ApartmentTemplate.Floor, Mode=TwoWay}" />
<TextBlock Margin="0,10,0,10" Text="Address:" />
<TextBox Text="{Binding ApartmentTemplate.Address, Mode=TwoWay}" />
- <StackPanel Margin="0,20,0,0" Orientation="Horizontal" Width="150" HorizontalAlignment="Right">
+ <StackPanel
+ Width="150"
+ Margin="0,20,0,0"
+ HorizontalAlignment="Right"
+ Orientation="Horizontal">
<Button
Margin="0,0,20,0"
- Content="Go back" HorizontalAlignment="Right">
+ HorizontalAlignment="Right"
+ Content="Go back">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ApartmentManager.View.BmApartmentsPage" />
@@ -64,10 +69,11 @@
</interactivity:Interaction.Behaviors>
</Button>
<Button
+ HorizontalAlignment="Right"
Background="#FF274CCD"
Command="{Binding CreateApartmentCommand}"
Content="Add"
- Foreground="White" HorizontalAlignment="Right">
+ Foreground="White">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ApartmentManager.View.BmApartmentsPage" />
diff --git a/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml b/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml
new file mode 100644
index 0000000..8ac885b
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml
@@ -0,0 +1,97 @@
+<Page
+ x:Class="ApartmentManager.View.BmCreateDefectPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:core="using:Microsoft.Xaml.Interactions.Core"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
+ xmlns:local="using:ApartmentManager.View"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vm="using:ApartmentManager.ViewModel"
+ mc:Ignorable="d">
+
+ <Page.DataContext>
+ <vm:BmViewModel />
+ </Page.DataContext>
+
+ <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+ <TextBlock
+ Margin="0,10,0,10"
+ HorizontalAlignment="Center"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Defect Information" />
+ <StackPanel Orientation="Horizontal">
+ <StackPanel Margin="0,5,30,0">
+ <ListView
+ Width="500"
+ Height="534"
+ ItemsSource="{Binding DefectTemplate.Pictures, Mode=TwoWay}"
+ SelectedItem="{Binding SelectedDefectPicture, Mode=TwoWay}">
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <Image
+ Width="400"
+ Margin="10"
+ Source="{Binding Picture}" />
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ <StackPanel Margin="10" Orientation="Horizontal">
+ <Button
+ Margin="30,0,0,0"
+ Command="{Binding UploadDefectPictureCommand}"
+ Content="Upload Picture" />
+ <Button
+ Margin="170,0,0,0"
+ Command="{Binding DeleteDefectPictureCommand}"
+ Content="Delete Picture" />
+ </StackPanel>
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
+ </StackPanel>
+ <StackPanel Width="400" Margin="0,0,50,0">
+ <TextBlock Margin="0,10,0,10" Text="Name" />
+ <TextBox Text="{Binding DefectTemplate.Name, Mode=TwoWay}" />
+ <TextBlock Margin="0,10,0,10" Text="Apartment number" />
+ <TextBox Text="{Binding DefectTemplate.ApartmentId, Mode=TwoWay}" />
+ <TextBlock Margin="0,10,0,10" Text="Description" />
+ <TextBox
+ Height="345"
+ Text="{Binding DefectTemplate.Description, Mode=TwoWay}"
+ TextWrapping="Wrap" />
+ <StackPanel
+ Margin="0,20,0,0"
+ HorizontalAlignment="Right"
+ Orientation="Horizontal">
+ <Button
+ Margin="0,0,20,0"
+ HorizontalAlignment="Right"
+ Content="Go back">
+
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmDefectsPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ <Button
+ HorizontalAlignment="Right"
+ Background="#FF274CCD"
+ Command="{Binding CreateDefectCommand}"
+ Content="Add"
+ Foreground="White">
+
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmDefectsPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+</Page>
diff --git a/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml.cs
new file mode 100644
index 0000000..62fc8d2
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmCreateDefectPage.xaml.cs
@@ -0,0 +1,15 @@
+using Windows.UI.Xaml.Controls;
+
+namespace ApartmentManager.View
+{
+ /// <summary>
+ /// Page for creating new defect.
+ /// </summary>
+ public sealed partial class BmCreateDefectPage : Page
+ {
+ public BmCreateDefectPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml b/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml
index 5cc0506..5dabf95 100644
--- a/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml
@@ -2,15 +2,145 @@
x:Class="ApartmentManager.View.BmDefectsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:ApartmentManager.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:ApartmentManager.ViewModel"
mc:Ignorable="d">
+ <Page.Resources>
+ <Style x:Key="ListItemStyle" TargetType="ListViewItem">
+ <Setter Property="Background" Value="White" />
+ <Setter Property="Padding" Value="0" />
+ <Setter Property="Margin" Value="12,12,12,0" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="BorderBrush" Value="#DFE0E4" />
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ListViewItem">
+ <ListViewItemPresenter />
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <Style x:Key="TextBlockStyle" TargetType="TextBlock">
+ <Setter Property="Margin" Value="0,0,0,10" />
+ <Setter Property="Foreground" Value="White" />
+ </Style>
+ <Style x:Key="ActionButtonStyle" TargetType="Button">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="Height" Value="40" />
+ <Setter Property="Width" Value="40" />
+ <Setter Property="HorizontalAlignment" Value="Right" />
+ <Setter Property="VerticalAlignment" Value="Top" />
+ </Style>
+ </Page.Resources>
<Page.DataContext>
<vm:BmViewModel />
</Page.DataContext>
+ <Page.BottomAppBar>
+ <CommandBar>
+ <CommandBar.Content>
+ <Grid />
+ </CommandBar.Content>
+ <AppBarButton
+ Click="GoToCreateDefectPage"
+ Command="{Binding ClearDefectTemplateCommand}"
+ Icon="Add"
+ Label="Create Apartment">
+ <AppBarButton.DataContext>
+ <vm:BmViewModel />
+ </AppBarButton.DataContext>
+ </AppBarButton>
+ </CommandBar>
+ </Page.BottomAppBar>
+ <Grid Background="#E9EBEE">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="40" />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel Background="{StaticResource AppBarBackgroundThemeBrush}" Orientation="Horizontal">
+ <TextBlock
+ Margin="40,0,10,0"
+ VerticalAlignment="Center"
+ Text="Defect ID: " />
+ <TextBox Height="32" />
+ <TextBlock
+ Margin="10,0"
+ VerticalAlignment="Center"
+ Text="Apartment number: " />
+ <TextBox Height="32" />
+ </StackPanel>
+ <ListView
+ x:Name="DefectsList"
+ Grid.Row="1"
+ ItemsSource="{Binding BmSingleton.Defects}"
+ SelectedItem="{Binding DefectTemplate, Mode=TwoWay}">
+ <ListView.ItemContainerStyle>
+ <Style BasedOn="{StaticResource ListItemStyle}" TargetType="ListViewItem" />
+ </ListView.ItemContainerStyle>
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="150" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="50px" />
+ </Grid.ColumnDefinitions>
+ <Image
+ Margin="5"
+ Source="{Binding Pictures[0].Picture}"
+ Stretch="Fill" />
+ <StackPanel Grid.Column="1" Padding="10">
+ <TextBlock><Run Text="Defect ID: " /><Run Text="{Binding DefectId}" /></TextBlock>
+ <TextBlock><Run Text="Apartment number: " /><Run Text="{Binding ApartmentId}" /></TextBlock>
+ <TextBlock><Run Text="Name: " /><Run Text="{Binding Name}" /></TextBlock>
+ <TextBlock><Run Text="Status: " /><Run Text="{Binding Status}" /></TextBlock>
+ <TextBlock><Run Text="Upload date: " /><Run Text="{Binding UploadDate.Day}" /><Run Text="." /><Run Text="{Binding UploadDate.Month}" /><Run Text="." /><Run Text="{Binding UploadDate.Year}" /></TextBlock>
+ </StackPanel>
+ <Button
+ Grid.Column="2"
+ Click="SelectItem"
+ Command="{Binding DeleteDefectCommand}"
+ DataContext="{Binding ElementName=DefectsList, Path=DataContext}"
+ Style="{StaticResource ActionButtonStyle}">
+ <SymbolIcon Symbol="Clear" ToolTipService.ToolTip="Delete" />
+ </Button>
+ <Button
+ Grid.Column="2"
+ Margin="0,40,0,0"
+ Click="SelectItem"
+ DataContext="{Binding ElementName=DefectsList, Path=DataContext}"
+ Style="{StaticResource ActionButtonStyle}">
+ <SymbolIcon Symbol="Edit" ToolTipService.ToolTip="Edit" />
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmEditDefectPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ <Button
+ Grid.Column="2"
+ Margin="0,80,0,0"
+ Click="SelectItem"
+ DataContext="{Binding ElementName=DefectsList, Path=DataContext}"
+ Style="{StaticResource ActionButtonStyle}">
+ <SymbolIcon Symbol="View" ToolTipService.ToolTip="View" />
+
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmSingleDefectPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ </Grid>
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ </Grid>
</Page>
diff --git a/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml.cs
index 638cc3d..8b38af0 100644
--- a/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml.cs
+++ b/ApartmentManager/ApartmentManager/View/BmDefectsPage.xaml.cs
@@ -12,5 +12,18 @@ namespace ApartmentManager.View
{
InitializeComponent();
}
+
+ private void SelectItem(object sender, RoutedEventArgs e)
+ {
+ var item = ((Grid)((Button)sender).Parent).DataContext;
+ var container = (ListViewItem)DefectsList.ContainerFromItem(item);
+
+ container.IsSelected = true;
+ }
+
+ private void GoToCreateDefectPage(object sender, RoutedEventArgs e)
+ {
+ Frame.Navigate(typeof(BmCreateDefectPage));
+ }
}
}
diff --git a/ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml b/ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml
index d52cdaa..e69ea48 100644
--- a/ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/BmEditApartmentPage.xaml
@@ -60,8 +60,8 @@
<Button
Margin="0,0,20,0"
HorizontalAlignment="Right"
- Content="Go back"
- Command="{Binding GetApartmentsCommand}">
+ Command="{Binding GetApartmentsCommand}"
+ Content="Go back">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ApartmentManager.View.BmApartmentsPage" />
diff --git a/ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml b/ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml
new file mode 100644
index 0000000..840f59d
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml
@@ -0,0 +1,108 @@
+<Page
+ x:Class="ApartmentManager.View.BmEditDefectPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:core="using:Microsoft.Xaml.Interactions.Core"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
+ xmlns:local="using:ApartmentManager.View"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vm="using:ApartmentManager.ViewModel"
+ mc:Ignorable="d">
+
+ <Page.DataContext>
+ <vm:BmViewModel />
+ </Page.DataContext>
+
+ <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+ <TextBlock
+ Margin="0,10,0,10"
+ HorizontalAlignment="Center"
+ FontSize="20"
+ FontWeight="Bold"
+ Text="Defect Information" />
+ <StackPanel Orientation="Horizontal">
+ <StackPanel Margin="0,5,30,0">
+ <ListView
+ Width="500"
+ Height="534"
+ ItemsSource="{Binding DefectTemplate.Pictures, Mode=TwoWay}"
+ SelectedItem="{Binding SelectedDefectPicture, Mode=TwoWay}">
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <Image
+ Width="400"
+ Margin="10"
+ Source="{Binding Picture}" />
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ <StackPanel Margin="10" Orientation="Horizontal">
+ <Button
+ Margin="30,0,0,0"
+ Command="{Binding UploadDefectPictureCommand}"
+ Content="Upload Picture" />
+ <Button
+ Margin="170,0,0,0"
+ Command="{Binding DeleteDefectPictureTempCommand}"
+ Content="Delete Picture" />
+ </StackPanel>
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
+ <StackPanel Margin="0,30,0,0" Orientation="Horizontal" />
+ </StackPanel>
+ <StackPanel Width="400" Margin="0,0,50,0">
+ <TextBlock Margin="0,10,0,10" Text="Name" />
+ <TextBox Text="{Binding DefectTemplate.Name, Mode=TwoWay}" />
+ <StackPanel Margin="0,10,0,10" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ VerticalAlignment="Center"
+ Text="Apartment number" />
+ <TextBox Text="{Binding DefectTemplate.ApartmentId, Mode=TwoWay}" />
+ <TextBlock
+ Margin="20,0,10,0"
+ VerticalAlignment="Center"
+ Text="Status" />
+ <TextBox Width="128" Text="{Binding DefectTemplate.Status, Mode=TwoWay}" />
+ </StackPanel>
+ <TextBlock Margin="0,0,0,10" Text="Description" />
+ <TextBox
+ Height="375"
+ Text="{Binding DefectTemplate.Description, Mode=TwoWay}"
+ TextWrapping="Wrap" />
+ <StackPanel
+ Margin="0,20,0,0"
+ HorizontalAlignment="Right"
+ Orientation="Horizontal">
+ <Button
+ Margin="0,0,20,0"
+ HorizontalAlignment="Right"
+ Command="{Binding GetDefectsCommand}"
+ Content="Go back">
+
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmDefectsPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ <Button
+ HorizontalAlignment="Right"
+ Background="#FF274CCD"
+ Command="{Binding UpdateDefectCommand}"
+ Content="Update"
+ Foreground="White">
+
+ <interactivity:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="Click">
+ <core:NavigateToPageAction TargetPage="ApartmentManager.View.BmDefectsPage" />
+ </core:EventTriggerBehavior>
+ </interactivity:Interaction.Behaviors>
+ </Button>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+</Page>
diff --git a/ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmEditDefectPage.xaml.cs
new file mode 100644
index 0000000..edba09e
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmEditDefectPage.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
+{
+ /// <summary>
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ /// </summary>
+ public sealed partial class BmEditDefectPage : Page
+ {
+ public BmEditDefectPage()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml b/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml
new file mode 100644
index 0000000..28976bd
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml
@@ -0,0 +1,135 @@
+<Page
+ x:Class="ApartmentManager.View.BmSingleDefectPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:ApartmentManager.View"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vm="using:ApartmentManager.ViewModel"
+ mc:Ignorable="d">
+
+ <Page.DataContext>
+ <vm:BmViewModel />
+ </Page.DataContext>
+
+ <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <ScrollViewer>
+ <StackPanel>
+ <StackPanel Margin="10,10,10,0" Orientation="Horizontal">
+ <TextBlock
+ Margin="100,0,0,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Name :" />
+ <TextBlock
+ Margin="10,0,0,0"
+ FontSize="30"
+ Text="{Binding DefectTemplate.Name}" />
+ <TextBlock
+ Margin="700,0,0,0"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Status :" />
+ <TextBlock
+ Margin="10,0,0,0"
+ FontSize="30"
+ Text="{Binding DefectTemplate.Status}" />
+ </StackPanel>
+ <StackPanel Margin="20,0,20,20" Orientation="Horizontal">
+ <StackPanel Width="620" Margin="0,50,0,0">
+ <GridView
+ Width="500"
+ Height="420"
+ ItemsSource="{Binding DefectTemplate.Pictures, Mode=TwoWay}">
+ <GridView.ItemTemplate>
+ <DataTemplate>
+ <Image
+ Width="220"
+ Margin="10,0,10,10"
+ Source="{Binding Picture}" />
+ </DataTemplate>
+ </GridView.ItemTemplate>
+
+ </GridView>
+ </StackPanel>
+ <StackPanel Width="620">
+ <TextBlock
+ Margin="10,0,0,10"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Description" />
+ <Grid BorderBrush="Black" BorderThickness="1">
+ <TextBlock
+ Height="400"
+ Margin="10"
+ Text="{Binding DefectTemplate.Description, Mode=TwoWay}"
+ TextWrapping="WrapWholeWords" />
+ </Grid>
+
+
+ </StackPanel>
+
+
+ </StackPanel>
+ <StackPanel Width="600" Margin="0,20,0,0">
+ <TextBlock
+ Margin="10,0,0,10"
+ FontSize="30"
+ FontWeight="Bold"
+ Text="Comments" />
+ <StackPanel Orientation="Horizontal">
+
+ <TextBox
+ Width="500"
+ Height="80"
+ Text="{Binding NewDefectComment.Comment, Mode=TwoWay}"
+ TextWrapping="Wrap" />
+ <Button
+ Margin="10,0,0,0"
+ Command="{Binding CreateDefectCommentCommand}"
+ Content="Comment" />
+ </StackPanel>
+
+
+ <ListView ItemsSource="{Binding DefectTemplate.Comments}">
+ <ListView.ItemContainerStyle>
+ <Style TargetType="ListViewItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
+ </Style>
+ </ListView.ItemContainerStyle>
+
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <Grid Margin="10">
+ <StackPanel>
+ <TextBlock
+ Margin="5,0,0,0"
+ FontWeight="Bold"
+ Text="{Binding Name}" />
+ <TextBlock
+ Margin="5"
+ Text="{Binding Comment}"
+ TextWrapping="WrapWholeWords" />
+ <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
+ <TextBlock Margin="0,0,0,5">
+ <Run FontWeight="Bold" Text="{Binding Date.Year}" />
+ <Run FontWeight="Bold" Text="-" />
+ <Run FontWeight="Bold" Text="{Binding Date.Month}" />
+ <Run FontWeight="Bold" Text="-" />
+ <Run FontWeight="Bold" Text="{Binding Date.Day}" />
+ <Run FontWeight="Bold" Text=" " />
+ <Run FontWeight="Bold" Text="{Binding Date.Hour}" />
+ <Run FontWeight="Bold" Text=":" />
+ <Run FontWeight="Bold" Text="{Binding Date.Minute}" />
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+ </StackPanel>
+ </StackPanel>
+ </ScrollViewer>
+ </Grid>
+</Page>
diff --git a/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml.cs b/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.xaml.cs
new file mode 100644
index 0000000..340e86a
--- /dev/null
+++ b/ApartmentManager/ApartmentManager/View/BmSingleDefectPage.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
+{
+ /// <summary>
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ /// </summary>
+ public sealed partial class BmSingleDefectPage : Page
+ {
+ public BmSingleDefectPage()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/ApartmentManager/ApartmentManager/View/BmUsersPage.xaml b/ApartmentManager/ApartmentManager/View/BmUsersPage.xaml
index 06b5ee7..a57d14d 100644
--- a/ApartmentManager/ApartmentManager/View/BmUsersPage.xaml
+++ b/ApartmentManager/ApartmentManager/View/BmUsersPage.xaml
@@ -113,8 +113,8 @@
</ListView>
<Grid Grid.RowSpan="2" Grid.Column="1">
<Grid.RowDefinitions>
- <RowDefinition/>
- <RowDefinition Height="60"/>
+ <RowDefinition />
+ <RowDefinition Height="60" />
</Grid.RowDefinitions>
<ScrollViewer>
<StackPanel Width="400" HorizontalAlignment="Center">
@@ -150,7 +150,11 @@
<DatePicker HorizontalAlignment="Stretch" Date="{Binding UserTemplate.MoveInDate, Mode=TwoWay}" />
</StackPanel>
</ScrollViewer>
- <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
+ <StackPanel
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
<Button
Width="125"
Margin="0"
diff --git a/ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs
index 7a324a8..736ca7c 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/BmViewModel.cs
@@ -6,6 +6,7 @@ using ApartmentManager.Common;
using ApartmentManager.Model;
using ApartmentManager.Singletons;
using ApartmentManager.Handler;
+using System.Collections.Generic;
namespace ApartmentManager.ViewModel
{
@@ -16,7 +17,7 @@ namespace ApartmentManager.ViewModel
public int[] FloorNumbers { get; } = new int[] { 0, 1, 2, 3, 4 };
public int SelectedFloor { get; set; }
-
+
public ICommand CreateApartmentCommand { get; }
public ICommand DeleteApartmentCommand { get; }
public ICommand UpdateApartmentCommand { get; }
@@ -36,9 +37,25 @@ namespace ApartmentManager.ViewModel
public ICommand UploadResidentPhotoCommand { get; }
public ICommand ClearResidentTemplateCommand { get; }
+ public ICommand CreateDefectCommand { get; }
+ public ICommand DeleteDefectCommand { get; }
+ public ICommand UpdateDefectCommand { get; }
+ public ICommand ClearDefectTemplateCommand { get; }
+ public ICommand GetDefectsCommand { get; }
+ public ICommand UploadDefectPictureCommand { get; }
+ public ICommand UploadDefectPictureTempCommand { get; }
+ public ICommand DeleteDefectPictureCommand { get; }
+ public ICommand DeleteDefectPictureTempCommand { get; }
+ public ICommand CreateDefectCommentCommand { get; }
+
private static Apartment _apartmentTemplate = new Apartment();
private static User _userTemplate = new User();
private static Resident _residentTemplate = new Resident();
+ private static Defect _defectTemplate = new Defect();
+ private static DefectPicture _selectedDefectPicture = new DefectPicture();
+ private static List<DefectPicture> _deletedDefectPictures = new List<DefectPicture>();
+ private static List<DefectPicture> _addedDefectPictures = new List<DefectPicture>();
+ private static DefectComment _newDefectComment = new DefectComment();
public BmViewModel()
{
@@ -62,6 +79,16 @@ namespace ApartmentManager.ViewModel
UpdateResidentCommand = new RelayCommand(BmHandler.UpdateResident);
UploadResidentPhotoCommand = new RelayCommand(BmHandler.UploadResidentPhoto);
ClearResidentTemplateCommand = new RelayCommand(BmHandler.ClearResidentTemplate);
+
+ CreateDefectCommand = new RelayCommand(BmHandler.CreateDefect);
+ DeleteDefectCommand = new RelayCommand(BmHandler.DeleteDefect);
+ UpdateDefectCommand = new RelayCommand(BmHandler.UpdateDefect);
+ ClearDefectTemplateCommand = new RelayCommand(BmHandler.ClearDefectTemplate);
+ UploadDefectPictureCommand = new RelayCommand(BmHandler.UploadDefectPicture);
+ DeleteDefectPictureCommand = new RelayCommand(BmHandler.DeleteDefectPicture);
+ DeleteDefectPictureTempCommand = new RelayCommand(BmHandler.DeleteDefectPictureTemp);
+ GetDefectsCommand = new RelayCommand(BmHandler.GetDefects);
+ CreateDefectCommentCommand = new RelayCommand(BmHandler.CreateDefectComment);
}
public Apartment ApartmentTemplate
@@ -94,6 +121,54 @@ namespace ApartmentManager.ViewModel
}
}
+ public Defect DefectTemplate
+ {
+ get => _defectTemplate;
+ set
+ {
+ _defectTemplate = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public DefectPicture SelectedDefectPicture
+ {
+ get => _selectedDefectPicture;
+ set
+ {
+ _selectedDefectPicture = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public List<DefectPicture> DeletedDefectPictures
+ {
+ get => _deletedDefectPictures;
+ set
+ {
+ _deletedDefectPictures = value;
+ }
+ }
+
+ public List<DefectPicture> AddedDefectPictures
+ {
+ get => _addedDefectPictures;
+ set
+ {
+ _addedDefectPictures = value;
+ }
+ }
+
+ public DefectComment NewDefectComment
+ {
+ get => _newDefectComment;
+ set
+ {
+ _newDefectComment = value;
+ OnPropertyChanged();
+ }
+ }
+
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
diff --git a/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs b/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs
index 2c42471..f149bfe 100644
--- a/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs
+++ b/ApartmentManager/HousingWebApi/Controllers/DefectPicturesController.cs
@@ -16,15 +16,21 @@ namespace HousingWebApi.Controllers
{
private DataModel db = new DataModel();
- [Route("api/DefectPictures/{id}")]
- public IQueryable<DefectPicture> GetResidents(int id)
+ //GET: api/DefectPicturesById
+ [Route("api/DefectPicturesById/{id}")]
+ public IQueryable<DefectPicture> GetDefectPicturesById(int id)
{
- var pictureslist = from defectPicture in db.DefectPictures
- where (defectPicture.DefectId == id)
- select defectPicture;
- return pictureslist;
+ var picturesList = from defectPicture in db.DefectPictures
+ where (defectPicture.DefectId == id)
+ select defectPicture;
+ return picturesList;
+ }
+
+ // GET: api/DefectPictures
+ public IQueryable<DefectPicture> GetDefectPictures()
+ {
+ return db.DefectPictures;
}
-
// GET: api/DefectPictures/5
[ResponseType(typeof(DefectPicture))]
@@ -84,22 +90,7 @@ namespace HousingWebApi.Controllers
}
db.DefectPictures.Add(defectPicture);
-
- try
- {
- db.SaveChanges();
- }
- catch (DbUpdateException)
- {
- if (DefectPictureExists(defectPicture.PictureId))
- {
- return Conflict();
- }
- else
- {
- throw;
- }
- }
+ db.SaveChanges();
return CreatedAtRoute("DefaultApi", new { id = defectPicture.PictureId }, defectPicture);
}
diff --git a/ApartmentManager/HousingWebApi/HousingWebApi.csproj b/ApartmentManager/HousingWebApi/HousingWebApi.csproj
index b009a06..407d4b0 100644
--- a/ApartmentManager/HousingWebApi/HousingWebApi.csproj
+++ b/ApartmentManager/HousingWebApi/HousingWebApi.csproj
@@ -151,6 +151,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Controllers\DefectPicturesController.cs" />
<Compile Include="Models\Apartment.cs" />
<Compile Include="Models\ApartmentChange.cs" />
<Compile Include="Models\ApartmentResident.cs" />
@@ -193,7 +194,6 @@
<Compile Include="Controllers\ChangeCommentsController.cs" />
<Compile Include="Controllers\ChangeDocumentsController.cs" />
<Compile Include="Controllers\DefectCommentsController.cs" />
- <Compile Include="Controllers\DefectPicturesController.cs" />
<Compile Include="Controllers\DefectsController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\PastUsersController.cs" />