private void btnDeleteSel_Click(object sender, RoutedEventArgs e) { if (lstMsg.SelectedIndex != -1) { NotifHelper client = new NotifHelper(); try { if (MessageBox.Show("Are you sure you want to delete this message?", "Confirm deletion", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { Notifications n = (Notifications)lstMsg.SelectedItem; client.DeleteNotifications(user, n); radUnread_Checked(this, e); } } catch (Exception ex) { MessageBox.Show("An error has occured with the message: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { client.Close(); } } else { MessageBox.Show("You need to select a message"); } }
private void btnSend_Click(object sender, RoutedEventArgs e) { string message = txtReply.Text.Trim(); string title = txtSubject.Text.Trim(); if (!title.StartsWith("RE:")) { title = "RE: " + title; } NotifHelper client = new NotifHelper(); try { client.SendNotification(user.UserID, txtSenderID.Text, title, message); MessageBox.Show("Replied Sent", "Sent", MessageBoxButton.OK, MessageBoxImage.Information); btnClose_Click(sender, e); } catch (Exception ex) { MessageBox.Show("An error has occured with the error message: " + ex.Message, "Error Sending Reply", MessageBoxButton.OK, MessageBoxImage.Error); } finally { client.Close(); } }
private void btnDeleteAll_Click(object sender, RoutedEventArgs e) { NotifHelper client = new NotifHelper(); try { if (MessageBox.Show("Are you sure you want to delete all messages in your inbox?", "Confirm deletion", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { client.DeleteAllNotificationsOfUser(user, user.UserID); radUnread_Checked(this, e); } } catch (Exception ex) { MessageBox.Show("An error has occured with the message: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { client.Close(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { NotifHelper client = new NotifHelper(); lstMsg.ItemsSource = client.GetUnreadMessages(user, user.UserID); client.Close(); }
private void radUnread_Checked(object sender, RoutedEventArgs e) { if (user == null) return; NotifHelper client = new NotifHelper(); if (radUnread.IsChecked == true) { lstMsg.ItemsSource = client.GetUnreadMessages(user, user.UserID); } else { lstMsg.ItemsSource = client.GetAllMessages(user, user.UserID); } client.Close(); }
private void btnVIew_Click(object sender, RoutedEventArgs e) { if (lstMsg.SelectedIndex != -1) { Notifications n = (Notifications)lstMsg.SelectedItem; if (!n.isRead) { NotifHelper client = new NotifHelper(); client.SetNotificationRead(user, n); client.Close(); } var viewNote = new frmViewNotification(n, user); viewNote.ShowDialog(); } else { MessageBox.Show("You need to select a message"); } }
private void Report_Click(object sender, RoutedEventArgs e) { try { NotifHelper client = new NotifHelper(); client.SendNotification(user.UserID, "citadmin", "Report Review Abuse", "Reviewer: " + review.UserID + ", by: " + review.UserName + " , on Service ID: " + review.ServiceID.ToString() + " was reported for abuse"); client.Close(); MessageBox.Show("Operation Success"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }