/// <summary> /// Handles BtnSend event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSend_Click(object sender, EventArgs e) { string message = mTxtFeedback.Text.Trim(); if (message.Length > 255) { string error = "Sorry, the feedback message is too long."; AlertGenerator.ShowError(error, this); } else { DisableEnableControls(false); Task.Factory.StartNew(() => { if (DbConnector.OpenSQLConnection()) { // Connection opened Feedback feedback = new Feedback() { Username = Intent.GetStringExtra("Username"), Rating = mRatingBar.Rating, Message = message, Date = DateTime.Now.Date }; FeedbackDA feedbackDA = new FeedbackDA(); if (feedbackDA.InsertFeedback(feedback)) { // Feedback was added successfully Finish(); // Close this activity OverridePendingTransition(Resource.Animation.slide_in_top, Resource.Animation.slide_out_bottom); } else { string error = "There was a problem saving the record."; RunOnUiThread(() => { //Enabling the controls back DisableEnableControls(true); AlertGenerator.ShowError(error, this); }); } } else { // Connection could not be opened string error = "Connection to the database could not be established."; RunOnUiThread(() => { //Enabling the controls back DisableEnableControls(true); AlertGenerator.ShowError(error, this); }); } DbConnector.CloseSQLConnection(); // Close connection to the database }); } }
/// <summary> /// /// </summary> public static List <Feedback> GetPublishedFeedback() { List <Feedback> feedback = new FeedbackDA().GetAllPublishedFeedback(); feedback.Reverse(); return(feedback); }
public static void SaveFeedbackReview(int feedbackID, bool published, string reviewComment) { FeedbackDA da = new FeedbackDA(); Feedback feedback = da.GetByID(feedbackID); if (!feedback.DateTimeFirstReplied.HasValue) { feedback.DateTimeFirstReplied = DateTime.Now; } feedback.DateTimeLastReviewed = DateTime.Now; feedback.ResponseFromAdmin = reviewComment; feedback.Published = published; da.Update(feedback); }
/// <summary> /// /// </summary> public static List<Feedback> GetPublishedFeedback() { List<Feedback> feedback = new FeedbackDA().GetAllPublishedFeedback(); feedback.Reverse(); return feedback; }