private void s_Click(object sender, EventArgs e) { string macn, tencn; macn = txtmnganh.Text; tencn = txttennganh.Text; Chuyennganh cn = new Chuyennganh(macn, tencn); try { int i = new ChuyennganhBUS().Suachuyennganh(cn); if (i == -2) { throw new Exception(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } dgvcn.DataSource = getchuyennganh(); txtmnganh.Clear(); txttennganh.Clear(); loadCN(); }
public List <Chuyennganh> getchuyennganh() { try { string sql = "select * from ChuyenNganh"; ChuyennganhBUS cn = new ChuyennganhBUS(); return(cn.getchuyennganh(sql)); } catch (Exception ex) { throw ex; } }
private void btxoacn_Click(object sender, EventArgs e) { try { string manganh = txtmnganh.Text.Trim(); int i = new ChuyennganhBUS().xoachuyennganh(manganh); txtmnganh.Clear(); txttennganh.Clear(); loadCN(); } catch (Exception ex) { throw ex; } }
private void btaddcn_Click(object sender, EventArgs e) { try { string manganh, tennganh; manganh = txtmnganh.Text; tennganh = txttennganh.Text; Chuyennganh cn = new Chuyennganh(manganh, tennganh); int i = new ChuyennganhBUS().Addchuyennganh(cn); } catch (Exception ex) { MessageBox.Show(ex.Message); } txtmnganh.Clear(); txttennganh.Clear(); loadCN(); }