private void btSua_Click(object sender, EventArgs e) { SinhVienClass sv = new SinhVienClass(tbMaSinhVien.Text, tbHoTen.Text , Convert.ToDateTime(dtpNgaySinh.Text), cbbLop.Text); SinhVienDAO dao = new SinhVienDAO(); dao.Sua(sv); SinhVien_Load(sender, e); }
private void btXoa_Click(object sender, EventArgs e) { SinhVienClass sv = new SinhVienClass(); sv.MaSinhVien = tbMaSinhVien.Text; SinhVienDAO dao = new SinhVienDAO(); dao.Xoa(sv); SinhVien_Load(sender, e); }
private void SinhVien_Load(object sender, EventArgs e) { listView1.Items.Clear(); SinhVienDAO dao = new SinhVienDAO(); List <SinhVienClass> listSV = dao.Load(); foreach (var item in listSV) { ListViewItem it = new ListViewItem(item.MaSinhVien); it.SubItems.Add(item.HoTen); it.SubItems.Add(item.NgaySinh.ToShortDateString()); it.SubItems.Add(item.Lop); listView1.Items.Add(it); } }
private void btSearch_Click(object sender, EventArgs e) { SinhVienDAO dao = new SinhVienDAO(); var list = dao.Search(tbSearch.Text); listView1.Items.Clear(); foreach (var item in list) { ListViewItem it = new ListViewItem(item.MaSinhVien); it.SubItems.Add(item.HoTen); it.SubItems.Add(item.NgaySinh.ToShortDateString()); it.SubItems.Add(item.Lop); listView1.Items.Add(it); } }