示例#1
0
        private void btn_search_Click(object sender, EventArgs e)
        {
            bool flat = true;

            if (txt_search.Text == "")
            {
                flat = false;
                MessageBox.Show("Error! Key word is not emtyl");
                return;
            }
            if (cb_search.SelectedIndex == -1)
            {
                flat = false;
                MessageBox.Show("Error! You must select option!");
                return;
            }

            if (flat)
            {
                this.dgv_customer.DataSource = null;

                List <Customer_DGV> list_customer_dgv = new List <Customer_DGV>();
                foreach (Customer_DTO customer in Customer_BUS.Instance.Search_Customer(txt_search.Text, (int)this.cb_search.SelectedIndex))
                {
                    Customer_DGV customer_dgv = new Customer_DGV(customer.Id_customer, customer.Name, customer.Sex, customer.Phone, customer.Id_history);
                    list_customer_dgv.Add(customer_dgv);
                }
                dgv_customer.DataSource = list_customer_dgv;
            }
        }
示例#2
0
        private void Load_Data()
        {
            List <Customer_DGV> list_customer_dgv = new List <Customer_DGV>();

            foreach (Customer_DTO customer in Customer_BUS.Instance.Get_List())
            {
                Customer_DGV customer_dgv = new Customer_DGV(customer.Id_customer, customer.Name, customer.Sex, customer.Phone, customer.Id_history);
                list_customer_dgv.Add(customer_dgv);
            }
            dgv_customer.DataSource = list_customer_dgv;
        }