//button thêm khách hàng private void btnThemkhtt_Click(object sender, EventArgs e) { KHACHHANGBUS bus = new KHACHHANGBUS(); KHACHHANGTT entity = new KHACHHANGTT(); entity.TENKH = txtTenkhachhang.Text; entity.CMND = txtCMND.Text; entity.DIACHI = txtDiaChi.Text; entity.SDT = txtDienthoai.Text; entity.NGAYCAP = dtpickerngaycap.Value; entity.NGAYHETHAN = dtpngayhethan.Value; if (!bus.Add(entity)) { MessageBox.Show(KHACHHANGDAO.error_message); } else { MessageBox.Show("THÊM THÀNH CÔNG!!"); thanhviendgv.DataSource = bus.GetList(); thanhviendgv.Columns["ID"].HeaderText = "ID khách hàng"; thanhviendgv.Columns["TENKH"].HeaderText = "Tên khách hàng"; thanhviendgv.Columns["CMND"].HeaderText = "CMND"; thanhviendgv.Columns["DIACHI"].HeaderText = "Địa chỉ"; thanhviendgv.Columns["SDT"].HeaderText = "Điện thoại"; thanhviendgv.Columns["DIEMTL"].HeaderText = "Điểm tích lũy"; thanhviendgv.Columns["NGAYCAP"].Visible = false; thanhviendgv.Columns["NGAYHETHAN"].Visible = false; thanhviendgv.Columns["ID"].Visible = false; } }
public bool Delete(string Manv) { KHACHHANGTT kh = new KHACHHANGTT(); kh.ID = Manv; return(khdao.Delete(kh)); }
//button cập nhập KHÁCH HÀNG private void btnupdatekh_Click(object sender, EventArgs e) { KHACHHANGBUS bus = new KHACHHANGBUS(); KHACHHANGTT entity = new KHACHHANGTT(); if (txtsuaten.Text != "") { entity.ID = txtsuaid.Text; entity.TENKH = txtsuaten.Text; entity.CMND = txtsuacmnd.Text; entity.DIACHI = txtsuadiachi.Text; entity.SDT = txtsuasdt.Text; bool success = bus.Update(entity); common.successorerror(success); if (success) { common.ClearTextBoxes(tabPage17); //thanhviendgv.DataSource = bus.TimKH(textBox19.Text); //thanhviendgv.Columns["ID"].Visible = false; } } }
public bool Add(KHACHHANGTT kh) { kh.ID = getid(); return(khdao.Insert(kh)); }
public bool Update(KHACHHANGTT kh) { return(khdao.Update(kh)); }