private void btAddCustomer_Click_1(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            errorProvider2.Clear();
            errorProvider3.Clear();
            //errorProvider4.Clear();

            if (txtNameCustomer.Text == "")
            {
                errorProvider1.SetError(txtNameCustomer, "not null!");
            }
            else if (txtIdentifyCardCustomer.Text == "")
            {
                errorProvider2.SetError(txtIdentifyCardCustomer, "not null!");
            }
            else if (txtPhoneCustomer.Text == "")
            {
                errorProvider3.SetError(txtPhoneCustomer, "not null!");
            }
            //else if (dtBirthday)
            //{
            //    errorProvider4.SetError(txtGenderCustomer, "not null!");
            //}

            else
            {
                ctmBUS = new CustomerBUS();
                CustomerDTO ctm = new CustomerDTO();
                ctm.IDC   = txtNameCustomer.Text;
                ctm.NAME  = txtNameCustomer.Text;
                ctm.PHONE = txtPhoneCustomer.Text;
                ctm.DATE  = DateTime.Parse(dtBirthday.Text);
                ctm.CMND  = txtIdentifyCardCustomer.Text;

                bool kq = ctmBUS.add(ctm);
                if (kq == false)
                {
                    MessageBox.Show("Fail!");
                }
                else
                {
                    MessageBox.Show("Sussces");
                }
                this.loadData();
            }
        }
예제 #2
0
 public void insertCustomer(Customer customer)
 {
     _bus.add(customer);
 }