コード例 #1
0
        /// <summary>
        /// Open window and do initial setup of datagrid and comboboxes
        /// </summary>
        /// <param name="mainWindow"></param>
        public SearchWindow(MainWindow mainWindow)
        {
            //store main window
            currentMain = mainWindow;

            //start up the search logic
            _searchLogic = new clsSearchLogic();

            //populate datagrid with initial unsorted invoices
            invoiceList = _searchLogic.GetAllItems();

            //populate comboboxes
            numberList = _searchLogic.Get <int>("InvoiceNum").Distinct().ToList();
            numberList.Sort();
            dateList = _searchLogic.Get <DateTime>("InvoiceDate").Distinct().ToList();
            dateList.Sort();
            costList = _searchLogic.Get <int>("TotalCost").Distinct().ToList();
            costList.Sort();


            //set up visual
            InitializeComponent();
            //disable select button to prevent selecting nothing
            selectButton.IsEnabled = false;

            //set up comboboxes
            numFilter.ItemsSource    = numberList;
            dateFilter.ItemsSource   = dateList;
            chargeFilter.ItemsSource = costList;

            //populate datagrid with Invoices
            listDisplay.ItemsSource = invoiceList;
        }
コード例 #2
0
ファイル: wndSearch.xaml.cs プロジェクト: jbroot/Invoices
        /// <summary>
        /// Initializes Search Window
        /// </summary>
        public wndSearch()
        {
            try
            {
                InitializeComponent();
                search = new clsSearchLogic();

                int rows = 0;
                comboBoxInvoices.ItemsSource = search.invoiceList;
                invoices = search.GetInvoices(ref rows);
            }

            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }