public bool XoaBHYT(BHYT bh) { string[] param = { "@SoTheBH", "@TenChuThe" }; object[] values = { bh.SoTheBH, bh.TenChuThe }; string query = "Delete from BHYTe where SoTheBH=@SoTheBH "; return(db.ExecuteNonQueryPara(query, param, values)); }
public bool SuaBHYT(BHYT bh) { string[] param = { "@SoTheBH", "@TenChuThe" }; object[] values = { bh.SoTheBH, bh.TenChuThe }; string query = "Update BHYTe set TenChuThe=@TenChuThe where SoTheBH=@SoTheBH"; return(db.ExecuteNonQueryPara(query, param, values)); }
public bool ThemBHYT(BHYT bh) { string[] param = { "@SoTheBH", "@TenChuThe" }; object[] values = { bh.SoTheBH, bh.TenChuThe }; string query = "Insert into BHYTe(SoTheBH,TenChuThe) values (@SoTheBH,@TenChuThe)"; return(db.ExecuteNonQueryPara(query, param, values)); }
private BHYT getDataBHYT() { BHYT bh = new BHYT(); bh.SoTheBH = txtSoThe.Text; bh.TenChuThe = txtTenChuThe.Text; return(bh); }
private void btnXoa_Click(object sender, EventArgs e) { BHYT bh = getDataBHYT(); if (MessageBox.Show("Bạn có chắc muốn xóa thẻ bảo hiểm này?", "Xác Nhận", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (bhytBO.XoaBHYT(bh)) { MessageBox.Show("Xóa thành công"); } else { MessageBox.Show("Không thể xóa"); } } bindData(); }
private void btnLuu_Click(object sender, EventArgs e) { BHYT bh = getDataBHYT(); if (txtSoThe.Text == "" || txtTenChuThe.Text == "") { MessageBox.Show("Bạn cần nhập đủ thông tin"); } else { if (btnSua.Enabled == false) { if (bhytBO.kiemTraBHYT(txtSoThe.Text) == false) { if (bhytBO.ThemBHYT(bh)) { MessageBox.Show("Thêm thành công"); } else { MessageBox.Show("Lỗi nhập dữ liệu"); } } else { MessageBox.Show("Đã có bảo hiểm " + txtSoThe.Text + " trong hệ thống"); } } else { if (bhytBO.SuaBHYT(bh)) { MessageBox.Show("Sửa thành công"); } else { MessageBox.Show("Không thể sửa thông tin"); } } } bindData(); btnSua.Enabled = true; }