private void BtnNewInvoice_Click(object sender, RoutedEventArgs e)
 {
     try{
         clsMainLogic.Invoice newInvoice = controller.createNewInvoice();
         setCurrentInvoice(newInvoice);
     }
     catch (Exception ex) {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
 /// <summary>
 /// all view logic for when an invoice is selected.
 /// </summary>
 /// <param name="invoice"></param>
 private void setCurrentInvoice(clsMainLogic.Invoice invoice)
 {
     try{
         currentInvoice = invoice;
         currentInvoice.LoadItems(controller.getInvoiceDetails(invoice.InvoiceNum));
         updateInvoiceDisplay();
     }
     catch (Exception ex) {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
 /// <summary>
 /// event handler for invoice save button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnSave_Click(object sender, RoutedEventArgs e)
 {
     try{
         currentInvoice.InvoiceDate = (DateTime)pickInvoiceDate.SelectedDate;
         currentInvoice             = controller.saveInvoice(currentInvoice);
         updateAllInvoices();
         setCurrentInvoice(currentInvoice);
     }
     catch (Exception ex) {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
 /// <summary>
 /// handler for when an invoice is selected.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InvoiceList_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     try{
         if (invoiceList.SelectedIndex > -1)
         {
             clsMainLogic.Invoice clickedInvoice = (clsMainLogic.Invoice)e.AddedItems[0];
             setCurrentInvoice(clickedInvoice);
         }
     }
     catch (Exception ex) {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }