aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <marcin@zelent.net>2017-05-18 07:32:35 +0200
committermarcinzelent <marcin@zelent.net>2017-05-18 07:32:35 +0200
commit6ead7593173d459db1354b000c4af521c19579a0 (patch)
treea74db9fea35dfd41e07d0d1fe67e244f1825b9c0
parentcb5917247c407e207e649641d829c5b5563a84c1 (diff)
Fixed some errors which were result of database changes.
-rw-r--r--ApartmentManager/ApartmentManager/AppShell.xaml.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs26
-rw-r--r--ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs18
-rw-r--r--ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs24
-rw-r--r--ApartmentManager/ApartmentManager/Handler/LoginHandler.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Model/Apartment.cs41
-rw-r--r--ApartmentManager/ApartmentManager/Model/Defect.cs37
-rw-r--r--ApartmentManager/ApartmentManager/Model/Resident.cs29
-rw-r--r--ApartmentManager/ApartmentManager/Model/User.cs22
-rw-r--r--ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs2
-rw-r--r--ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs11
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs2
-rw-r--r--ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs2
13 files changed, 89 insertions, 129 deletions
diff --git a/ApartmentManager/ApartmentManager/AppShell.xaml.cs b/ApartmentManager/ApartmentManager/AppShell.xaml.cs
index 746f61e..dec5cf7 100644
--- a/ApartmentManager/ApartmentManager/AppShell.xaml.cs
+++ b/ApartmentManager/ApartmentManager/AppShell.xaml.cs
@@ -102,7 +102,7 @@ namespace ApartmentManager
{
InitializeComponent();
- if (UserSingleton.Instance.CurrentUser.Type == "B") navMenuItems = boardMemberMenuItems;
+ if (UserSingleton.Instance.CurrentUser.IsBm) navMenuItems = boardMemberMenuItems;
else navMenuItems = normalUserMenuItems;
List<NavMenuItem> topNavMenuItems = navMenuItems.GetRange(0, navMenuItems.Count);
diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
index f3cc8b3..ded9732 100644
--- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs
@@ -23,9 +23,9 @@ namespace ApartmentManager.Handler
public void GetApartmentResidents()
{
Resident resident = new Resident();
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -49,7 +49,7 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -59,7 +59,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/residents/", resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -80,8 +80,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = ApartmentViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ResidentId = ApartmentViewModel.NewResident.ResidentId;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -89,9 +89,9 @@ namespace ApartmentManager.Handler
resident.Picture = ApartmentViewModel.NewResident.Picture;
resident.Phone = ApartmentViewModel.NewResident.Phone;
- ApiClient.DeleteData("api/residents/" + resident.ResidentNr);
+ ApiClient.DeleteData("api/residents/" + resident.ResidentId);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -111,8 +111,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = ApartmentViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = ApartmentViewModel.ApartmentNumber;
+ resident.ResidentId = ApartmentViewModel.NewResident.ResidentId;
+ resident.ApartmentId = ApartmentViewModel.ApartmentNumber;
resident.FirstName = ApartmentViewModel.NewResident.FirstName;
resident.LastName = ApartmentViewModel.NewResident.LastName;
resident.BirthDate = ApartmentViewModel.NewResident.BirthDate;
@@ -120,8 +120,8 @@ namespace ApartmentManager.Handler
resident.Picture = ApartmentViewModel.NewResident.Picture;
resident.Phone = ApartmentViewModel.NewResident.Phone;
- ApiClient.PutData("api/residents/" + resident.ResidentNr, resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ ApiClient.PutData("api/residents/" + resident.ResidentId, resident);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
ApartmentViewModel.CatalogSingleton.Residents.Clear();
@@ -141,7 +141,7 @@ namespace ApartmentManager.Handler
{
try
{
- ApartmentViewModel.NewResident.Picture = await ImgurPhotoUploader.UploadPhotoAsync();
+ //ApartmentViewModel.NewResident.Picture = await ImgurPhotoUploader.UploadPhotoAsync();
var tmp = ApartmentViewModel.NewResident;
ApartmentViewModel.NewResident = new Resident();
ApartmentViewModel.NewResident = tmp;
diff --git a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
index db6223d..c642b02 100644
--- a/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/BoardMemberHandler.cs
@@ -25,7 +25,7 @@ namespace ApartmentManager.Handler
public void GetApartments()
{
Apartment apartment= new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/");
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
@@ -43,7 +43,7 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
@@ -52,7 +52,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/Apartments/", apartment);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentlist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
@@ -72,15 +72,15 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms;
apartment.Size = BoardMemberViewModel.NewApartment.Size;
- ApiClient.PutData("api/Apartments/" + apartment.ApartmentNumber, apartment);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ ApiClient.PutData("api/Apartments/" + apartment.ApartmentId, apartment);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
@@ -100,16 +100,16 @@ namespace ApartmentManager.Handler
try
{
Apartment apartment = new Apartment();
- apartment.ApartmentNumber = BoardMemberViewModel.ApartmentsNumber;
+ apartment.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
apartment.Address = BoardMemberViewModel.NewApartment.Address;
apartment.Floor = BoardMemberViewModel.NewApartment.Floor;
apartment.MonthlyCharge = BoardMemberViewModel.NewApartment.MonthlyCharge;
apartment.NumberOfRooms = BoardMemberViewModel.NewApartment.NumberOfRooms;
apartment.Size = BoardMemberViewModel.NewApartment.Size;
- ApiClient.DeleteData("api/Apartments/" + apartment.ApartmentNumber);
+ ApiClient.DeleteData("api/Apartments/" + apartment.ApartmentId);
- var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentNumber);
+ var apartmentsFromDatabase = ApiClient.GetData("api/Apartments/" + apartment.ApartmentId);
IEnumerable<Apartment> apartmentslist = JsonConvert.DeserializeObject<IEnumerable<Apartment>>(apartmentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Apartment.Clear();
diff --git a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs b/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
index b012ce1..3f6086e 100644
--- a/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/BoardResidentsHandler.cs
@@ -22,9 +22,9 @@ namespace ApartmentManager.Handler
public void GetApartmentsResidents()
{
Resident resident = new Resident();
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -41,7 +41,7 @@ namespace ApartmentManager.Handler
{
Resident resident = new Resident();
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -51,7 +51,7 @@ namespace ApartmentManager.Handler
ApiClient.PostData("api/residents/", resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -72,8 +72,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = BoardMemberViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -81,9 +81,9 @@ namespace ApartmentManager.Handler
resident.Picture = BoardMemberViewModel.NewResident.Picture;
resident.Phone = BoardMemberViewModel.NewResident.Phone;
- ApiClient.DeleteData("api/residents/" + resident.ResidentNr);
+ ApiClient.DeleteData("api/residents/" + resident.ResidentId);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
@@ -103,8 +103,8 @@ namespace ApartmentManager.Handler
try
{
Resident resident = new Resident();
- resident.ResidentNr = BoardMemberViewModel.NewResident.ResidentNr;
- resident.ApartmentNr = BoardMemberViewModel.ApartmentsNumber;
+ resident.ResidentId = BoardMemberViewModel.NewResident.ResidentId;
+ resident.ApartmentId = BoardMemberViewModel.ApartmentsNumber;
resident.FirstName = BoardMemberViewModel.NewResident.FirstName;
resident.LastName = BoardMemberViewModel.NewResident.LastName;
resident.BirthDate = BoardMemberViewModel.NewResident.BirthDate;
@@ -112,8 +112,8 @@ namespace ApartmentManager.Handler
resident.Picture = BoardMemberViewModel.NewResident.Picture;
resident.Phone = BoardMemberViewModel.NewResident.Phone;
- ApiClient.PutData("api/residents/" + resident.ResidentNr, resident);
- var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentNr);
+ ApiClient.PutData("api/residents/" + resident.ResidentId, resident);
+ var residentsFromDatabase = ApiClient.GetData("api/ApartmentResidents/" + resident.ApartmentId);
IEnumerable<Resident> residentlist = JsonConvert.DeserializeObject<IEnumerable<Resident>>(residentsFromDatabase);
BoardMemberViewModel.BoardMemberCatalogSingleton.Residents.Clear();
diff --git a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
index 4cf5fed..e952e0b 100644
--- a/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
+++ b/ApartmentManager/ApartmentManager/Handler/LoginHandler.cs
@@ -9,7 +9,7 @@ namespace ApartmentManager.Handler
{
public static void LogIn(string username, string password)
{
- string serializedUser = ApiClient.GetData($"api/Users/by-username/{username}");
+ string serializedUser = ApiClient.GetData($"api/Users/{username}");
if (serializedUser != null)
{
User user = JsonConvert.DeserializeObject<User>(serializedUser);
diff --git a/ApartmentManager/ApartmentManager/Model/Apartment.cs b/ApartmentManager/ApartmentManager/Model/Apartment.cs
index 92f1501..06b427d 100644
--- a/ApartmentManager/ApartmentManager/Model/Apartment.cs
+++ b/ApartmentManager/ApartmentManager/Model/Apartment.cs
@@ -1,33 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ApartmentManager.Model
+namespace ApartmentManager.Model
{
public class Apartment
{
- public int ApartmentNumber { get; set; }
- public string Size { get; set; }
- public int NumberOfRooms { get; set; }
- public string MonthlyCharge { get; set; }
- public int Floor { get; set; }
+ public int ApartmentId { get; set; }
+ public double? Size { get; set; }
+ public int? NumberOfRooms { get; set; }
+ public double? MonthlyCharge { get; set; }
+ public int? Floor { get; set; }
public string Address { get; set; }
- public string PlanPicture { get; set; }
+ public byte[] PlanPicture { get; set; }
public Apartment() { }
- public Apartment(int ApartmentNumber, string Size,int NumberOfRooms,string MonthlyCharge,int Floor, string Address)
+ public Apartment(int apartmentId, double? size, int? numberOfRooms, double? monthlyCharge, int? floor, string address)
{
- this.ApartmentNumber = ApartmentNumber;
- this.Size = Size;
- this.NumberOfRooms = NumberOfRooms;
- this.MonthlyCharge = MonthlyCharge;
- this.Floor = Floor;
- this.Address = Address;
-
-
+ ApartmentId = apartmentId;
+ Size = size;
+ NumberOfRooms = numberOfRooms;
+ MonthlyCharge = monthlyCharge;
+ Floor = floor;
+ Address = address;
}
//public override string ToString()
@@ -39,10 +31,7 @@ namespace ApartmentManager.Model
public override string ToString()
{
- return string.Format(
- $"Apartment No: {ApartmentNumber} Size: {Size} NoOfRooms: {NumberOfRooms}" +
- $" MonthlyCharge: {MonthlyCharge} Floor: {Floor} Address {Address}"
- );
+ return string.Format($"Apartment number: {ApartmentId}, Size: {Size} Number of rooms: {NumberOfRooms}, Monthly charge: {MonthlyCharge}, Floor: {Floor}, Address: {Address}");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/Defect.cs b/ApartmentManager/ApartmentManager/Model/Defect.cs
index 5d97831..afb29e2 100644
--- a/ApartmentManager/ApartmentManager/Model/Defect.cs
+++ b/ApartmentManager/ApartmentManager/Model/Defect.cs
@@ -1,43 +1,30 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Xaml.Controls;
namespace ApartmentManager.Model
{
public class Defect
{
- public int DefectNumber { get; set; }
- public int ApartmentNumber { get; set; }
+ public int DefectId { get; set; }
+ public int ApartmentId { get; set; }
public string Name { get; set; }
- public DateTime DateUploaded { get; set; }
- public string Picture { get; set; }
- public string Picture2 { get; set; }
- public string Picture3 { get; set; }
- public string Description { get; set; }
- public string Comment { get; set; }
+ public DateTime? UploadDate { get; set; }
+ public string Description { get; set; }
public string Status { get; set; }
public Defect() { }
- public Defect( int ApartmentNumber, string Name, DateTime DateUploaded, string Picture, string Picture2, string Picture3, string Description, string Comment, string Status)
+ public Defect(int defectId, int apartmentId, string name, DateTime? uploadDate, string description, string status)
{
-
- this.ApartmentNumber = ApartmentNumber;
- this.Name = Name;
- this.DateUploaded = DateUploaded;
- this.Picture = Picture;
- this.Picture2 = Picture2;
- this.Picture3 = Picture3;
- this.Description = Description;
- this.Comment = Comment;
- this.Status = Status;
+ DefectId = defectId;
+ ApartmentId = apartmentId;
+ Name = name;
+ UploadDate = uploadDate;
+ Description = description;
+ Status = status;
}
public override string ToString()
{
- return string.Format($"Defect Number: {DefectNumber}, Apartment Number: {ApartmentNumber}, Name: {Name}, Date Uploaded {DateUploaded}, {Picture}, {Picture2}, {Picture3}, Description: {Description}, Comment: {Comment}, Status: {Status}");
+ return string.Format($"Defect ID: {DefectId}, Apartment number: {ApartmentId}, Name: {Name}, Upload date: {UploadDate}, Description: {Description}, Status: {Status}");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/Resident.cs b/ApartmentManager/ApartmentManager/Model/Resident.cs
index 79bf6a1..d897d4b 100644
--- a/ApartmentManager/ApartmentManager/Model/Resident.cs
+++ b/ApartmentManager/ApartmentManager/Model/Resident.cs
@@ -1,42 +1,35 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Xaml.Controls;
namespace ApartmentManager.Model
{
public class Resident
{
+ public int ResidentId { get; set; }
+ public int ApartmentId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
- public int Phone { get; set; }
- public DateTimeOffset BirthDate { get; set; }
+ public DateTime? BirthDate { get; set; }
+ public string Phone { get; set; }
public string Email { get; set; }
- public string Picture { get; set; }
- public int ApartmentNr { get; set; }
- public int ResidentNr { get; set; }
+ public byte[] Picture { get; set; }
public Resident()
{
- Picture = "https://tracker.moodle.org/secure/attachment/30912/f3.png";
- BirthDate = DateTimeOffset.Now;
+ BirthDate = DateTime.Now;
}
- public Resident(string firstName, string lastName, int phone, DateTimeOffset birthDate, string email, int apartmentNr ,int residentNr, string picture)
+ public Resident(int residentId, int apartmentId, string firstName, string lastName, DateTime birthDate, string phone, string email)
{
+ ResidentId = residentId;
+ ApartmentId = apartmentId;
FirstName = firstName;
LastName = lastName;
- Phone = phone;
BirthDate = birthDate;
+ Phone = phone;
Email = email;
- ApartmentNr = apartmentNr;
- ResidentNr = residentNr;
- Picture = picture;
}
public override string ToString()
{
- return string.Format($"Name: {FirstName}, LastName: {LastName}, Birth Date: {BirthDate.Date}, Phone {Phone}, Email {Email} ");
+ return string.Format($"First name: {FirstName}, Last name: {LastName}, Birth date: {BirthDate.Value.Date}, Phone: {Phone}, Email: {Email} ");
}
}
}
diff --git a/ApartmentManager/ApartmentManager/Model/User.cs b/ApartmentManager/ApartmentManager/Model/User.cs
index 65fd778..e506791 100644
--- a/ApartmentManager/ApartmentManager/Model/User.cs
+++ b/ApartmentManager/ApartmentManager/Model/User.cs
@@ -9,34 +9,28 @@ namespace ApartmentManager.Model
{
public class User
{
- public int ApartmentNr { get; set; }
public string Username { get; set; }
+ public int ApartmentId { get; set; }
public string Password { get; set; }
- public string Type { get; set; }
+ public bool IsBm { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
- public DateTime BirthDate { get; set; }
+ public DateTime? BirthDate { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
- public Image Picture { get; set; }
- public string SecondName { get; set; }
- public string SecondLastName { get; set; }
- public string SecondBirthDate { get; set; }
- public string SecondPhone { get; set; }
- public string SecondEmail { get; set; }
-
+ public byte[] Picture { get; set; }
+ public DateTime? MoveInDate { get; set; }
+ public DateTime? MoveOutDate { get; set; }
public User() { }
- public User(string FirstName, string LastName, string Phone, DateTime BirthDate, string Email, int ApartmentNr)
+ public User(string FirstName, string LastName, string Phone, DateTime? BirthDate, string Email, int ApartmentNr)
{
this.FirstName = FirstName;
this.LastName = LastName;
- this.Phone = Phone;
this.BirthDate = BirthDate;
+ this.Phone = Phone;
this.Email = Email;
- this.ApartmentNr = ApartmentNr;
-
}
public override string ToString()
diff --git a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs b/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
index 4948e7d..3a6f85e 100644
--- a/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
+++ b/ApartmentManager/ApartmentManager/Persistency/PersistenceFacade.cs
@@ -65,7 +65,7 @@ namespace ApartmentManager.Persistency
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
try
{
- string residentsBody = "api/residents/" + resident.ApartmentNr;
+ string residentsBody = "api/residents/" + resident.ApartmentId;
var response = client.GetAsync(residentsBody).Result;
if (response.IsSuccessStatusCode)
diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
index 490ac49..95f2323 100644
--- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
+++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs
@@ -18,13 +18,10 @@ namespace ApartmentManager.Singletons
{
Residents = new ObservableCollection<Resident>();
Defects = new ObservableCollection<Defect>();
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
-
- Defects.Add(new Defect(1, "Broken Pipe", new DateTime(1988, 8, 8), "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "https://cdn.theatlantic.com/assets/media/img/photo/2011/09/vladimir-putin-action-man/p34_DWI22303/main_900.jpg?1420519465", "description", "comment", "status"));
-
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
+ Defects.Add(new Defect(1, 1, "Broken Pipe", new DateTime(1988, 8, 8), "description", "status"));
}
}
}
diff --git a/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
index 293e4bf..fc2c838 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/BoardMemberViewModel.cs
@@ -44,7 +44,7 @@ namespace ApartmentManager.ViewModel
BoardMemberHandler = new Handler.BoardMemberHandler(this);
BoardMemberCatalogSingleton = BoardMemberCatalogSingleton.Instance;
UserSingleton = UserSingleton.Instance;
- ApartmentsNumber = UserSingleton.CurrentUser.ApartmentNr;
+ ApartmentsNumber = UserSingleton.CurrentUser.ApartmentId;
CreateApartmentCommand = new RelayCommand(BoardMemberHandler.CreateApartment);
DeleteApartmentCommand = new RelayCommand(BoardMemberHandler.DeleteApartment);
diff --git a/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
index cabee1b..5f3c1b7 100644
--- a/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
+++ b/ApartmentManager/ApartmentManager/ViewModel/LoginViewModel.cs
@@ -68,7 +68,7 @@ namespace ApartmentManager.ViewModel
{
// When the navigation stack isn't restored, navigate to the first page
// suppressing the initial entrance animation.
- if (UserSingleton.Instance.CurrentUser.Type == "B") appShell.AppFrame.Navigate(typeof(BoardMembersMainPage));
+ if (UserSingleton.Instance.CurrentUser.IsBm) appShell.AppFrame.Navigate(typeof(BoardMembersMainPage));
else appShell.AppFrame.Navigate(typeof(ApartmentPage));
}