예제 #1
0
        /// <summary>
        /// On Click Save button will submit Total to Invoice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string t = total.ToString();
                ml.UpdateInvoiceTotal(InvoiceNum, t);

                //clear old data
                dgInvoices.ClearValue(ItemsControl.ItemsSourceProperty);

                //refresh the items in the data grid
                List <clsInvoice> invoice = ml.GetAllInvoices();
                dgInvoices.ItemsSource = invoice;

                tbInvoiceNumber.Text       = "TBD";
                dpInvoiceDate.SelectedDate = null;
                txtbxTotalCost.Text        = null;

                cmbxItemsAdded.ClearValue(ItemsControl.ItemsSourceProperty);

                tbInvoiceNumber.IsEnabled = false;
                dpInvoiceDate.IsEnabled   = false;
                txtbxTotalCost.IsEnabled  = false;
                cmbInvoiceItem.IsEnabled  = false;
                cmbxItemsAdded.IsEnabled  = false;
                //Enable Save button
                btnSaveInvoice.IsEnabled = false;
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }