private void btnCapThe_Click_1(object sender, EventArgs e)
 {
     if (txtHoten.Text == "" || txtSDT.Text == "" || txtCMND.Text == "" || txtDiaChi.Text == "" || txtCMND.Text.Length > 9 || txtSDT.Text.Length > 11)
     {
         MessageBox.Show("Thông tin chưa chính xác", "Có lỗi xảy ra");
         return;
     }
     else
     {
         TheKhachHangDTO tkh = new TheKhachHangDTO(txtHoten.Text, txtDiaChi.Text, txtSDT.Text, txtCMND.Text);
         DataTable       dt  = new DataTable();
         dt = bus.KiemTraTheKhachHangDaTonTaiChua(tkh.TenKh, tkh.CMND);
         if (dt.Rows.Count > 0)
         {
             MessageBox.Show("Khách hàng đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             if (bus.CapTheKhachHang(tkh, _maNV))
             {
                 MessageBox.Show("Cấp thẻ thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Cấp thẻ thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
示例#2
0
        public bool CapTheKhachHang(TheKhachHangDTO tkh, int manv)
        {
            string sql = "insert into TheKhachHang values(N'" + tkh.TenKh + "', N'" + tkh.Diachi + "', '" + tkh.Sodienthoai + "', '" + tkh.CMND + "', 20,'" + manv + "')";

            return(dp.ExecuteNonQuery(sql));
        }
示例#3
0
 public bool CapTheKhachHang(TheKhachHangDTO tkh, int manv)
 {
     return(dao.CapTheKhachHang(tkh, manv));
 }