private void btnLuu_Click(object sender, EventArgs e)
 {
     if(txtTen.Text == string.Empty)
     {
         CheckLoi(txtTen.Text);
         txtTen.Focus();
     }
     if (txtSdt.Text == string.Empty)
     {
         CheckLoi(lbSoDienThoai.Text);
         txtSdt.Focus();
     }
     if (txtDiaChi.Text == string.Empty)
     {
         CheckLoi(lbDiaChi.Text);
         txtDiaChi.Focus();
     }
     customer Cus = new customer();
     Cus.id = txtMa.Text;
     Cus.name = txtTen.Text;
     Cus.phone = txtSdt.Text;
     Cus.address = txtDiaChi.Text;
     Cus.created = DateTime.Now;
     if (busKhachHang.Insert(Cus))
     {
         XtraMessageBox.Show("Thêm khách hàng thành công!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         this.Close();
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         XtraMessageBox.Show("Thêm khách hàng bị lỗi!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         DialogResult = System.Windows.Forms.DialogResult.Cancel;
     }
 }
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if(txtTenKhachHang.Text == string.Empty)
            {
                CheckLoi(lbTenKhachHang.Text);
                txtTenKhachHang.Focus();
            }
            if(txtSoDienThoai.Text == string.Empty)
            {
                CheckLoi(lbSoDienThoai.Text);
                    txtSoDienThoai.Focus();
            }
            if(txtDiaChi.Text == string.Empty)
            {
                CheckLoi(lbDiaChi.Text);
                    txtDiaChi.Focus();
            }

            if(s == "Them")
            {
                customer Cus = new customer();
                Cus.id = txtMaKhachHang.Text;
                Cus.name = txtTenKhachHang.Text;
                Cus.phone = txtSoDienThoai.Text;
                Cus.address = txtDiaChi.Text;
                Cus.created = DateTime.Now;
                if (busKhachHang.Insert(Cus))
                {
                    XtraMessageBox.Show("Thêm khách hàng thành công!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    XtraMessageBox.Show("Thêm khách hàng bị lỗi!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                customer Cus = (customer)gvKhachHang.GetFocusedRow();
                Cus.name = txtTenKhachHang.Text;
                Cus.phone = txtSoDienThoai.Text;
                Cus.address = txtDiaChi.Text;
                if (busKhachHang.Update(Cus))
                {
                    XtraMessageBox.Show("Sửa thông tin thành công!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    XtraMessageBox.Show("Sửa thông tin bị lỗi!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }

            btnDanhMucLamMoi.PerformClick();
            Enable(false);
        }
 partial void Updatecustomer(customer instance);
 partial void Deletecustomer(customer instance);
 partial void Insertcustomer(customer instance);