private void btn_show_Click(object sender, EventArgs e) { try { BLL_SV bll_sv = new BLL_SV(); dataGridView1.DataSource = bll_sv.Show(); }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_delete_Click(object sender, EventArgs e) { try { BLL_SV bll_sv = new BLL_SV(); int index = dataGridView1.CurrentCell.RowIndex; string id = dataGridView1.Rows[index].Cells["MSSV"].Value.ToString(); bll_sv.Delete(id); dataGridView1.DataSource = bll_sv.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Add_Click(object sender, EventArgs e) { try { BLL_SV bll_sv = new BLL_SV(); SinhVien sv = new SinhVien() { MSSV = txt_MSSV.Text, Name = txt_SV.Text, ID_Khoa = txt_ID_Khoa.Text, }; bll_sv.Add(sv); dataGridView1.DataSource = bll_sv.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Update_Click(object sender, EventArgs e) { try { BLL_SV bll_sv = new BLL_SV(); SinhVien sv = new SinhVien() { Name = txt_SV.Text, ID_Khoa = txt_ID_Khoa.Text, }; int index = dataGridView1.CurrentCell.RowIndex; string id = dataGridView1.Rows[index].Cells["MSSV"].Value.ToString(); bll_sv.Update(id, sv); dataGridView1.DataSource = bll_sv.Show(); }catch (Exception ex) { MessageBox.Show(ex.Message); } }