diff --git a/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml b/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml index ae8aeb5..741eab6 100644 --- a/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml +++ b/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml @@ -19,12 +19,12 @@
- +
- - + +
diff --git a/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml.cs b/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml.cs index 52c1e2d..919394a 100644 --- a/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml.cs +++ b/StudentHouseDashboard/WebApp/Pages/Announcements.cshtml.cs @@ -34,7 +34,7 @@ namespace WebApp.Pages ViewData.Add("count", c); ViewData.Add("allCount", AnnouncementManager.GetAllAnnouncements().Count); } - public void OnGetFilter(string s, bool asc, bool des, bool imp) // search, ascending, descending order, isImportant + public void OnGetFilter(string s, bool asc, bool imp) // search, ascending/descending order, isImportant { AnnouncementManager = new AnnouncementManager(_announcementRepository); List announcements = new List(); @@ -46,15 +46,17 @@ namespace WebApp.Pages { announcements = AnnouncementManager.GetAllAnnouncements(); } + if (imp) { announcements = announcements.Where(x => x.IsImportant).ToList(); } + if (asc) { announcements = announcements.OrderBy(x => x.PublishDate).ToList(); } - else if (des) + else { announcements = announcements.OrderByDescending(x => x.PublishDate).ToList(); } diff --git a/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml b/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml new file mode 100644 index 0000000..f38566a --- /dev/null +++ b/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml @@ -0,0 +1,13 @@ +@page +@model WebApp.Pages.Error.UnexpectedModel +@{ + ViewData["Title"] = "Unexpected error"; +} +
+

Uh oh! An unexpected error has occured.

+ +

+ Contact your system admistrator if this cat appears too often on your screen. +

+
+

Photo: pexels.com

\ No newline at end of file diff --git a/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml.cs b/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml.cs new file mode 100644 index 0000000..f6a82ac --- /dev/null +++ b/StudentHouseDashboard/WebApp/Pages/Error/Unexpected.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace WebApp.Pages.Error +{ + public class UnexpectedModel : PageModel + { + public void OnGet() + { + } + } +} diff --git a/StudentHouseDashboard/WebApp/Pages/Index.cshtml b/StudentHouseDashboard/WebApp/Pages/Index.cshtml index 3180466..4079123 100644 --- a/StudentHouseDashboard/WebApp/Pages/Index.cshtml +++ b/StudentHouseDashboard/WebApp/Pages/Index.cshtml @@ -7,7 +7,7 @@

Student House Dashboard

- The student square for housemates! This site is currently under construction. + Welcome to the student square for housemates!

@if (!User.Identity.IsAuthenticated) { @@ -16,6 +16,14 @@ else { Announcements + Complaints }
-Image: pexels.com \ No newline at end of file + +Image: pexels.com + +
+

Newest update

+

Now you can search for announcements on a specific date using the search bar and the keyword "date:"

+

Example: date:2023-05-13

+
\ No newline at end of file diff --git a/StudentHouseDashboard/WinForms/ComplaintForm.cs b/StudentHouseDashboard/WinForms/ComplaintForm.cs index a0597f9..8dba92d 100644 --- a/StudentHouseDashboard/WinForms/ComplaintForm.cs +++ b/StudentHouseDashboard/WinForms/ComplaintForm.cs @@ -24,6 +24,9 @@ namespace WinForms this.currentUser = currentUser; dtpPublishDate.Enabled = false; + tbTitle.Enabled = false; + tbDescription.Enabled = false; + foreach (var item in Enum.GetValues(typeof(ComplaintStatus))) { cbStatus.Items.Add(item); @@ -32,11 +35,10 @@ namespace WinForms { cbSeverity.Items.Add(item); } + if (readOnly) { btnSave.Enabled = false; - tbTitle.Enabled = false; - tbDescription.Enabled = false; cbStatus.Enabled = false; cbSeverity.Enabled = false; } diff --git a/StudentHouseDashboard/WinForms/Dashboard.Designer.cs b/StudentHouseDashboard/WinForms/Dashboard.Designer.cs index f0e6882..d998d26 100644 --- a/StudentHouseDashboard/WinForms/Dashboard.Designer.cs +++ b/StudentHouseDashboard/WinForms/Dashboard.Designer.cs @@ -45,12 +45,13 @@ btnEditAnnouncement = new Button(); lbAnnouncements = new ListBox(); tpComplaints = new TabPage(); - tpEvents = new TabPage(); - lbComplaints = new ListBox(); panelComplaintFunctions = new Panel(); btnArchiveComplaint = new Button(); btnViewComplaint = new Button(); btnEditComplaint = new Button(); + lbComplaints = new ListBox(); + tpEvents = new TabPage(); + btnLogout = new Button(); tabControl1.SuspendLayout(); tpUsers.SuspendLayout(); panelUserFunctions.SuspendLayout(); @@ -243,25 +244,6 @@ tpComplaints.Text = "Complaints"; tpComplaints.UseVisualStyleBackColor = true; // - // tpEvents - // - tpEvents.Location = new Point(4, 24); - tpEvents.Name = "tpEvents"; - tpEvents.Size = new Size(723, 340); - tpEvents.TabIndex = 3; - tpEvents.Text = "Events"; - tpEvents.UseVisualStyleBackColor = true; - // - // lbComplaints - // - lbComplaints.Dock = DockStyle.Top; - lbComplaints.FormattingEnabled = true; - lbComplaints.ItemHeight = 15; - lbComplaints.Location = new Point(0, 0); - lbComplaints.Name = "lbComplaints"; - lbComplaints.Size = new Size(723, 289); - lbComplaints.TabIndex = 0; - // // panelComplaintFunctions // panelComplaintFunctions.Controls.Add(btnArchiveComplaint); @@ -303,11 +285,41 @@ btnEditComplaint.UseVisualStyleBackColor = true; btnEditComplaint.Click += btnEditComplaint_Click; // + // lbComplaints + // + lbComplaints.Dock = DockStyle.Top; + lbComplaints.FormattingEnabled = true; + lbComplaints.ItemHeight = 15; + lbComplaints.Location = new Point(0, 0); + lbComplaints.Name = "lbComplaints"; + lbComplaints.Size = new Size(723, 289); + lbComplaints.TabIndex = 0; + // + // tpEvents + // + tpEvents.Location = new Point(4, 24); + tpEvents.Name = "tpEvents"; + tpEvents.Size = new Size(723, 340); + tpEvents.TabIndex = 3; + tpEvents.Text = "Events"; + tpEvents.UseVisualStyleBackColor = true; + // + // btnLogout + // + btnLogout.Location = new Point(651, 0); + btnLogout.Name = "btnLogout"; + btnLogout.Size = new Size(75, 23); + btnLogout.TabIndex = 7; + btnLogout.Text = "Log out"; + btnLogout.UseVisualStyleBackColor = true; + btnLogout.Click += btnLogout_Click; + // // Dashboard // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(731, 368); + Controls.Add(btnLogout); Controls.Add(lblUserStatus); Controls.Add(tabControl1); Name = "Dashboard"; @@ -349,5 +361,6 @@ private Button btnArchiveComplaint; private Button btnViewComplaint; private Button btnEditComplaint; + private Button btnLogout; } } \ No newline at end of file diff --git a/StudentHouseDashboard/WinForms/Dashboard.cs b/StudentHouseDashboard/WinForms/Dashboard.cs index 4a30bdf..edf60b9 100644 --- a/StudentHouseDashboard/WinForms/Dashboard.cs +++ b/StudentHouseDashboard/WinForms/Dashboard.cs @@ -236,5 +236,13 @@ namespace WinForms RefreshLists(); } } + + private void btnLogout_Click(object sender, EventArgs e) + { + if (MessageBox.Show("Do you want to log out?", "Log out", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + Close(); + } + } } } diff --git a/docs/testplan.docx b/docs/testplan.docx index f471fd1..a7f4716 100644 Binary files a/docs/testplan.docx and b/docs/testplan.docx differ