Complaints working, web comments response page, filtering for announcements
This commit is contained in:
@@ -124,7 +124,7 @@ namespace WinForms
|
||||
|
||||
private void btnCreateComment_Click(object sender, EventArgs e)
|
||||
{
|
||||
CommentForm form = new CommentForm(null, false, currentUser, true, announcement.ID);
|
||||
CommentForm form = new CommentForm(null, false, currentUser, "announcement", announcement.ID);
|
||||
form.ShowDialog();
|
||||
RefreshComments();
|
||||
}
|
||||
|
@@ -17,7 +17,8 @@ namespace WinForms
|
||||
{
|
||||
Comment? comment;
|
||||
User currentUser;
|
||||
bool announcementResponse;
|
||||
string responseType;
|
||||
bool complaint;
|
||||
int parentId;
|
||||
public CommentForm(Comment? comment, bool readOnly, User currentUser)
|
||||
{
|
||||
@@ -62,9 +63,9 @@ namespace WinForms
|
||||
lblAuthor.Text = $"Created by: {currentUser.Name}";
|
||||
}
|
||||
}
|
||||
public CommentForm(Comment? comment, bool readOnly, User? currentUser, bool announcementResponse, int parentId) : this(comment, readOnly, currentUser)
|
||||
public CommentForm(Comment? comment, bool readOnly, User? currentUser, string responseType, int parentId) : this(comment, readOnly, currentUser)
|
||||
{
|
||||
this.announcementResponse = announcementResponse;
|
||||
this.responseType = responseType;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
@@ -77,13 +78,19 @@ namespace WinForms
|
||||
}
|
||||
if (this.comment == null)
|
||||
{
|
||||
if (announcementResponse)
|
||||
switch (responseType)
|
||||
{
|
||||
commentManager.CreateCommentToAnnouncement(currentUser, tbDescription.Text, tbTitle.Text, dtpPublishDate.Value, parentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
commentManager.CreateResponseToComment(currentUser, tbDescription.Text, tbTitle.Text, dtpPublishDate.Value, parentId);
|
||||
case "announcement":
|
||||
commentManager.CreateCommentOnAnnouncement(currentUser, tbDescription.Text, tbTitle.Text, dtpPublishDate.Value, parentId);
|
||||
break;
|
||||
case "comment":
|
||||
commentManager.CreateResponseOnComment(currentUser, tbDescription.Text, tbTitle.Text, dtpPublishDate.Value, parentId);
|
||||
break;
|
||||
case "complaint":
|
||||
commentManager.CreateCommentOnComplaint(currentUser, tbDescription.Text, tbTitle.Text, dtpPublishDate.Value, parentId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -142,7 +149,7 @@ namespace WinForms
|
||||
|
||||
private void btnCreateComment_Click(object sender, EventArgs e)
|
||||
{
|
||||
CommentForm form = new CommentForm(null, false, currentUser, false, comment.ID);
|
||||
CommentForm form = new CommentForm(null, false, currentUser, "comment", comment.ID);
|
||||
form.ShowDialog();
|
||||
RefreshComments();
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ namespace WinForms
|
||||
|
||||
private void btnCreateComment_Click(object sender, EventArgs e)
|
||||
{
|
||||
CommentForm form = new CommentForm(null, false, currentUser, true, complaint.ID);
|
||||
CommentForm form = new CommentForm(null, false, currentUser, "complaint", complaint.ID);
|
||||
form.ShowDialog();
|
||||
RefreshComments();
|
||||
}
|
||||
|
@@ -202,8 +202,8 @@ namespace WinForms
|
||||
if (MessageBox.Show($"Are you sure you want to archive\n{currentComplaint.Title}\nCreated at {currentComplaint.PublishDate.ToString("g")} by {currentComplaint.Author.Name}",
|
||||
"Archive complaint", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
AnnouncementManager announcementManager = new AnnouncementManager(new AnnouncementRepository());
|
||||
announcementManager.DeleteAnnouncement(currentComplaint.ID);
|
||||
ComplaintManager complaintManager = new ComplaintManager(new ComplaintRepository());
|
||||
complaintManager.UpdateComplaint(currentComplaint.ID, currentComplaint.Title, currentComplaint.Description, ComplaintStatus.ARCHIVED, currentComplaint.Severity);
|
||||
}
|
||||
RefreshLists();
|
||||
}
|
||||
|
@@ -19,10 +19,10 @@ namespace WinForms
|
||||
{
|
||||
MessageBox.Show("Wrong username or password", "Login failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
/*else if (user.Role == UserRole.TENANT)
|
||||
else if (user.Role == UserRole.TENANT)
|
||||
{
|
||||
MessageBox.Show("This application is for the management. Please use the web portal", "Access denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}*/
|
||||
MessageBox.Show("This application is for the management. Please use the web portal!", "Access denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dashboard dashboard = new Dashboard(this, user);
|
||||
|
Reference in New Issue
Block a user