Ejemplo n.º 1
0
 private void btnXoaPH_Click(object sender, EventArgs e)
 {
     if (btnXoaPH.Enabled == true)
     {
         string       err = null;
         DialogResult r   = MessageBox.Show(null, "Bạn có chắc xóa phòng " + txtTenPH.Text + " không!", "Cân nhắc", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             try
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 PhongHoc ph = new PhongHoc();
                 ph.MaPH            = Int32.Parse(txtMaPH.Text);
                 et.Entry(ph).State = EntityState.Deleted;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Lỗi " + ex.Message);
             }
             QLPhongHoc_Load(sender, e);
         }
     }
 }
Ejemplo n.º 2
0
 private void btnXoaBan_Click(object sender, EventArgs e)
 {
     if (btnXoaBan.Enabled == true)
     {
         DialogResult r = MessageBox.Show(null, "Bạn có chắc xóa ban " + txtTenBan.Text + " không!", "Cân nhắc", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             try
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Ban bdel = new Ban();
                 bdel.MaBan           = Int32.Parse(txtMaBan.Text);
                 bdel.TenBan          = txtTenBan.Text;
                 et.Entry(bdel).State = EntityState.Deleted;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
                 QLBan_Load(sender, e);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Xóa lỗi! Lỗi " + ex.Message);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void btnXoaGV_Click(object sender, EventArgs e)
 {
     if (btnXoaGV.Enabled == true)
     {
         string       err = null;
         DialogResult r   = MessageBox.Show(null, "Bạn có chắc xóa giáo viên " + txtTenGV.Text + " không!", "Cân nhắc", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             try
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 GiaoVien gv = new GiaoVien();
                 gv.MaGV            = Int32.Parse(txtMaGV.Text);
                 gv.TenGV           = txtTenGV.Text;
                 et.Entry(gv).State = EntityState.Deleted;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
                 QLGiaoVien_Load(sender, e);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Lỗi " + ex.Message);
             }
         }
     }
 }
Ejemplo n.º 4
0
 private void btnReload_Click(object sender, EventArgs e)
 {
     if (k == 1)
     {
         try
         {
             if (t == 1)
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 GiaoVien gv = new GiaoVien();
                 gv.MaGV            = Int32.Parse(txtMaGV.Text);
                 gv.TenGV           = txtTenGV.Text;
                 gv.GioiTinh        = txtGioiTinh.Text;
                 gv.SDT             = txtSDT.Text;
                 gv.ChucVu          = txtChucVu.Text;
                 gv.Email           = txtEmail.Text;
                 gv.MaBM            = Int32.Parse(txtMaBM.Text);
                 et.Entry(gv).State = EntityState.Added;
                 et.SaveChanges();
                 MessageBox.Show("Thêm thành công!");
             }
             else
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 GiaoVien gv = new GiaoVien();
                 gv.MaGV            = Int32.Parse(txtMaGV.Text);
                 gv.TenGV           = txtTenGV.Text;
                 gv.GioiTinh        = txtGioiTinh.Text;
                 gv.SDT             = txtSDT.Text;
                 gv.ChucVu          = txtChucVu.Text;
                 gv.Email           = txtEmail.Text;
                 gv.MaBM            = Int32.Parse(txtMaBM.Text);
                 et.Entry(gv).State = EntityState.Modified;
                 et.SaveChanges();
                 MessageBox.Show("Sửa thành công!");
             }
             QLGiaoVien_Load(sender, e);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Lỗi " + ex.Message);
         }
     }
     else
     {
         QLGiaoVien_Load(sender, e);
     }
 }
Ejemplo n.º 5
0
 private void btnXoaBM_Click(object sender, EventArgs e)
 {
     if (btnXoaBM.Enabled == true)
     {
         DialogResult r = MessageBox.Show(null, "Bạn có chắc xóa bộ môn " + txtTenBM.Text + " không!", "Cân nhắc", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
             BoMon bmdel = new BoMon();
             bmdel.MaBM            = Int32.Parse(txtMaBM.Text);
             et.Entry(bmdel).State = EntityState.Deleted;
             et.SaveChanges();
             MessageBox.Show("Đã xóa!");
             QLBoMon_Load(sender, e);
         }
     }
 }
Ejemplo n.º 6
0
 private void btnReload_Click(object sender, EventArgs e)
 {
     if (k == 1)
     {
         try
         {
             if (t == 1)
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Lop lop = new Lop();
                 lop.MaLop           = Int32.Parse(txtMaLH.Text);
                 lop.TenLop          = txtTenLH.Text;
                 lop.SoHocSinh       = Int32.Parse(txtSoHS.Text);
                 lop.MaBan           = Int32.Parse(txtMaBan.Text);
                 et.Entry(lop).State = EntityState.Added;
                 et.SaveChanges();
                 MessageBox.Show("Thêm thành công!");
             }
             else
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Lop lop = new Lop();
                 lop.MaLop           = Int32.Parse(txtMaLH.Text);
                 lop.TenLop          = txtTenLH.Text;
                 lop.SoHocSinh       = Int32.Parse(txtSoHS.Text);
                 lop.MaBan           = Int32.Parse(txtMaBan.Text);
                 et.Entry(lop).State = EntityState.Modified;
                 et.SaveChanges();
                 MessageBox.Show("Sửa thành công!");
             }
             QLLop_Load(sender, e);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Lỗi " + ex.Message);
         }
     }
     else
     {
         QLLop_Load(sender, e);
     }
 }
Ejemplo n.º 7
0
 private void btnReload_Click(object sender, EventArgs e)
 {
     if (k == 1)
     {
         try
         {
             if (t == 1)
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 PhongHoc ph = new PhongHoc();
                 ph.MaPH            = Int32.Parse(txtMaPH.Text);
                 ph.TenPH           = txtTenPH.Text;
                 ph.DungLuong       = Int32.Parse(txtDungLuong.Text);
                 et.Entry(ph).State = EntityState.Added;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
             }
             else
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 PhongHoc ph = new PhongHoc();
                 ph.MaPH            = Int32.Parse(txtMaPH.Text);
                 ph.TenPH           = txtTenPH.Text;
                 ph.DungLuong       = Int32.Parse(txtDungLuong.Text);
                 et.Entry(ph).State = EntityState.Modified;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Lỗi " + ex.Message);
         }
         QLPhongHoc_Load(sender, e);
     }
     else
     {
         QLPhongHoc_Load(sender, e);
     }
 }
Ejemplo n.º 8
0
 private void btnReload_Click(object sender, EventArgs e)
 {
     if (k == 1)
     {
         try
         {
             if (t == 1)
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Ban b = new Ban();
                 b.MaBan           = Int32.Parse(txtMaBan.Text);
                 b.TenBan          = txtTenBan.Text;
                 et.Entry(b).State = EntityState.Added;
                 et.SaveChanges();
                 MessageBox.Show("Thêm thành công!");
             }
             else
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Ban bnew = new Ban();
                 bnew.MaBan           = Int32.Parse(txtMaBan.Text);
                 bnew.TenBan          = txtTenBan.Text;
                 et.Entry(bnew).State = EntityState.Modified;
                 et.SaveChanges();
                 MessageBox.Show("Sửa thành công!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Lỗi " + ex.Message);
         }
         QLBan_Load(sender, e);
     }
     else
     {
         QLBan_Load(sender, e);
     }
 }
Ejemplo n.º 9
0
 private void btnXoaLop_Click(object sender, EventArgs e)
 {
     if (btnXoaLop.Enabled == true)
     {
         DialogResult r = MessageBox.Show(null, "Bạn có chắc xóa lớp " + txtTenLH.Text + " không!", "Cân nhắc", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             try
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 Lop lop = new Lop();
                 lop.MaLop           = Int32.Parse(txtMaLH.Text);
                 et.Entry(lop).State = EntityState.Deleted;
                 et.SaveChanges();
                 MessageBox.Show("Đã xóa!");
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Lỗi " + ex.Message);
             }
             QLLop_Load(sender, e);
         }
     }
 }
Ejemplo n.º 10
0
 private void btnReload_Click(object sender, EventArgs e)
 {
     if (k == 1)
     {
         try
         {
             if (t == 1)
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 MonHoc mh = new MonHoc();
                 mh.MaMH            = Int32.Parse(txtMaMH.Text);
                 mh.TenMH           = txtTenMH.Text;
                 et.Entry(mh).State = EntityState.Added;
                 et.SaveChanges();
             }
             else
             {
                 XepThoiKhoaBieuEntities et = new XepThoiKhoaBieuEntities();
                 MonHoc mh = new MonHoc();
                 mh.MaMH            = Int32.Parse(txtMaMH.Text);
                 mh.TenMH           = txtTenMH.Text;
                 et.Entry(mh).State = EntityState.Modified;
                 et.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Lỗi " + ex.Message);
         }
         QLMonHoc_Load(sender, e);
     }
     else
     {
         QLMonHoc_Load(sender, e);
     }
 }