Example #1
0
        private void btnAddCustomer_Click(object sender, EventArgs e)
        {
            if (customerBUS.CheckCustomerInfomations(txtCustomerName.Text, txtCustomerIdentity.Text, txtCustomerAddress.Text, txtCustomerEmail.Text, true))
            {
                Customer customer = new Customer();
                customer.KeyId          = 0;
                customer.CustomerName   = txtCustomerName.Text;
                customer.CMND           = txtCustomerIdentity.Text;
                customer.Address        = txtCustomerAddress.Text;
                customer.Email          = txtCustomerEmail.Text;
                customer.DateRegistered = DateTime.Now;

                if (customerBUS.SaveEntities(customer))
                {
                    MessageBox.Show("Thêm thành công");

                    txtCustomerName.Text         = "";
                    txtCustomerIdentity.Text     = "";
                    txtCustomerAddress.Text      = "";
                    txtCustomerEmail.Text        = "";
                    txtCustomerDateRegister.Text = "";

                    LoadCustomer(customerBUS.GetAll());
                }
                else
                {
                    MessageBox.Show("Có lỗi trong quá trình thêm khách hàng");
                }
            }
        }