private void btnXoa_Click(object sender, EventArgs e) { try { int idbh = Convert.ToInt32(grvBaoHiemYT.GetFocusedDataRow()["BAOHIEMYTEID"].ToString()); if (BaoHiemYTeDAO.DeleteBaoHiemYTe(idbh) == 1) { MessageBox.Show("Thành công"); } else { MessageBox.Show("Thất bại"); } } catch { return; } LoadBaoHiemYTe(); }
private void btnThem_Click(object sender, EventArgs e) { try { int idnv = (int)cboNhanVien.SelectedValue; string sothe = txbSoThe.Text; DateTime ngaynop = dtpNgayNop.DateTime; if (BaoHiemYTeDAO.InsertBaoHiemYTe(idnv, sothe, ngaynop) == 1) { MessageBox.Show("Thành công"); } else { MessageBox.Show("Thất bại"); } } catch { return; } LoadBaoHiemYTe(); }
private void btnSua_Click(object sender, EventArgs e) { try { int idbh = Convert.ToInt32(grvBaoHiemYT.GetFocusedDataRow()["BAOHIEMYTEID"].ToString()); int idnv = (int)cboNhanVien.SelectedValue; string sothe = txbSoThe.Text; DateTime ngaynop = dtpNgayNop.DateTime; if (BaoHiemYTeDAO.UpdateBaoHiemYTe(idbh, idnv, sothe, ngaynop) == 1) { MessageBox.Show("Thành công"); } else { MessageBox.Show("Thất bại"); } } catch { return; } LoadBaoHiemYTe(); }
void LoadBaoHiemYTe() { list.DataSource = BaoHiemYTeDAO.LoadBaoHiemYTe(); }