コード例 #1
0
        /// <summary>
        /// Sell the selected collection entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSell_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if there is a selected collection
                if (this.dgCollectionEntries.SelectedItems.Count > 0)
                {
                    //check if the collection entry is already on the market
                    int marketRecords = _marketEntryManager.VerifyMarketEntryCollectionEntryPresence(((CollectionEntryDetails)this.dgCollectionEntries.SelectedItem).CollectionEntry.CollectionEntryID);
                    if (marketRecords > 0)
                    {
                        MessageBox.Show(((CollectionEntryDetails)this.dgCollectionEntries.SelectedItem).CollectionEntry.Name + " is already on the market!");
                        return;
                    }

                    //open the market entry form in add mode
                    var marketEntryForm = new frmAddEditMarketEntry(_resourceManager, _marketEntryManager, (CollectionEntryDetails)this.dgCollectionEntries.SelectedItem);
                    var result          = marketEntryForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("You must select an Entry!");
                }
            }
            catch (Exception ex)
            {
                var message = ex.Message + "\n\n" + ex.InnerException;
                MessageBox.Show(message, "Verify Collection Entry Purchase Error!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
コード例 #2
0
 /// <summary>
 /// Edit selected market entry
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEditMarketEntry_Click(object sender, RoutedEventArgs e)
 {
     //check if there is a selected collection
     if (this.dgMyMarketEntries.SelectedItems.Count > 0)
     {
         //open the market entry form in view mode
         var marketEntryForm = new frmAddEditMarketEntry(_resourceManager, _marketEntryManager, (MarketEntryDetails)this.dgMyMarketEntries.SelectedItem, MarketEntryForm.Edit);
         var result          = marketEntryForm.ShowDialog();
         if (result == true)
         {
             refreshMyMarketList();
         }
     }
     else
     {
         MessageBox.Show("You must select an Entry!");
     }
 }