private void btnThemDiem_Click(object sender, EventArgs e) { if (txtMaDiem.Text != "" && txtMaHS.Text != "" && txtMonHoc.Text != "" && txtNamHoc.Text != "" && cbbHocKy.Text != "") { DiemTKCN d = new DiemTKCN(txtMaDiem.Text, null); if (cd.XoadiemTKCNCTHS(d)) { MessageBox.Show("Xóa thành công"); } } else { MessageBox.Show("Vui lòng nhập đầy đủ thông tin"); } }
private void btnThemDiem_Click(object sender, EventArgs e) { DiemTKCN d = new DiemTKCN(txtMaDiem.Text, null); NamHoc n = new NamHoc(null, txtNamHoc.Text); HocSinh h = new HocSinh(txtMaHS.Text, null, null, DateTime.MinValue, null, null, null, null, null, null, null); if (txtMaHS.Text != "" && txtNamHoc.Text != "" && txtMaDiem.Text != "") { if (cd.themdiemTKCNCTHS(d, h, n)) { MessageBox.Show("Thêm thành công"); dgvHienThiCT.DataSource = cd.hienthiDiemTKCNCTHS(n, h); } } else { MessageBox.Show("vui lòng nhập đầy đủ thông tin"); } }
public bool XoadiemTKCNCTHS(DiemTKCN d) { try { conn.Open(); string SQL = string.Format("delete from DIEM_TKCN where MADIEM_TKCN = '" + d.MaDiem + "'"); SqlCommand cmd = new SqlCommand(SQL, conn); int kq = (int)cmd.ExecuteNonQuery(); if (kq > 0) { return(true); } } catch { } finally { conn.Close(); } return(false); }
public bool themdiemTKCNCTHS(DiemTKCN d, HocSinh h, NamHoc n) { try { conn.Open(); string SQL = string.Format("exec themdiemTKCNCTHS '" + d.MaDiem + "', '" + h.Mahs + "', N'" + n.TenNH + "'"); SqlCommand cmd = new SqlCommand(SQL, conn); int kq = (int)cmd.ExecuteNonQuery(); if (kq > 0) { return(true); } } catch { } finally { conn.Close(); } return(false); }
public bool themdiemTKCNCTHS(DiemTKCN d, HocSinh h, NamHoc n) { return(cnd.themdiemTKCNCTHS(d, h, n)); }
public bool XoadiemTKCNCTHS(DiemTKCN d) { return(cnd.XoadiemTKCNCTHS(d)); }