async void feedControl_FeedbackReceived(FeedbackItem feedbackObj) { // Received feedback from the control try { SetIsEnableControls(true); SetProgressBarVisibility(true); var response = await Ascent.Code.Ascent.GiveFeedback(feedbackObj); if (!response.Success) { Helper.ShowMessage(response.ErrorMessage, "Information"); } else { Helper.ShowMessage("Thank you for you valuable feedback", "Information"); } } catch (Exception) { Helper.ShowMessage("Please make sure you have an active internet connection to give feedback. Please try again later.", "Error"); } finally { SetProgressBarVisibility(false); } }
public async static Task<FeedbackResponse> GiveFeedback(FeedbackItem feedInfo) { string url = string.Format("?action=setFeedback&schedId={0}&empId={1}&rating={2}&comments={3}", feedInfo.ScheduleID, feedInfo.EmployeeID, feedInfo.Rating, feedInfo.Comments); string urlContent = await GetURLContentAsString(url); if (string.IsNullOrEmpty(urlContent)) { // User's phone went offline before comment upload var localSettings = ApplicationData.Current.LocalSettings; string settingName = string.Format("{0}_{1}_{2}", OFFLINE_FEEDBACK_PREFIX, feedInfo.ScheduleID, feedInfo.EmployeeID); if (!localSettings.Values.Keys.Contains(settingName)) { string serializedString = JsonConvert.SerializeObject(feedInfo); #if DEBUG System.Diagnostics.Debug.WriteLine("Serializing into setting: {0}\nValue: {1}\n", settingName, serializedString); #endif localSettings.Values[settingName] = serializedString; return new FeedbackResponse(CLIENT_OFFLINE_JSON); } else { return new FeedbackResponse(CLIENT_OFFLINE_NONEW_JSON); } } return ParseFeedbackResponse(urlContent); }
private void OnFeedbackReceived(FeedbackItem o) { if (FeedbackReceived != null) FeedbackReceived(o); }
private void OnFeedbackCancelled(FeedbackItem o) { if (FeedbackCancelled != null) FeedbackCancelled(o); }
private void Button_Click_1(object sender, RoutedEventArgs e) { //cancel clicked IsOpen = false; FeedbackItem feedObject = new FeedbackItem(_scheduleObject.ID, UserInformation.EmployeeId, 0, string.Empty); OnFeedbackCancelled(feedObject); }
//public void ShowAvgRating(string facultyName, string courseName, AvgRatingObject avgRateObj) //{ // if (!IsOpen) // { // SetDialogMode(Mode.ShowRating); // tbCourseName.Text = courseName; // tbFacultyName.Text = facultyName; // double avgRounded = Math.Round(avgRateObj.AvgRating, 2); // tbRating.Text = avgRounded.ToString(); // double offsetValue = avgRounded / 5; // tbFeedbacks.Text = avgRateObj.TotalComments.ToString(); // IsOpen = true; // rating.Offset = offsetValue; // } //} private async void Button_Click(object sender, RoutedEventArgs e) { if (rating.Value == 0) { await (new MessageDialog("Rating cannot be zero", "Error")).ShowAsync(); return; } if (string.IsNullOrEmpty(tbComments.Text)) { await (new MessageDialog("Comments cannot be blank", "Error")).ShowAsync(); return; } //submit clicked FeedbackItem feedObject = new FeedbackItem(_scheduleObject.ID, UserInformation.EmployeeId, rating.Value, tbComments.Text); IsOpen = false; OnFeedbackReceived(feedObject); }
void feedControl_FeedbackCancelled(FeedbackItem feedbackObj) { // Cancelled the feedback control SetIsEnableControls(true); }