示例#1
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            LopBUL lp               = new LopBUL();
            string MaLop            = txtbMaLop.Text;
            string TenLop           = txtbTenLop.Text;
            string NienKhoa         = txtbNienKhoa.Text;
            int    SiSo             = int.Parse(txtbSiSo.Text);
            string GiaoVienChuNhiem = (string)cbGiaoVienChuNhiem.SelectedValue;

            lp.Sua(MaLop, TenLop, NienKhoa, SiSo, GiaoVienChuNhiem);
            dgvLop.DataSource = myLop.LayDsLop();
        }
示例#2
0
 private void lưuToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (btnThem.Enabled == false)
     {
         LopBUL lp               = new LopBUL();
         string MaLop            = txtbMaLop.Text;
         string TenLop           = txtbTenLop.Text;
         string NienKhoa         = txtbNienKhoa.Text;
         int    SiSo             = int.Parse(txtbSiSo.Text);
         string GiaoVienChuNhiem = (string)cbGiaoVienChuNhiem.SelectedValue;
         lp.Them(MaLop, TenLop, NienKhoa, SiSo, GiaoVienChuNhiem);
         dgvLop.DataSource = myLop.LayDsLop();
         btnThem.Enabled   = true;
     }
     if (btnSua.Enabled == false)
     {
         LopBUL lp               = new LopBUL();
         string MaLop            = txtbMaLop.Text;
         string TenLop           = txtbTenLop.Text;
         string NienKhoa         = txtbNienKhoa.Text;
         int    SiSo             = int.Parse(txtbSiSo.Text);
         string GiaoVienChuNhiem = (string)cbGiaoVienChuNhiem.SelectedValue;
         lp.Sua(MaLop, TenLop, NienKhoa, SiSo, GiaoVienChuNhiem);
         dgvLop.DataSource = myLop.LayDsLop();
         btnSua.Enabled    = true;
     }
     if (btnXoa.Enabled == false)
     {
         try
         {
             LopBUL lop   = new LopBUL();
             string MaLop = txtbMaLop.Text;
             lop.Xoa(MaLop);
         }
         catch (Exception)
         {
             MessageBox.Show("Xóa thông tin  không hợp lệ!!!");
         }
         DialogResult dlr = MessageBox.Show("Thông báo xác nhận xóa",
                                            "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dlr == DialogResult.No)
         {
         }
         if (dlr == DialogResult.Yes)
         {
             dgvLop.DataSource = myLop.LayDsLop();
             ClearLop();
             btnXoa.Enabled = true;
         }
     }
 }