diff options
author | marcinzelent <marcin@zelent.net> | 2017-05-30 11:02:47 +0200 |
---|---|---|
committer | marcinzelent <marcin@zelent.net> | 2017-05-30 11:02:47 +0200 |
commit | 857e96ebad497029f74f323c9a89a9ad94a1e999 (patch) | |
tree | 5cb37eaed5f1c7111898c6c55dbe2dcd64ef584c | |
parent | 29ec4ef677826920fd36e20899d9bcbd18bddca6 (diff) | |
parent | 6432c8e2f0a39c622800d6916b2854cd1c66ee03 (diff) |
Merge.
-rw-r--r-- | ApartmentManager/ApartmentManager/ApartmentManager.csproj | 5 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person1.jpg | bin | 448838 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person2.jpg | bin | 48173 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person3.jpg | bin | 4614 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/plan.jpg | bin | 69301 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs | 8 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs | 27 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs | 30 |
8 files changed, 28 insertions, 42 deletions
diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index 560357a..0f22d96 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -181,10 +181,6 @@ <ItemGroup> <Content Include="Assets\BrokenDownpipe.jpg" /> <Content Include="Assets\Ostbanehus.jpg" /> - <Content Include="Assets\Person1.jpg" /> - <Content Include="Assets\Person2.jpg" /> - <Content Include="Assets\Person3.jpg" /> - <Content Include="Assets\plan.jpg" /> <Content Include="Properties\Default.rd.xml" /> <Content Include="Assets\LockScreenLogo.scale-200.png" /> <Content Include="Assets\SplashScreen.scale-200.png" /> @@ -303,6 +299,7 @@ <SubType>Designer</SubType> </AppxManifest> </ItemGroup> + <ItemGroup /> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> <VisualStudioVersion>14.0</VisualStudioVersion> </PropertyGroup> diff --git a/ApartmentManager/ApartmentManager/Assets/Person1.jpg b/ApartmentManager/ApartmentManager/Assets/Person1.jpg Binary files differdeleted file mode 100644 index edf9716..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person1.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/Person2.jpg b/ApartmentManager/ApartmentManager/Assets/Person2.jpg Binary files differdeleted file mode 100644 index 4e67876..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person2.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/Person3.jpg b/ApartmentManager/ApartmentManager/Assets/Person3.jpg Binary files differdeleted file mode 100644 index b9ed3a7..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person3.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/plan.jpg b/ApartmentManager/ApartmentManager/Assets/plan.jpg Binary files differdeleted file mode 100644 index 54df873..0000000 --- a/ApartmentManager/ApartmentManager/Assets/plan.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs index ac5999e..34cbb7c 100644 --- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs +++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs @@ -45,7 +45,6 @@ namespace ApartmentManager.Handler new MessageDialog(e.Message).ShowAsync(); } } - /// <summary> /// RESIDENT HANDLERS /// </summary> @@ -72,7 +71,6 @@ namespace ApartmentManager.Handler { try { - Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; if (string.IsNullOrEmpty(resident.Picture)) @@ -97,7 +95,6 @@ namespace ApartmentManager.Handler { Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - ApiClient.DeleteData("api/residents/" + resident.ResidentId); GetApartmentResidents(); } @@ -113,7 +110,6 @@ namespace ApartmentManager.Handler { Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - ApiClient.PutData("api/residents/" + resident.ResidentId, resident); GetApartmentResidents(); } @@ -172,10 +168,8 @@ namespace ApartmentManager.Handler { Defect Defect = new Defect(); Defect.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - var defectsFromDatabase = ApiClient.GetData("api/ApartmentDefects/" + Defect.ApartmentId); var defecttlist = JsonConvert.DeserializeObject<ObservableCollection<Defect>>(defectsFromDatabase); - foreach (var defect in defecttlist) { var picturesFromDatabase = ApiClient.GetData("api/DefectPicturesById/" + defect.DefectId); @@ -221,11 +215,9 @@ namespace ApartmentManager.Handler defect.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; defect.Status = "New"; defect.UploadDate = DateTime.Now; - var response = ApiClient.PostData("api/defects/", defect); var defectResponse = JsonConvert.DeserializeObject<Defect>(response); defect.DefectId = defectResponse.DefectId; - foreach (var picture in ApartmentViewModel.CatalogSingleton.DefectPictures) { picture.DefectId = defect.DefectId; diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs index 66e081e..689f08d 100644 --- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs +++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs @@ -9,27 +9,26 @@ namespace ApartmentManager.Singletons { public class CatalogSingleton { - private static CatalogSingleton instance = new CatalogSingleton(); - - public static CatalogSingleton Instance => instance; - - + ////////// Singleton ////////// + private static CatalogSingleton _instance; + public static CatalogSingleton Instance => _instance ?? (_instance = new CatalogSingleton()); + ////////// For Apartment ////////// public Apartment Apartment { get; set; } + ////////// For Residents ////////// public ObservableCollection<Resident> Residents { get; set; } + ////////// For Defects ////////// public ObservableCollection<Defect> Defects { get; set; } - public ObservableCollection<DefectPicture> DefectPictures { get; set; } - public int DefectId { get; set; } - - public ObservableCollection<DefectComment> DefectComments { get; set; } + public ObservableCollection<DefectPicture> DefectPictures { get; set; } + public ObservableCollection<DefectComments> DefectComments { get; set; } public Defect Defect { get; set; } + public int DefectId { get; set; } + ////////// Constructor ////////// private CatalogSingleton() { - DefectComments = new ObservableCollection<DefectComment>(); + DefectComments = new ObservableCollection<DefectComments>(); Residents = new ObservableCollection<Resident>(); Defects = new ObservableCollection<Defect>(); - DefectPictures = new ObservableCollection<DefectPicture>(); - - } - + DefectPictures = new ObservableCollection<DefectPicture>(); + } } } diff --git a/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs index e5e69aa..b84602d 100644 --- a/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs +++ b/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs @@ -17,20 +17,17 @@ namespace ApartmentManager.ViewModel { public class ApartmentViewModel : INotifyPropertyChanged { + ////////// Handler ////////// public ApartmentHandler ApartmentHandler { get; set; } + ////////// Singletons ////////// public CatalogSingleton CatalogSingleton { get; set; } public UserSingleton UserSingleton { get; set; } - - + ////////// Store Data From Interface////////// private User _newUser; private Resident _newResident; - private Defect _newDefect = new Defect(); + private Defect _newDefect; private DefectPicture _selectedDefectPicture; - private DefectComment _newDefectComment; - - - - public static int ServerResponse { get; set; } + private DefectComments _newDefectComment; ////////// Resident relay commands////////// public ICommand CreateResidentCommand { get; set; } public ICommand DeleteResidentCommand { get; set; } @@ -45,19 +42,20 @@ namespace ApartmentManager.ViewModel public ICommand CreateDefect { get; set; } public ICommand DefectInfo { get; set; } public ICommand CreateDefectComment { get; set; } + ////////// Constructor ////////// public ApartmentViewModel() { + ////////// Store Data From Interface instance ////////// NewUser = new User(); NewResident = new Resident(); - //NewDefect = new Defect(); - NewDefectComment = new DefectComment(); - + NewDefect = new Defect(); + NewDefectComment = new DefectComments(); SelectedDefectPicture = new DefectPicture(); + ////////// Handler ////////// ApartmentHandler = new ApartmentHandler(this); ////////// Singletons ////////// CatalogSingleton = CatalogSingleton.Instance; - UserSingleton = UserSingleton.Instance; - + UserSingleton = UserSingleton.Instance; ////////// User relay commands////////// UpdateUser = new RelayCommand(ApartmentHandler.UpdateUser); UploadUserPhoto = new RelayCommand(ApartmentHandler.UploadUserPhoto); @@ -73,8 +71,8 @@ namespace ApartmentManager.ViewModel DefectInfo = new RelayCommand(ApartmentHandler.GetDefectInfo); CreateDefectComment = new RelayCommand(ApartmentHandler.CreateDefectComment); } - - public DefectComment NewDefectComment + ////////// Store Data From Interface////////// + public DefectComments NewDefectComment { get => _newDefectComment; set @@ -119,8 +117,8 @@ namespace ApartmentManager.ViewModel OnPropertyChanged(); } } + ////////// INotifyPropertyChanged ////////// public event PropertyChangedEventHandler PropertyChanged; - [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { |