Exemple #1
0
        //These update the invoice total
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Collects current method for error tracking
            string method = "OnRowDeleting";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0];
                lblInvalidQty.Visible = false;
                int currentInvoiceItemID = Convert.ToInt32(((Label)GrdCartItems.Rows[e.RowIndex].Cells[0].FindControl("lblInvoiceItemID")).Text);
                IIM.ReturnQTYToInventory(currentInvoiceItemID, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                //Remove the indexed pointer
                GrdCartItems.EditIndex = -1;
                IM.CalculateNewInvoiceTotalsToUpdate(IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0], objPageDetails);
                invoice = IM.CallReturnCurrentInvoice(invoice.intInvoiceID, objPageDetails)[0];

                //bind items back to grid view
                GrdCartItems.DataSource = invoice.invoiceItems;
                GrdCartItems.DataBind();
                //Calculate new subtotal
                lblSubtotalDisplay.Text   = invoice.fltSubTotal.ToString("C");
                Session["currentInvoice"] = invoice;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }