Beispiel #1
0
        private void SearchForCustomerButton(object sender, EventArgs e) // search for customers
        {
            BorrowBooks_SearchForCustomer searchCust = new BorrowBooks_SearchForCustomer();

            if (searchCust.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = searchCust.CustomerID.ToString();
            }
        }
        private void Search_Click(object sender, EventArgs e)
        {
            BorrowBooks_SearchForCustomer searchCustforBook = new BorrowBooks_SearchForCustomer();

            if (searchCustforBook.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = searchCustforBook.CustomerID.ToString();
                // Get Transactions which the CustomerID is involved in
                var query_getTransactions = from x in context.IssueTrans
                                            where x.CustomerID.ToString() == textBox1.Text
                                            select x.TransactionNo;

                // Get Books from Above Transactions Which are not returned
                var query_getBooks = from x in context.BookIssueds
                                     where query_getTransactions.ToList().Contains(x.TransactionNo) &&
                                     x.DateActualReturn == null
                                     select new { x.ISBN, x.DateDue, x.BookTitle };

                // Display Books in Data Grid View
                dataGridView1.DataSource = query_getBooks.ToList();
            }
        }