示例#1
0
        private void searchCustomer_TextChanged_1(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    int          customer     = Convert.ToInt32(searchCustomer.Text);
                    CustomerDebt customerDebt = CustomerDebt.getCDebt(customer);
                    DebitSale    debitSale    = DebitSale.getDebitSale(customer);


                    if (customer == null)
                    {
                        MessageBox.Show("The debt information of the customer entered was not found!", "ERROR");
                    }
                    else
                    {
                        List <DebitSale> debtSoldProducts = DebitSale.getallDSale();

                        if (debtSoldProducts != null)
                        {
                            foreach (DebitSale s in debtSoldProducts)
                            {
                                Object[] SoldProducts_debt = { s.customer_no, s.product_no, s.CustomerDebt.debt_amount, s.sale_date, s.sale_no, s.payment_method, };
                                table.Rows.Add(SoldProducts_debt);
                            }
                        }
                    }
                }
                catch (Exception EX)
                {
                    MessageBox.Show(EX.Message, "ERROR");
                }
            }
        }