Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting orders - one more time
Message
 
 
À
27/05/2009 16:02:00
John Baird
Coatesville, Pennsylvanie, É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:
01402338
Vues:
46
>>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.
>
>
>You have the OrderBiz.Delete commented out....

If I uncomment this, I will get another error.

Is my Biz object method implemented wrongly?
    /// Delete Order 
        /// </summary>
        /// <param name="OrderKey"></param>
        /// <returns></returns>
        public int DeleteOrder(Guid OrderKey)
        {
            OrdersTableAdapter ta = new OrdersTableAdapter();
            return ta.Delete(OrderKey);  
        }
Also, I would think that probably OrderBiz should take care of deleting Order and Items, but I'm not sure how should I program this now - I would have to add OrderItems DS to the reference in OrderBiz ?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform