protected void btnThem_Click(object sender, EventArgs e) { dv = LayDuLieuTuForm(); cn = new chucnang(); bool exist = cn.CheckMaDonVi(dv.MaDonVi); if (exist) { lblThongBao.Text = "Tác Giả này đã có"; } else { bool result = cn.InsertDonVi(dv); if (result) { lblThongBao.Text = "Thêm thành công"; DoDuLieuVaoGridView(); XoaNoiDung(Page); } else { lblThongBao.Text = "Có lỗi"; } } }
protected void btnThem_Click(object sender, EventArgs e) { tg = LayDuLieuTuForm(); cn = new chucnang(); bool exist = cn.CheckMaTacGia(tg.MaTacGia); if (exist) { lblThongBao.Text = "Tác Giả này đã có"; } else { bool result = cn.InsertTacGia(tg); if (result) { lblThongBao.Text = "Thêm thành công"; DoDuLieuVaoGridView(); } else { lblThongBao.Text = "Có lỗi"; } } }
protected void btnDangKy_Click(object sender, EventArgs e) { sv = LayDuLieuTuForm(); cn = new chucnang(); bool exist = cn.CheckMaSinhVien(sv.MaSinhVien); if (exist) { lblThongBao.Text = "Tác Giả này đã có"; } else { bool result = cn.InsertSinhVien(sv); if (result) { lblThongBao.Text = "Thêm thành công"; XoaNoiDung(Page); } else { lblThongBao.Text = "Có lỗi"; } } }