Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting orders - one more time
Message
De
27/05/2009 16:07:05
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01402330
Message ID:
01402340
Vues:
51
>Hi everybody,
>
>Sorry for repeat.
>
>This is what I have right now, but it is not working:
>
> /// <summary>
>        /// Delete menu item click event
>        /// </summary>
>        private void DeleteMenuItem_Click(object sender, EventArgs e)        {
>
>            int _rowNumber = this.grdSearch._RowNumber;
>            if (this.tcOrders.SelectedIndex == 2 && _rowNumber  >= 0) //Search Page
>            {    
>
>                DialogResult dr = MessageBox.Show("Are you sure to delete this order?", "Delete Order", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
>                if (dr == DialogResult.Yes)
>                {
>                    try
>                    {
>                        //delete items
>                        Guid OrderPk = ((OrdersDataSet.OrdersRow)_dtOrderSearch.Rows[_rowNumber]).OrderPk;
>                        _itemBiz.DeleteItemsByOrderKey(OrderPk);
>                        //delete order
>                    //    _OrderBiz.DeleteOrder(OrderPk);  
>
>                        _dtOrderSearch.Rows[_rowNumber].Delete();
>                        _dtOrderSearch.AcceptChanges();
>                        UpdateOrdersTotals(_dtOrderSearch);  
>                    }
>                    catch (Exception ex)
>                    {
>                        MessageBox.Show(ex.Message);
>                    }
>                }
>            }
>
>
>Everything seems to be correctly deleted. However, when I search again I see all my orders back but with 0 items. How can I actually delete the Order - why Delete and AcceptChanges don't do this?
>
>Thanks in advance.

Is _itemBiz.DeleteItemsByOrderKey a method on a business object? Why not use the same methodology for deleting the actual order as well. Also, you should verify the line items were deleted before attempting to delete the actual order. What is _dtOrderSearch? If this is a grid, then that explains why you are seeing the order disappear in the grid but not deleted in the data.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform