Documentation & code cleanup
This commit is contained in:
23
README.md
23
README.md
@@ -1,5 +1,24 @@
|
|||||||
# Student House Dashboard
|
# Student House Dashboard
|
||||||
|
|
||||||
Work in progress
|
|
||||||
|
|
||||||
Project documentation is available in the docs folder
|
Project documentation is available in the docs folder
|
||||||
|
|
||||||
|
## Default user details
|
||||||
|
|
||||||
|
### System administrator
|
||||||
|
admin
|
||||||
|
admin
|
||||||
|
|
||||||
|
### Manager
|
||||||
|
manager
|
||||||
|
manager
|
||||||
|
|
||||||
|
### Tenant
|
||||||
|
room1
|
||||||
|
room1
|
||||||
|
|
||||||
|
room2
|
||||||
|
room2
|
||||||
|
|
||||||
|
## FHICT Luna server
|
||||||
|
|
||||||
|
The web application is hosted on the FHICT Luna server at: https://i509645.luna.fhict.nl/
|
@@ -1,13 +1,8 @@
|
|||||||
using Models;
|
using Logic;
|
||||||
using Logic;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Logic.Exceptions;
|
using Logic.Exceptions;
|
||||||
using System.Reflection;
|
using Models;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
using System.ComponentModel.Design;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using Models;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Logic.Exceptions;
|
using Logic.Exceptions;
|
||||||
|
using Models;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
namespace Data;
|
namespace Data;
|
||||||
|
|
||||||
|
@@ -1,12 +1,8 @@
|
|||||||
using Logic;
|
using Logic;
|
||||||
using Logic.Exceptions;
|
using Logic.Exceptions;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
|
@@ -1,12 +1,7 @@
|
|||||||
using Logic;
|
using Logic;
|
||||||
using Logic.Exceptions;
|
using Logic.Exceptions;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,5 @@
|
|||||||
using Logic.Exceptions;
|
using Logic.Exceptions;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
|
@@ -1,13 +1,6 @@
|
|||||||
using System;
|
using Logic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using Models;
|
using Models;
|
||||||
using System.Data;
|
using System.Data.SqlClient;
|
||||||
using System.Xml.Linq;
|
|
||||||
using Logic;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
@@ -115,7 +108,7 @@ namespace Data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public User GetUserByName(string userName)
|
public User? GetUserByName(string userName)
|
||||||
{
|
{
|
||||||
using (SqlConnection conn = SqlConnectionHelper.CreateConnection())
|
using (SqlConnection conn = SqlConnectionHelper.CreateConnection())
|
||||||
{
|
{
|
||||||
@@ -124,9 +117,15 @@ namespace Data
|
|||||||
cmd.Parameters.AddWithValue("@userName", userName);
|
cmd.Parameters.AddWithValue("@userName", userName);
|
||||||
var reader = cmd.ExecuteReader();
|
var reader = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
if (reader.HasRows)
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
return new User(Convert.ToInt32(reader["ID"]), reader["Name"].ToString(),
|
return new User(Convert.ToInt32(reader["ID"]), reader["Name"].ToString(),
|
||||||
reader["Password"].ToString(), (UserRole)reader["Role"]);
|
reader["Password"].ToString(), (UserRole)reader["Role"]);
|
||||||
}
|
}
|
||||||
|
else { return null; }
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,5 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.Net;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic.Exceptions
|
namespace Logic.Exceptions
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Logic.Exceptions
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic.Exceptions
|
|
||||||
{
|
{
|
||||||
public class DatabaseOperationException : ApplicationException
|
public class DatabaseOperationException : ApplicationException
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
using System.ComponentModel.Design;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using Models;
|
using Models;
|
||||||
|
|
||||||
namespace Logic;
|
namespace Logic;
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using Logic.Exceptions;
|
using Models;
|
||||||
using Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
@@ -17,4 +12,3 @@ namespace Logic
|
|||||||
public void DeleteEvent(int id);
|
public void DeleteEvent(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -1,9 +1,4 @@
|
|||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,14 +1,4 @@
|
|||||||
using BCrypt.Net;
|
using Models;
|
||||||
using Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Logic
|
namespace Logic
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
|
||||||
{
|
{
|
||||||
public class Announcement : GenericMessage
|
public class Announcement : GenericMessage
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
|
||||||
{
|
{
|
||||||
public class Comment : GenericMessage
|
public class Comment : GenericMessage
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
|
||||||
{
|
{
|
||||||
public class Complaint : GenericMessage
|
public class Complaint : GenericMessage
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
|
||||||
{
|
{
|
||||||
public class Event : GenericMessage
|
public class Event : GenericMessage
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
@@ -25,13 +20,17 @@ namespace Models
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Required]
|
||||||
[StringLength(255)]
|
[StringLength(255)]
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Required]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
|
[StringLength(int.MaxValue, MinimumLength = 4)]
|
||||||
public string Password
|
public string Password
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,5 @@
|
|||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Tests.Mocks;
|
using Tests.Mocks;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
@@ -1,13 +1,6 @@
|
|||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Tests.Mocks
|
namespace Tests.Mocks
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,5 @@
|
|||||||
using Models;
|
using Logic;
|
||||||
using Logic;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Tests.Mocks
|
namespace Tests.Mocks
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
using BCrypt.Net;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using Tests.Mocks;
|
using Tests.Mocks;
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Logic;
|
using Logic;
|
||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Models;
|
using Models;
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Data;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Models;
|
using Models;
|
||||||
using System.Security.Claims;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Data;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace WebApp.Pages.Error
|
namespace WebApp.Pages.Error
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace WebApp.Pages.Error
|
namespace WebApp.Pages.Error
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Data;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,10 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using System.Security.Claims;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using System.Dynamic;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Data;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Logic;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Models;
|
using Models;
|
||||||
using Logic;
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Data;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
using Data;
|
||||||
|
using Logic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Logic;
|
|
||||||
using Models;
|
using Models;
|
||||||
using Data;
|
|
||||||
|
|
||||||
namespace WebApp.Pages
|
namespace WebApp.Pages
|
||||||
{
|
{
|
||||||
@@ -16,10 +16,22 @@ namespace WebApp.Pages
|
|||||||
public void OnPost()
|
public void OnPost()
|
||||||
{
|
{
|
||||||
var userManager = new UserManager(new UserRepository());
|
var userManager = new UserManager(new UserRepository());
|
||||||
if (userManager.CreateUser(MyUser.Name, BCrypt.Net.BCrypt.HashPassword(MyUser.Password), MyUser.Role) != null)
|
User? result = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = userManager.CreateUser(MyUser.Name, BCrypt.Net.BCrypt.HashPassword(MyUser.Password), MyUser.Role);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
ViewData["confirm"] = "An error has occurred. Try a different username.";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (result != null)
|
||||||
{
|
{
|
||||||
ViewData["confirm"] = $"Successfully registered {MyUser.Name}!";
|
ViewData["confirm"] = $"Successfully registered {MyUser.Name}!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -13,7 +13,8 @@ namespace WebApp
|
|||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
|
|
||||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => {
|
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options =>
|
||||||
|
{
|
||||||
options.LoginPath = new PathString("/Login");
|
options.LoginPath = new PathString("/Login");
|
||||||
options.AccessDeniedPath = new PathString("/Error/401");
|
options.AccessDeniedPath = new PathString("/Error/401");
|
||||||
});
|
});
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
@@ -1,15 +1,6 @@
|
|||||||
using Data;
|
using Data;
|
||||||
using Logic;
|
using Logic;
|
||||||
using Models;
|
using Models;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
|
BIN
docs/project-report.docx
Normal file
BIN
docs/project-report.docx
Normal file
Binary file not shown.
Binary file not shown.
BIN
docs/testplan.pdf
Normal file
BIN
docs/testplan.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
USE dbi509645
|
USE dbi509645
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
-- User roles
|
||||||
INSERT INTO UserRole ([Role])
|
INSERT INTO UserRole ([Role])
|
||||||
VALUES
|
VALUES
|
||||||
('TENANT'),
|
('TENANT'),
|
||||||
@@ -8,6 +9,7 @@ VALUES
|
|||||||
('ADMIN')
|
('ADMIN')
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
-- Default users
|
||||||
INSERT INTO Users ([Name], [Password], [Role])
|
INSERT INTO Users ([Name], [Password], [Role])
|
||||||
VALUES
|
VALUES
|
||||||
('admin', 'admin', 2),
|
('admin', 'admin', 2),
|
||||||
@@ -15,6 +17,7 @@ VALUES
|
|||||||
('room1', 'room1', 0)
|
('room1', 'room1', 0)
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
-- Complaint status
|
||||||
INSERT INTO ComplaintStatus ([Status])
|
INSERT INTO ComplaintStatus ([Status])
|
||||||
VALUES
|
VALUES
|
||||||
('FILED'),
|
('FILED'),
|
||||||
@@ -23,6 +26,7 @@ VALUES
|
|||||||
('ARCHIVED')
|
('ARCHIVED')
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
-- Complaint severity
|
||||||
INSERT INTO ComplaintSeverity ([Severity])
|
INSERT INTO ComplaintSeverity ([Severity])
|
||||||
VALUES
|
VALUES
|
||||||
('LOW'),
|
('LOW'),
|
||||||
@@ -30,5 +34,3 @@ VALUES
|
|||||||
('HIGH'),
|
('HIGH'),
|
||||||
('URGENT')
|
('URGENT')
|
||||||
GO
|
GO
|
||||||
|
|
||||||
SELECT * FROM Users u JOIN UserRole r ON u.[Role] = r.ID
|
|
@@ -15,6 +15,8 @@ CREATE TABLE Users (
|
|||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
-- Used only in previous versions for a contact form
|
||||||
|
-- no longer needed
|
||||||
CREATE TABLE ContactForm (
|
CREATE TABLE ContactForm (
|
||||||
ID INT PRIMARY KEY IDENTITY NOT NULL,
|
ID INT PRIMARY KEY IDENTITY NOT NULL,
|
||||||
[Name] NVARCHAR(255) NOT NULL,
|
[Name] NVARCHAR(255) NOT NULL,
|
Reference in New Issue
Block a user