private void BtnSua_Click(object sender, EventArgs e) { ec.MaKhachHang = txtmakh.Text; ec.TenKhach = txttenkh.Text; ec.SDT = txtsdt.Text; ec.CMND = txtcmnd.Text; ec.DiaChi = txtdiachi.Text; BUS.SuaDuLieu(ec); MessageBox.Show("Đã sửa"); FKhachHang_Load(sender, e); }
private void btn_Luu_Click(object sender, EventArgs e) { if (txt_MaKH.Text == "" || txt_TenKH.Text == "") { MessageBox.Show("Phải nhập dữ liệu"); return; } if (themmoi == true) { try { ec.MaKH = txt_MaKH.Text; ec.TenKH = txt_TenKH.Text; ec.SDT = txt_SDT.Text; ec.ADDRESS = txt_ADDRESS.Text; bus.ThemDuLieu(ec); } catch { return; } } else { if (themmoi == true) { try { ec.MaKH = txt_MaKH.Text; ec.TenKH = txt_TenKH.Text; ec.SDT = txt_SDT.Text; ec.ADDRESS = txt_ADDRESS.Text; bus.SuaDuLieu(ec); } catch { return; } } } SetNull(); KhoaDieuKhien(); HienThi(""); }
private void btnLuu_Click(object sender, EventArgs e) { if (txtTenKH.Text == "" || dtpNgaySinh.Text == "" || cbGT.Text == "" || txtNgheNghiep.Text == "" || txtQuocTich.Text == "" || txtDiaChi.Text == "" || txtSDT.Text == "" || txtSoCMND.Text == "") { MessageBox.Show("Bạn Chưa Nhập Đầy Đủ Thông Tin"); return; } if (themmoi == true) { try { ec.MaKH = txtMaKH.Text; ec.TenKH = txtTenKH.Text; ec.NgaySinh = DateTime.ParseExact(dtpNgaySinh.Text, "dd/MM/yyyy", null); ec.GT = cbGT.Text; ec.NgheNghiep = txtNgheNghiep.Text; ec.QuocTich = txtQuocTich.Text; ec.DiaChi = txtDiaChi.Text; ec.SDT = txtSDT.Text; ec.SoCMND = txtSoCMND.Text; if (bus.ThemDuLieu(ec) == 1) { MessageBox.Show("Đã Thêm Mới Thành Công"); } else { MessageBox.Show("Không Thành Công"); } } catch { MessageBox.Show("Thêm Mới Không Thành Công"); return; } } else { try { ec.MaKH = txtMaKH.Text; ec.TenKH = txtTenKH.Text; ec.NgaySinh = DateTime.ParseExact(dtpNgaySinh.Text, "dd/MM/yyyy", null); ec.GT = cbGT.Text; ec.NgheNghiep = txtNgheNghiep.Text; ec.QuocTich = txtQuocTich.Text; ec.DiaChi = txtDiaChi.Text; ec.SDT = txtSDT.Text; ec.SoCMND = txtSoCMND.Text; bus.SuaDuLieu(ec); MessageBox.Show("Đã Sửa Thành Công"); } catch { MessageBox.Show("Sửa Không Thành Công"); return; } } SetNull(); KhoaDieuKien(); HienThi(""); }