Ejemplo n.º 1
0
        }//end method

        /// <summary>
        /// this method finds out the specifc serach criteria the user wants to see
        /// </summary>
        private void UserWantsToSee()
        {
            try
            {
                clsInvoices InvoiceNum  = (clsInvoices)cbChooseInvoice.SelectedItem; //specified invoice
                clsInvoices InvoiceCost = (clsInvoices)cbChooseCharge.SelectedItem;  //specified Cost

                //specific date
                string sDate = dpInvoiceDate.SelectedDate.ToString();
                if (InvoiceCost != null && InvoiceNum != null)
                {
                    return;
                }
                else if (InvoiceCost == null && sDate == "")//only invoice number
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceNum(InvoiceNum.InvoiceNum);
                    InvoicesDataGrid.ItemsSource = Temp;     //update datagrid
                }
                else if (InvoiceCost != null && sDate != "") //invoice cost and date selected
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceDateAndCost(sDate, InvoiceCost.TotalCost);
                    InvoicesDataGrid.ItemsSource = Temp;    //update datagrid
                }
                else if (InvoiceNum != null && sDate != "") //invoice num and date selected
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceNumAndDate(InvoiceNum.InvoiceNum, sDate);
                    InvoicesDataGrid.ItemsSource = Temp;                           //update datagrid
                }
                else if (InvoiceCost != null && InvoiceNum == null && sDate == "") //only cost
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceCost(InvoiceCost.TotalCost);
                    InvoicesDataGrid.ItemsSource = Temp;            //update datagrid
                }
                else if (InvoiceCost == null && InvoiceNum == null) //only date
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceDate(sDate);
                    InvoicesDataGrid.ItemsSource = Temp;//update datagrid
                }
                else//Invoice number and date and cost
                {
                    ObservableCollection <clsInvoices> Temp = MyClsSearchLogic.SpecifiedInvoiceNumAndDateAndCost(InvoiceNum.InvoiceNum, sDate, InvoiceCost.TotalCost);
                    InvoicesDataGrid.ItemsSource = Temp;//update datagrid
                }
            }
            catch (Exception ex)
            {                       //this is reflection for exception handling
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }//end method
Ejemplo n.º 2
0
        }//end method

        /// <summary>
        /// this Method takes the invoice the user selected and makes it available to other windows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (InvoicesDataGrid.SelectedItem != null)//if selected
                {
                    clsInvoices Invoice = (clsInvoices)InvoicesDataGrid.SelectedItem;
                    MainWindow.MainWndwInvoice = Invoice;//send invoice to main window
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }//end method