/// <summary> /// Main Window Constructor /// </summary> public MainWindow() { try { InitializeComponent(); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; //shut down application only when main window is closed //Initialize windows searchWindow = new wndSearch(); editWindow = new wndEdit(); //Initialize Main Window objects and attributes queries = new clsDBQueries(); currentInvoice = new clsInvoice(); selectedItems = new List <clsItem>(); currentTotal = 0; currentInvoice = null; //Bind ComboBox to Items in database and datagrid to selectedItems cmbBoxItems.ItemsSource = queries.GetItems(); dtgrdInvoiceItems.ItemsSource = selectedItems; } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
public wndEdit() { try { InitializeComponent(); queries = new clsDBQueries(); item = new clsItem(); listOfItems = queries.GetAllFromItemDesc(); isUpdateItem = false; dgListOfItems.ItemsSource = listOfItems; } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// Search window constructor /// </summary> public wndSearch() { try { InitializeComponent(); query = new clsDBQueries(); lstInvoiceSource = new List <int>(); lstItemSource = new List <string>(); lstInvoiceSource = query.GetInvoiceNumbersByDateRange(dpBeginDate.SelectedDate.Value.Date.ToString(), dpEndDate.SelectedDate.Value.Date.ToString()); lstItemSource = query.GetItemsDesc(); cmbInvoiceNums.ItemsSource = lstInvoiceSource; cmbItems.ItemsSource = lstItemSource; } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }