/// <summary>
        /// .Delete The current invoice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeleteInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ////delete object from database
                oMainLogic.delInvoiceFromDB();
                MessageBox.Show("Invoice Deleted!");

                //reset ui
                dateInvoiceDate.SelectedDate = null;
                bIsNewInvoice = true;
                updateUI();
                btnEditInvoice.IsEnabled   = false;
                btnDeleteInvoice.IsEnabled = false;
                btnCreateInvoice.IsEnabled = true;
                txtInvoiceNumber.Text      = "";
            }
            catch (Exception ex)
            {
                HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                                        MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
        /// <summary>
        /// Saves User input Into Invoice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dateInvoiceDate.SelectedDate != null && txtTotalCost.Text != "0")
                {
                    MessageBox.Show("Invoice Created");
                    //Get date Value and update invoice date
                    DateTime InvoiceDate = dateInvoiceDate.SelectedDate.Value.Date;
                    oMainLogic.OInvoice.DateInvoiceDate = InvoiceDate;

                    if (bIsEditInvoice)
                    {
                        //update invoice in db
                        oMainLogic.updateInvoiceFromDB();
                    }
                    else
                    {
                        //Add invoice to Database
                        oMainLogic.addInvoiceToDB();
                        //update the invoice number
                        txtInvoiceNumber.Text = oMainLogic.OInvoice.IInvoiceNumber.ToString();
                    }

                    disableUI();
                }
                else
                {
                    MessageBox.Show("Missing Invoice Info");
                }
            }
            catch (Exception ex)
            {
                HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                                        MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
        /// <summary>
        /// Opens up the Window Search Form
        /// Search for invoices.
        /// Selects
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miSearchInv_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Hide();
                wndSearchForm.updateSearchOptions();
                wndSearchForm.ShowDialog();
                //Populate the invoice with oldInvoice
                if (wndSearchForm.getSelectedInvoiceId() != -1)
                {
                    bIsNewInvoice = false;
                    updateUI();
                }
                disableUI();

                //Finished retreive
                this.Show();
            }
            catch (Exception ex)
            {
                HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                                        MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }