/// <summary> /// Message the purchaser of the selected my market entry record. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMessagePurchaser_Click(object sender, RoutedEventArgs e) { if (this.dgMyMarketEntries.SelectedItems.Count > 0) { var entry = (MarketEntryDetails)this.dgMyMarketEntries.SelectedItem; if (entry.MarketEntry.MarketEntryStatusID == "Sold") { try { User purchaser = _userManager.RetreiveUserByMarketEntryPurchaseMarketEntryID(entry.MarketEntry.MarketEntryID); var messageForm = new frmMessaging(entry, _user.User, purchaser); messageForm.ShowDialog(); } catch (Exception ex) { var message = ex.Message + "\n\n" + ex.InnerException; MessageBox.Show(message, "Purchaser Retreival Error!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Market entry must be Sold to message the buyer!"); } } else { MessageBox.Show("You must select an Entry!"); } }
/// <summary> /// Message the seller of the selected purchase record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMessageSeller_Click(object sender, RoutedEventArgs e) { if (this.dgPurchases.SelectedItems.Count > 0) { var entry = (PurchaseDetails)this.dgPurchases.SelectedItem; if (entry.MarketEntryDetails.MarketEntry.MarketEntryStatusID == "Sold") { var messageForm = new frmMessaging(entry.MarketEntryDetails, _user.User, entry.User); messageForm.ShowDialog(); } else { MessageBox.Show("Market entry must be Sold to message the buyer!"); } } else { MessageBox.Show("You must select an Entry!"); } }