/// <summary> /// past de geselecteerde hulpvraag, review of reactie aan, aan de hand van het tekstvak /// </summary> private void btnEdit_Click(object sender, EventArgs e) { selectedRequest = lbHelpRequest.SelectedItem as HelpRequest; if (selectedRequest != null) { if (selectedRequest != null) { DatabaseHandler.EditHelpRequest(selectedRequest.Id, tbEdit.Text); selectedRequest.Problem = tbEdit.Text; } } selectedReview = lbReview.SelectedItem as Review; if (selectedReview != null) { if (selectedReview != null) { DatabaseHandler.EditReview(selectedReview.Id,tbEdit.Text); selectedReview.Text = tbEdit.Text; } } selectedAnswer = lbAnswer.SelectedItem as Answer; if (selectedAnswer != null) { if (selectedAnswer != null) { DatabaseHandler.EditAnswer(selectedAnswer.Id,tbEdit.Text); selectedAnswer.Text = tbEdit.Text; } } UpdateLists(); }
/// <summary> /// Verwijderd de geselecteerde hulpvraag, review of reactie /// </summary> private void btnRemove_Click(object sender, EventArgs e) { selectedRequest = lbHelpRequest.SelectedItem as HelpRequest; if (selectedRequest != null) { if (selectedRequest != null) { DatabaseHandler.DelHelpRequest(selectedRequest.Id); HelpHandler.DelHelpRequest(selectedRequest); } } selectedReview = lbReview.SelectedItem as Review; if (selectedReview != null) { if (selectedReview != null) { DatabaseHandler.DelReview(selectedReview.Id); HelpHandler.DelReview(selectedReview); } } selectedAnswer = lbAnswer.SelectedItem as Answer; if (selectedAnswer != null) { if (selectedAnswer != null) { DatabaseHandler.DelAnswer(selectedAnswer.Id); HelpHandler.DelAnswer(selectedAnswer); } } UpdateLists(); }
/// <summary> /// Toont de geselecteerde review in het tekstvak /// </summary> private void lbReview_SelectedIndexChanged(object sender, EventArgs e) { if (lbReview.SelectedIndex != -1) { selectedReview = lbReview.SelectedItem as Review; if (selectedReview != null) { tbEdit.Text = selectedReview.ToString(); } } }
public static void GetReview() { Connect(); ReadData("SELECT * FROM RECENSIE"); try { while (dr.Read()) { int recensieID; string inhoud; DateTime datum; int beoordeling; int verzender; recensieID = Convert.ToInt32(dr.GetValue(0)); inhoud = dr.GetString(1); datum = dr.GetDateTime(2); beoordeling = Convert.ToInt32(dr.GetValue(3)); verzender = Convert.ToInt32(dr.GetValue(5)); Review review = new Review(recensieID, inhoud, datum, beoordeling, verzender); HelpHandler.AddReview(review); } } catch (InvalidCastException ex) { MessageBox.Show(ex.ToString()); } finally { Disconnect(); } }
public static void DelReview(Review review) { reviews.Remove(review); }
public static void AddReview(Review review) { reviews.Add(review); }
public static void EditReview(Review review) { }