Esempio n. 1
0
        // GET: Admin/QLHocVien
        public ActionResult Index()
        {
            var dao   = new HocVienDAO();
            var model = dao.FindAll();

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Tim(string tim)
        {
            var dao   = new HocVienDAO();
            var model = dao.Tim(tim);

            return(View("Index", model));
        }
Esempio n. 3
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (Common.Acc_type == "Root" || Common.Acc_type == "Admin")
     {
         long id = Convert.ToInt32(grvHocVien.GetFocusedRowCellValue("ID").ToString());
         if (MessageBox.Show("Bạn muốn xóa học viên " + grvHocVien.GetFocusedRowCellValue("Ten").ToString() + " khỏi CSDL?", "Xóa học viên", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             var res = new HocVienDAO().Delete(id);
             if (res)
             {
                 MessageBox.Show("Xóa thành công !", "Xóa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 ReloadTable();
                 return;
             }
             else
             {
                 MessageBox.Show("Có lỗi xảy ra ! Vui lòng thử lại !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 ReloadTable();
                 return;
             }
         }
     }
     else
     {
         MessageBox.Show("Bạn không có quyền thực hiện tác vụ này");
     }
 }
        // GET: HocVien/Info

        public ActionResult Index()
        {
            var dao = new HocVienDAO();

            global::Models.Framework.HocVien model = dao.FindByTDN(User.Identity.Name);

            return(View(model));
        }
Esempio n. 5
0
        public ActionResult ChitietbaitapSubmit(List <TraLoi> tralois, HttpPostedFileBase file, int idbt)
        {
            var      hv      = new HocVienDAO().FindByTDN(User.Identity.Name);
            DateTime now     = DateTime.Now;
            DateTime tsubmit = DateTime.Parse(Session[idbt.ToString()].ToString());
            double   phut    = tsubmit.Subtract(now).TotalMinutes;

            if (file != null && file.ContentLength > 0)
            {
                var    dao       = new fileTraLoiDAO();
                string _FileName = Path.GetFileName(file.FileName);
                string path      = "Content/Data/traloi/hv" + hv.id + "/bt" + idbt + "/";
                string _path     = Path.Combine(Server.MapPath("~/" + path), _FileName);
                Directory.CreateDirectory(Path.Combine(Server.MapPath("~/" + path)));
                file.SaveAs(_path);
                int fileSize = file.ContentLength;
                int Size     = fileSize / 1000000;
                var filetl   = new fileTraLoi();
                filetl.ten       = _FileName;
                filetl.FileSize  = Size;
                filetl.link      = "~/" + _FileName;
                filetl.idBT      = idbt;
                filetl.thoiGian  = DateTime.Now;
                filetl.idHV      = hv.id;
                filetl.trangThai = 1;           //0:dong 1:mo
                filetl.tgLamBai  = Convert.ToInt32(phut);
                dao.Insert(filetl);
            }
            //else
            //{
            //    var dao = new fileTraLoiDAO();

            //    var filetl = new fileTraLoi();
            //    filetl.idBT = idbt;
            //    filetl.thoiGian = DateTime.Now;
            //    filetl.idHV = hv.id;
            //    filetl.trangThai = 1;           //0:dong 1:mo
            //    dao.Insert(filetl);
            //}
            var daotl = new TraLoiDAO();

            foreach (var item in tralois)
            {
                var tl = new TraLoi();
                tl.idCauHoi = item.idCauHoi;
                tl.DapAn    = item.DapAn;
                tl.idHV     = hv.id;
                tl.thoiGian = DateTime.Now;
                tl.tgLamBai = Convert.ToInt32(phut);
                daotl.Insert(tl);
            }
            TempData["testmsg"] = "Nộp bài thành công.";
            Session.Clear();
            return(RedirectToAction("Chitietbaitap", "Learning", new { idbt = idbt }));
            //return RedirectToAction("Index", "Learning");
        }
Esempio n. 6
0
 public ActionResult Lock(int id)
 {
     if (ModelState.IsValid)
     {
         var  dao = new HocVienDAO();
         bool kt  = dao.Khoa(id);
         if (kt)
         {
             ModelState.AddModelError("", "Khóa thành công");
         }
         else
         {
             ModelState.AddModelError("", "khóa không thành công");
         }
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Edit(global::Models.Framework.HocVien hv)
        {
            var dao = new HocVienDAO();

            try
            {
                dao.Update(hv, User.Identity.Name);
                TempData["testmsg"] = " Cập nhật thành công ";

                return(RedirectToAction("Index", "Info"));
            }
            catch (Exception e)
            {
                TempData["testmsg"] = "Có lỗi trong quá trình cập nhật: " + e.Message.ToString();
            }
            return(View("Index"));
        }
 public ActionResult DKHocVien(HocVien hocVien, TaiKhoan taiKhoan)
 {
     if (ModelState.IsValid)
     {
         var daoHV = new HocVienDAO();
         var daoTK = new TaiKhoanDAO();
         taiKhoan.ngayDangKy = DateTime.Now;
         int idtk = daoTK.Insert(taiKhoan);
         int idhv = daoHV.Insert(hocVien);
         if (idhv > 0)
         {
             ModelState.AddModelError("", "Đăng ký học viên thành công");
         }
         else
         {
             return(RedirectToAction("DKHocVien", "DangKy"));
         }
     }
     return(View("DKHocVien"));
 }
Esempio n. 9
0
 private void btn_Sua_Click(object sender, EventArgs e)
 {
     if (Common.Acc_type == "Root" || Common.Acc_type == "Admin")
     {
         if (btn_Sua.Text == "Sửa")
         {
             gridColumn6.OptionsColumn.ReadOnly = false;
             btn_Sua.Text = "Lưu";
             MessageBox.Show("Bạn có thể sửa thành tích học viên trong bảng !", "Sửa thành tích", MessageBoxButtons.OK, MessageBoxIcon.Information);
             btn_Huy_In.Text = "Hủy";
         }
         else
         {
             btn_Sua.Text    = "Sửa";
             btn_Huy_In.Text = "In kết quả";
             gridColumn6.OptionsColumn.ReadOnly = true;
             HocVien_TheLuc temp = new HocVien_TheLuc();
             temp.HocVienID = Convert.ToInt32(grvDSHocVien.GetFocusedRowCellValue("ID").ToString());
             temp.Nam       = Convert.ToInt16(comboBox2.Text);
             temp.Quy       = comboBox1.Text;
             HocVienDAO dao = new HocVienDAO();
             foreach (var item in list_KQTL)
             {
                 temp.MonTheLucID = item.MonTheLucID;
                 if (item.ThanhTich < 0)
                 {
                     MessageBox.Show("Bạn không thể nhập thành tích < 0 !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Hand); continue;
                 }
                 temp.KetQua = item.ThanhTich;
                 dao.EditTheLuc(temp);
             }
             MessageBox.Show("Cập nhật thành công !", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LoadDataKQTheLuc();
         }
     }
     else
     {
         MessageBox.Show("Bạn không có quyền thực hiện tác vụ này");
     }
 }
Esempio n. 10
0
        public ActionResult InfoGV(int idgv, int rating = 0, string nhanxet = null, int idlh = 0)
        {
            if (idlh == 0)
            {
                TempData["testmsg"] = "Giáo viên này chưa có lớp học nào hoàng thành.";
                return(RedirectToAction("InfoGV/" + idgv, "Tim"));;
            }
            if (rating == 0)
            {
                TempData["testmsg"] = "Vui lòng chọn điểm đánh giá .";
                return(RedirectToAction("InfoGV/" + idgv, "Tim"));;
            }
            if (nhanxet == null)
            {
                TempData["testmsg"] = "Vui lòng cho vài lời nhận xét.";
                return(RedirectToAction("InfoGV/" + idgv, "Tim"));;
            }
            var hv   = new HocVienDAO().FindByTDN(User.Identity.Name);
            var lh   = new LopHocDAO().GetByID(idlh);
            var dslh = lh.DSLopHocs.FirstOrDefault(x => x.HocVien.TaiKhoan.tenDangNhap == User.Identity.Name && x.idLH == idlh);

            if (dslh == null)
            {
                TempData["testmsg"] = "Bạn hãy hoành thành lớp học " + lh.tenLopHoc + " của giáo viên để có thể đánh giá.";
                return(RedirectToAction("InfoGV/" + idgv, "Tim"));;
            }
            if (!string.IsNullOrEmpty(dslh.danhgia.ToString()))
            {
                TempData["testmsg"] = "Bạn đã đánh giá & nhận xét rồi.";
                return(RedirectToAction("InfoGV/" + idgv, "Tim"));;
            }
            dslh.danhgia     = rating;
            dslh.binhluan    = nhanxet;
            dslh.ngayDanhGia = DateTime.Now;
            bool kt = new DSLopHocDAO().Update(dslh);

            TempData["testmsg"] = "Đánh giá & nhận xét thành công .";
            return(RedirectToAction("InfoGV/" + idgv, "Tim"));
        }
Esempio n. 11
0
 private void btn_Sua_Click(object sender, EventArgs e)
 {
     if (Common.Acc_type == "Root" || Common.Acc_type == "Admin")
     {
         if (btn_Sua.Text == "Sửa")
         {
             gridColumn5.OptionsColumn.ReadOnly = false;
             btn_Sua.Text = "Lưu";
             MessageBox.Show("Bạn có thể sửa điểm học viên trong bảng !", "Sửa điểm", MessageBoxButtons.OK, MessageBoxIcon.Information);
             btn_Huy_In.Text = "Hủy";
         }
         else
         {
             btn_Sua.Text    = "Sửa";
             btn_Huy_In.Text = "In kết quả";
             gridColumn5.OptionsColumn.ReadOnly = true;
             HocVien_MonHoc temp = new HocVien_MonHoc();
             temp.HocVienID = Convert.ToInt32(grvDSHocVien.GetFocusedRowCellValue("ID").ToString());
             HocVienDAO dao = new HocVienDAO();
             foreach (var item in list_Diem)
             {
                 temp.MonHocID = item.MonHocID;
                 if (item.KetQua < 0 || item.KetQua > 10)
                 {
                     MessageBox.Show("Bạn không thể nhập điểm < 0 hoặc > 10 !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Hand); continue;
                 }
                 temp.Diem = item.KetQua;
                 dao.EditDiem(temp);
             }
             MessageBox.Show("Cập nhật thành công !", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LoadDataDiem();
         }
     }
     else
     {
         MessageBox.Show("Bạn không có quyền thực hiện tác vụ này");
     }
 }
Esempio n. 12
0
        public ActionResult Chitietbaitap(int idbt)
        {
            var dao   = new BaiTapDAO();
            var model = dao.GetByID(idbt);

            ViewBag.CountSubmit = dao.CountSubmit(idbt);
            var hv = new HocVienDAO().FindByTDN(User.Identity.Name);

            ViewBag.hv = hv;
            List <TraLoi> tralois = new List <TraLoi>();

            foreach (var i in model.CauHois)
            {
                var tl = new TraLoi();
                tl.CauHoi   = i;
                tl.idCauHoi = i.ID;
                tl.HocVien  = hv;
                tl.idHV     = hv.id;
                tralois.Add(tl);
            }
            ViewBag.tralois = tralois;
            string   d = null;
            DateTime timenop;
            int      timeLam = 0;

            if (hv.fileTraLois.Where(x => x.idBT == idbt).Count() > 0 || hv.TraLois.Where(x => x.CauHoi.idBT == idbt).Count() > 0)
            {
                d = new TraLoiDAO().Diem(idbt, hv.id);
                try
                {
                    timenop         = hv.fileTraLois.Where(x => x.idBT == idbt).FirstOrDefault().thoiGian;
                    ViewBag.timenop = timenop;
                    timeLam         = Convert.ToInt32(hv.fileTraLois.Where(x => x.idBT == idbt).FirstOrDefault().tgLamBai);
                    ViewBag.timeLam = timeLam;
                }
                catch
                {
                    timenop         = hv.TraLois.Where(x => x.CauHoi.idBT == idbt).FirstOrDefault().thoiGian;
                    ViewBag.timenop = timenop;
                    timeLam         = Convert.ToInt32(hv.TraLois.Where(x => x.CauHoi.idBT == idbt).FirstOrDefault().tgLamBai);
                    ViewBag.timeLam = timeLam;
                }
            }
            ViewBag.diem    = d;
            ViewBag.timeLam = timeLam;
            if (string.IsNullOrEmpty(Session[idbt.ToString()] as string))
            {
                try
                {
                    DateTime dt = DateTime.Now.AddMinutes(double.Parse(model.thoiGianLamBai.ToString()));
                    Session[idbt.ToString()] = dt.ToString();
                }
                catch
                {
                    Session[idbt.ToString()] = "";
                }
            }

            string ttt = Session[idbt.ToString()].ToString();

            return(View("Chitietbaitap", model));
        }
Esempio n. 13
0
 private void btn_Luu_Click(object sender, EventArgs e)
 {
     if (Common.Acc_type == "Root" || Common.Acc_type == "Admin")
     {
         if (txt_HoTen.Text == "")
         {
             MessageBox.Show("Nhập họ và tên", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (txt_QueQuan.Text == "")
         {
             MessageBox.Show("Nhập quê quán", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (txt_NoiSinh.Text == "")
         {
             MessageBox.Show("Nhập nơi sinh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (txt_NoiO.Text == "")
         {
             MessageBox.Show("Nhập chỗ ở hiện nay", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (txt_CapBac.Text == "")
         {
             MessageBox.Show("Nhập cấp bậc", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (txt_ChucVu.Text == "")
         {
             MessageBox.Show("Nhập chức vụ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         hv.Ten         = txt_HoTen.Text;
         hv.NgaySinh    = dt_NgaySinh.Value;
         hv.QueQuan     = txt_QueQuan.Text;
         hv.NoiSinh     = txt_NoiSinh.Text;
         hv.DiaChi      = txt_NoiO.Text;
         hv.CapBac      = txt_CapBac.Text;
         hv.ChucVu      = txt_ChucVu.Text;
         hv.GioiTinh    = rb_Nam.Checked ? true : false;
         hv.NgayVaoDoan = dt_Doan.Value;
         hv.NgayVaoDang = dt_Dang.Value;
         hv.LopID       = Convert.ToInt32(cb_Lop.SelectedValue.ToString());
         hv.LopTruong   = cbox_LopTruong.Checked ? true : false;
         if (id.Equals(0))
         {
             var result = new HocVienDAO().Insert(hv);
             if (result)
             {
                 MessageBox.Show("Thêm thành công !", "Thêm học viên", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Có lỗi xảy ra ! Vui lòng thử lại !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
         else
         {
             var result = new HocVienDAO().Edit(hv);
             if (result)
             {
                 MessageBox.Show("Sửa thành công !", "Sửa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Có lỗi xảy ra ! Vui lòng thử lại !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
     }
     else
     {
         MessageBox.Show("Bạn không có quyền thực hiện tác vụ này");
     }
 }
        public ActionResult Index(TaiKhoan taiKhoan, string name, string diachi, string gioitinh, string ngaysinh, string email, string sdt, string optradio, int lvListening = -1, int lvSpeaking = -1, int lvReading = -1, int lvWriting = -1, bool lis = false, bool spe = false, bool rea = false, bool wri = false, bool agree = false)
        {
            if (ModelState.IsValid && agree)
            {
                if (optradio == "GiaoVien")
                {
                    var       dao     = new GiangVienDAO();
                    Giangvien gv      = new Giangvien();
                    var       md5pass = EncryptorMD5.MD5Hash(taiKhoan.matKhau);
                    taiKhoan.matKhau   = md5pass;
                    taiKhoan.trangThai = 1;
                    var quyen = new TAIKHOAN_NHOMQUYEN();
                    quyen.TaiKhoan    = taiKhoan;
                    quyen.IDNHOMQUYEN = 2; //2 là quyền giáo viên
                    taiKhoan.TAIKHOAN_NHOMQUYEN.Add(quyen);
                    gv.TaiKhoan         = taiKhoan;
                    gv.TaiKhoan.hovaten = name;
                    gv.diachi           = diachi;
                    gv.gioitinh         = gioitinh;
                    if (ngaysinh != "")
                    {
                        gv.ngaysinh = DateTime.Parse(ngaysinh);
                    }
                    gv.email = email;
                    gv.sdt   = sdt;


                    if (lis)
                    {
                        var kngv = new KyNangGiangVien();
                        kngv.idGV = gv.ID;
                        kngv.idKN = 1;
                        kngv.idCD = lvListening;
                        gv.KyNangGiangViens.Add(kngv);
                    }
                    if (spe)
                    {
                        var kngv = new KyNangGiangVien();
                        kngv.idGV = gv.ID;
                        kngv.idKN = 2;
                        kngv.idCD = lvSpeaking;
                        gv.KyNangGiangViens.Add(kngv);
                    }
                    if (rea)
                    {
                        var kngv = new KyNangGiangVien();
                        kngv.idGV = gv.ID;
                        kngv.idKN = 3;
                        kngv.idCD = lvReading;
                        gv.KyNangGiangViens.Add(kngv);
                    }
                    if (wri)
                    {
                        var kngv = new KyNangGiangVien();
                        kngv.idGV = gv.ID;
                        kngv.idKN = 4;
                        kngv.idCD = lvWriting;
                        gv.KyNangGiangViens.Add(kngv);
                    }
                    try
                    {
                        dao.Insert(gv);
                        ModelState.AddModelError("", "Đăng ký giáo viên thành công");
                        return(RedirectToAction("DangKyThanhCong", "DangKy", gv.TaiKhoan));
                    }
                    catch (Exception e)
                    {
                        ModelState.AddModelError("", "Lỗi đăng ký giáo viên: " + e.ToString());
                    }
                }
                else
                if (optradio == "HocVien")
                {
                    var dao     = new HocVienDAO();
                    var hv      = new HocVien();
                    var md5pass = EncryptorMD5.MD5Hash(taiKhoan.matKhau);
                    taiKhoan.matKhau    = md5pass;
                    taiKhoan.trangThai  = 1;
                    taiKhoan.face       = -1;
                    taiKhoan.ngayDangKy = DateTime.Now;
                    var quyen = new TAIKHOAN_NHOMQUYEN();
                    quyen.TaiKhoan    = taiKhoan;
                    quyen.IDNHOMQUYEN = 3; //3 là quyền học viên
                    taiKhoan.TAIKHOAN_NHOMQUYEN.Add(quyen);
                    hv.TaiKhoan         = taiKhoan;
                    hv.TaiKhoan.hovaten = name;
                    hv.diachi           = diachi;
                    hv.gioitinh         = gioitinh;
                    if (ngaysinh != "")
                    {
                        hv.ngaysinh = DateTime.Parse(ngaysinh);
                    }
                    hv.email = email;
                    hv.sdt   = sdt;
                    try
                    {
                        dao.Insert(hv);
                        ModelState.AddModelError("", "Đăng ký học viên thành công");
                        return(RedirectToAction("DangKyThanhCong", "DangKy", hv.TaiKhoan));
                    }
                    catch (Exception e)
                    {
                        ModelState.AddModelError("", "Lỗi đăng ký học viên: " + e.Message);
                    }
                }
            }
            else
            {
                if (!agree)
                {
                    ModelState.AddModelError("", "Hãy chấp nhận các điều khoản của chúng tôi");
                }
                ModelState.AddModelError("", "Thông tin đăng ký không đúng yêu cầu");
            }
            return(View("Index"));
        }
Esempio n. 15
0
        public ActionResult DangKyLop(LopHoc lh)
        {
            var dao    = new DSLopHocDAO();
            var hv     = new HocVienDAO().FindByTDN(User.Identity.Name);
            var lophoc = new LopHocDAO().GetByID(lh.ID);

            if (lophoc.trangThai == 1)
            {
                TempData["testmsg"] = "Lớp học nãy đã Ngừng Tuyển Sinh, vui lòng đăng ký lơp học khác.";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            if (lophoc.trangThai == 2)
            {
                TempData["testmsg"] = "Lớp học nãy đã Bắt Đầu, vui lòng đăng ký lơp học khác.";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            if (lophoc.trangThai == 3)
            {
                TempData["testmsg"] = "Lớp học nãy đã Kết Thúc, vui lòng đăng ký lơp học khác.";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            if (dao.HocVienInLopHoc(hv.id, lophoc.ID))
            {
                TempData["testmsg"] = "Bạn đã đăng ký lớp học " + lophoc.tenLopHoc + " rồi.";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            var daoNgay = new NgayDAO();
            var lich    = daoNgay.FindByTDN(User.Identity.Name);
            var lichlop = daoNgay.FindByLopHoc(lophoc.ID);

            foreach (var item in lichlop)
            {
                foreach (var it in lich)
                {
                    if (item.nam == it.nam && it.Thang.iD == item.Thang.iD)
                    {
                        if (it.ngay1 != null && item.ngay1 != null)
                        {
                            if (int.Parse(it.ngay1.Split('-')[4]) < int.Parse(item.ngay1.Split('-')[6]) && int.Parse(it.ngay1.Split('-')[6]) > int.Parse(item.ngay1.Split('-')[4]) ||
                                int.Parse(it.ngay1.Split('-')[4]) == int.Parse(item.ngay1.Split('-')[6]) && int.Parse(it.ngay1.Split('-')[5]) < int.Parse(item.ngay1.Split('-')[7]) ||
                                int.Parse(it.ngay1.Split('-')[6]) == int.Parse(item.ngay1.Split('-')[4]) && int.Parse(it.ngay1.Split('-')[7]) > int.Parse(item.ngay1.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay1.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay2 != null && item.ngay2 != null)
                        {
                            if (int.Parse(it.ngay2.Split('-')[4]) < int.Parse(item.ngay2.Split('-')[6]) && int.Parse(it.ngay2.Split('-')[6]) > int.Parse(item.ngay2.Split('-')[4]) ||
                                int.Parse(it.ngay2.Split('-')[4]) == int.Parse(item.ngay2.Split('-')[6]) && int.Parse(it.ngay2.Split('-')[5]) < int.Parse(item.ngay2.Split('-')[7]) ||
                                int.Parse(it.ngay2.Split('-')[6]) == int.Parse(item.ngay2.Split('-')[4]) && int.Parse(it.ngay2.Split('-')[7]) > int.Parse(item.ngay2.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay2.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay3 != null && item.ngay3 != null)
                        {
                            if (int.Parse(it.ngay3.Split('-')[4]) < int.Parse(item.ngay3.Split('-')[6]) && int.Parse(it.ngay3.Split('-')[6]) > int.Parse(item.ngay3.Split('-')[4]) ||
                                int.Parse(it.ngay3.Split('-')[4]) == int.Parse(item.ngay3.Split('-')[6]) && int.Parse(it.ngay3.Split('-')[5]) < int.Parse(item.ngay3.Split('-')[7]) ||
                                int.Parse(it.ngay3.Split('-')[6]) == int.Parse(item.ngay3.Split('-')[4]) && int.Parse(it.ngay3.Split('-')[7]) > int.Parse(item.ngay3.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay3.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay4 != null && item.ngay4 != null)
                        {
                            if (int.Parse(it.ngay4.Split('-')[4]) < int.Parse(item.ngay4.Split('-')[6]) && int.Parse(it.ngay4.Split('-')[6]) > int.Parse(item.ngay4.Split('-')[4]) ||
                                int.Parse(it.ngay4.Split('-')[4]) == int.Parse(item.ngay4.Split('-')[6]) && int.Parse(it.ngay4.Split('-')[5]) < int.Parse(item.ngay4.Split('-')[7]) ||
                                int.Parse(it.ngay4.Split('-')[6]) == int.Parse(item.ngay4.Split('-')[4]) && int.Parse(it.ngay4.Split('-')[7]) > int.Parse(item.ngay4.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay4.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay5 != null && item.ngay5 != null)
                        {
                            if (int.Parse(it.ngay5.Split('-')[4]) < int.Parse(item.ngay5.Split('-')[6]) && int.Parse(it.ngay5.Split('-')[6]) > int.Parse(item.ngay5.Split('-')[4]) ||
                                int.Parse(it.ngay5.Split('-')[4]) == int.Parse(item.ngay5.Split('-')[6]) && int.Parse(it.ngay5.Split('-')[5]) < int.Parse(item.ngay5.Split('-')[7]) ||
                                int.Parse(it.ngay5.Split('-')[6]) == int.Parse(item.ngay5.Split('-')[4]) && int.Parse(it.ngay5.Split('-')[7]) > int.Parse(item.ngay5.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay5.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay6 != null && item.ngay6 != null)
                        {
                            if (int.Parse(it.ngay6.Split('-')[4]) < int.Parse(item.ngay6.Split('-')[6]) && int.Parse(it.ngay6.Split('-')[6]) > int.Parse(item.ngay6.Split('-')[4]) ||
                                int.Parse(it.ngay6.Split('-')[4]) == int.Parse(item.ngay6.Split('-')[6]) && int.Parse(it.ngay6.Split('-')[5]) < int.Parse(item.ngay6.Split('-')[7]) ||
                                int.Parse(it.ngay6.Split('-')[6]) == int.Parse(item.ngay6.Split('-')[4]) && int.Parse(it.ngay6.Split('-')[7]) > int.Parse(item.ngay6.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay6.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay7 != null && item.ngay7 != null)
                        {
                            if (int.Parse(it.ngay7.Split('-')[4]) < int.Parse(item.ngay7.Split('-')[6]) && int.Parse(it.ngay7.Split('-')[6]) > int.Parse(item.ngay7.Split('-')[4]) ||
                                int.Parse(it.ngay7.Split('-')[4]) == int.Parse(item.ngay7.Split('-')[6]) && int.Parse(it.ngay7.Split('-')[5]) < int.Parse(item.ngay7.Split('-')[7]) ||
                                int.Parse(it.ngay7.Split('-')[6]) == int.Parse(item.ngay7.Split('-')[4]) && int.Parse(it.ngay7.Split('-')[7]) > int.Parse(item.ngay7.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay7.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay8 != null && item.ngay8 != null)
                        {
                            if (int.Parse(it.ngay8.Split('-')[4]) < int.Parse(item.ngay8.Split('-')[6]) && int.Parse(it.ngay8.Split('-')[6]) > int.Parse(item.ngay8.Split('-')[4]) ||
                                int.Parse(it.ngay8.Split('-')[4]) == int.Parse(item.ngay8.Split('-')[6]) && int.Parse(it.ngay8.Split('-')[5]) < int.Parse(item.ngay8.Split('-')[7]) ||
                                int.Parse(it.ngay8.Split('-')[6]) == int.Parse(item.ngay8.Split('-')[4]) && int.Parse(it.ngay8.Split('-')[7]) > int.Parse(item.ngay8.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay8.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay9 != null && item.ngay9 != null)
                        {
                            if (int.Parse(it.ngay9.Split('-')[4]) < int.Parse(item.ngay9.Split('-')[6]) && int.Parse(it.ngay9.Split('-')[6]) > int.Parse(item.ngay9.Split('-')[4]) ||
                                int.Parse(it.ngay9.Split('-')[4]) == int.Parse(item.ngay9.Split('-')[6]) && int.Parse(it.ngay9.Split('-')[5]) < int.Parse(item.ngay9.Split('-')[7]) ||
                                int.Parse(it.ngay9.Split('-')[6]) == int.Parse(item.ngay9.Split('-')[4]) && int.Parse(it.ngay9.Split('-')[7]) > int.Parse(item.ngay9.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay9.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay10 != null && item.ngay10 != null)
                        {
                            if (int.Parse(it.ngay10.Split('-')[4]) < int.Parse(item.ngay10.Split('-')[6]) && int.Parse(it.ngay10.Split('-')[6]) > int.Parse(item.ngay10.Split('-')[4]) ||
                                int.Parse(it.ngay10.Split('-')[4]) == int.Parse(item.ngay10.Split('-')[6]) && int.Parse(it.ngay10.Split('-')[5]) < int.Parse(item.ngay10.Split('-')[7]) ||
                                int.Parse(it.ngay10.Split('-')[6]) == int.Parse(item.ngay10.Split('-')[4]) && int.Parse(it.ngay10.Split('-')[7]) > int.Parse(item.ngay10.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay10.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay11 != null && item.ngay11 != null)
                        {
                            if (int.Parse(it.ngay11.Split('-')[4]) < int.Parse(item.ngay11.Split('-')[6]) && int.Parse(it.ngay11.Split('-')[6]) > int.Parse(item.ngay11.Split('-')[4]) ||
                                int.Parse(it.ngay11.Split('-')[4]) == int.Parse(item.ngay11.Split('-')[6]) && int.Parse(it.ngay11.Split('-')[5]) < int.Parse(item.ngay11.Split('-')[7]) ||
                                int.Parse(it.ngay11.Split('-')[6]) == int.Parse(item.ngay11.Split('-')[4]) && int.Parse(it.ngay11.Split('-')[7]) > int.Parse(item.ngay11.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay11.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay12 != null && item.ngay12 != null)
                        {
                            if (int.Parse(it.ngay12.Split('-')[4]) < int.Parse(item.ngay12.Split('-')[6]) && int.Parse(it.ngay12.Split('-')[6]) > int.Parse(item.ngay12.Split('-')[4]) ||
                                int.Parse(it.ngay12.Split('-')[4]) == int.Parse(item.ngay12.Split('-')[6]) && int.Parse(it.ngay12.Split('-')[5]) < int.Parse(item.ngay12.Split('-')[7]) ||
                                int.Parse(it.ngay12.Split('-')[6]) == int.Parse(item.ngay12.Split('-')[4]) && int.Parse(it.ngay12.Split('-')[7]) > int.Parse(item.ngay12.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay12.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay13 != null && item.ngay13 != null)
                        {
                            if (int.Parse(it.ngay13.Split('-')[4]) < int.Parse(item.ngay13.Split('-')[6]) && int.Parse(it.ngay13.Split('-')[6]) > int.Parse(item.ngay13.Split('-')[4]) ||
                                int.Parse(it.ngay13.Split('-')[4]) == int.Parse(item.ngay13.Split('-')[6]) && int.Parse(it.ngay13.Split('-')[5]) < int.Parse(item.ngay13.Split('-')[7]) ||
                                int.Parse(it.ngay13.Split('-')[6]) == int.Parse(item.ngay13.Split('-')[4]) && int.Parse(it.ngay13.Split('-')[7]) > int.Parse(item.ngay13.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay13.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay14 != null && item.ngay14 != null)
                        {
                            if (int.Parse(it.ngay14.Split('-')[4]) < int.Parse(item.ngay14.Split('-')[6]) && int.Parse(it.ngay14.Split('-')[6]) > int.Parse(item.ngay14.Split('-')[4]) ||
                                int.Parse(it.ngay14.Split('-')[4]) == int.Parse(item.ngay14.Split('-')[6]) && int.Parse(it.ngay14.Split('-')[5]) < int.Parse(item.ngay14.Split('-')[7]) ||
                                int.Parse(it.ngay14.Split('-')[6]) == int.Parse(item.ngay14.Split('-')[4]) && int.Parse(it.ngay14.Split('-')[7]) > int.Parse(item.ngay14.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay14.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay15 != null && item.ngay15 != null)
                        {
                            if (int.Parse(it.ngay15.Split('-')[4]) < int.Parse(item.ngay15.Split('-')[6]) && int.Parse(it.ngay15.Split('-')[6]) > int.Parse(item.ngay15.Split('-')[4]) ||
                                int.Parse(it.ngay15.Split('-')[4]) == int.Parse(item.ngay15.Split('-')[6]) && int.Parse(it.ngay15.Split('-')[5]) < int.Parse(item.ngay15.Split('-')[7]) ||
                                int.Parse(it.ngay15.Split('-')[6]) == int.Parse(item.ngay15.Split('-')[4]) && int.Parse(it.ngay15.Split('-')[7]) > int.Parse(item.ngay15.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay15.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay16 != null && item.ngay16 != null)
                        {
                            if (int.Parse(it.ngay16.Split('-')[4]) < int.Parse(item.ngay16.Split('-')[6]) && int.Parse(it.ngay16.Split('-')[6]) > int.Parse(item.ngay16.Split('-')[4]) ||
                                int.Parse(it.ngay16.Split('-')[4]) == int.Parse(item.ngay16.Split('-')[6]) && int.Parse(it.ngay16.Split('-')[5]) < int.Parse(item.ngay16.Split('-')[7]) ||
                                int.Parse(it.ngay16.Split('-')[6]) == int.Parse(item.ngay16.Split('-')[4]) && int.Parse(it.ngay16.Split('-')[7]) > int.Parse(item.ngay16.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay16.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay17 != null && item.ngay17 != null)
                        {
                            if (int.Parse(it.ngay17.Split('-')[4]) < int.Parse(item.ngay17.Split('-')[6]) && int.Parse(it.ngay17.Split('-')[6]) > int.Parse(item.ngay17.Split('-')[4]) ||
                                int.Parse(it.ngay17.Split('-')[4]) == int.Parse(item.ngay17.Split('-')[6]) && int.Parse(it.ngay17.Split('-')[5]) < int.Parse(item.ngay17.Split('-')[7]) ||
                                int.Parse(it.ngay17.Split('-')[6]) == int.Parse(item.ngay17.Split('-')[4]) && int.Parse(it.ngay17.Split('-')[7]) > int.Parse(item.ngay17.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay17.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay18 != null && item.ngay18 != null)
                        {
                            if (int.Parse(it.ngay18.Split('-')[4]) < int.Parse(item.ngay18.Split('-')[6]) && int.Parse(it.ngay18.Split('-')[6]) > int.Parse(item.ngay18.Split('-')[4]) ||
                                int.Parse(it.ngay18.Split('-')[4]) == int.Parse(item.ngay18.Split('-')[6]) && int.Parse(it.ngay18.Split('-')[5]) < int.Parse(item.ngay18.Split('-')[7]) ||
                                int.Parse(it.ngay18.Split('-')[6]) == int.Parse(item.ngay18.Split('-')[4]) && int.Parse(it.ngay18.Split('-')[7]) > int.Parse(item.ngay18.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay18.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay19 != null && item.ngay19 != null)
                        {
                            if (int.Parse(it.ngay19.Split('-')[4]) < int.Parse(item.ngay19.Split('-')[6]) && int.Parse(it.ngay19.Split('-')[6]) > int.Parse(item.ngay19.Split('-')[4]) ||
                                int.Parse(it.ngay19.Split('-')[4]) == int.Parse(item.ngay19.Split('-')[6]) && int.Parse(it.ngay19.Split('-')[5]) < int.Parse(item.ngay19.Split('-')[7]) ||
                                int.Parse(it.ngay19.Split('-')[6]) == int.Parse(item.ngay19.Split('-')[4]) && int.Parse(it.ngay19.Split('-')[7]) > int.Parse(item.ngay19.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay19.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay20 != null && item.ngay20 != null)
                        {
                            if (int.Parse(it.ngay20.Split('-')[4]) < int.Parse(item.ngay20.Split('-')[6]) && int.Parse(it.ngay20.Split('-')[6]) > int.Parse(item.ngay20.Split('-')[4]) ||
                                int.Parse(it.ngay20.Split('-')[4]) == int.Parse(item.ngay20.Split('-')[6]) && int.Parse(it.ngay20.Split('-')[5]) < int.Parse(item.ngay20.Split('-')[7]) ||
                                int.Parse(it.ngay20.Split('-')[6]) == int.Parse(item.ngay20.Split('-')[4]) && int.Parse(it.ngay20.Split('-')[7]) > int.Parse(item.ngay20.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay20.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay21 != null && item.ngay21 != null)
                        {
                            if (int.Parse(it.ngay21.Split('-')[4]) < int.Parse(item.ngay21.Split('-')[6]) && int.Parse(it.ngay21.Split('-')[6]) > int.Parse(item.ngay21.Split('-')[4]) ||
                                int.Parse(it.ngay21.Split('-')[4]) == int.Parse(item.ngay21.Split('-')[6]) && int.Parse(it.ngay21.Split('-')[5]) < int.Parse(item.ngay21.Split('-')[7]) ||
                                int.Parse(it.ngay21.Split('-')[6]) == int.Parse(item.ngay21.Split('-')[4]) && int.Parse(it.ngay21.Split('-')[7]) > int.Parse(item.ngay21.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay21.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay22 != null && item.ngay22 != null)
                        {
                            if (int.Parse(it.ngay22.Split('-')[4]) < int.Parse(item.ngay22.Split('-')[6]) && int.Parse(it.ngay22.Split('-')[6]) > int.Parse(item.ngay22.Split('-')[4]) ||
                                int.Parse(it.ngay22.Split('-')[4]) == int.Parse(item.ngay22.Split('-')[6]) && int.Parse(it.ngay22.Split('-')[5]) < int.Parse(item.ngay22.Split('-')[7]) ||
                                int.Parse(it.ngay22.Split('-')[6]) == int.Parse(item.ngay22.Split('-')[4]) && int.Parse(it.ngay22.Split('-')[7]) > int.Parse(item.ngay22.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay22.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay23 != null && item.ngay23 != null)
                        {
                            if (int.Parse(it.ngay23.Split('-')[4]) < int.Parse(item.ngay23.Split('-')[6]) && int.Parse(it.ngay23.Split('-')[6]) > int.Parse(item.ngay23.Split('-')[4]) ||
                                int.Parse(it.ngay23.Split('-')[4]) == int.Parse(item.ngay23.Split('-')[6]) && int.Parse(it.ngay23.Split('-')[5]) < int.Parse(item.ngay23.Split('-')[7]) ||
                                int.Parse(it.ngay23.Split('-')[6]) == int.Parse(item.ngay23.Split('-')[4]) && int.Parse(it.ngay23.Split('-')[7]) > int.Parse(item.ngay23.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay23.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay24 != null && item.ngay24 != null)
                        {
                            if (int.Parse(it.ngay24.Split('-')[4]) < int.Parse(item.ngay24.Split('-')[6]) && int.Parse(it.ngay24.Split('-')[6]) > int.Parse(item.ngay24.Split('-')[4]) ||
                                int.Parse(it.ngay24.Split('-')[4]) == int.Parse(item.ngay24.Split('-')[6]) && int.Parse(it.ngay24.Split('-')[5]) < int.Parse(item.ngay24.Split('-')[7]) ||
                                int.Parse(it.ngay24.Split('-')[6]) == int.Parse(item.ngay24.Split('-')[4]) && int.Parse(it.ngay24.Split('-')[7]) > int.Parse(item.ngay24.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay24.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay25 != null && item.ngay25 != null)
                        {
                            if (int.Parse(it.ngay25.Split('-')[4]) < int.Parse(item.ngay25.Split('-')[6]) && int.Parse(it.ngay25.Split('-')[6]) > int.Parse(item.ngay25.Split('-')[4]) ||
                                int.Parse(it.ngay25.Split('-')[4]) == int.Parse(item.ngay25.Split('-')[6]) && int.Parse(it.ngay25.Split('-')[5]) < int.Parse(item.ngay25.Split('-')[7]) ||
                                int.Parse(it.ngay25.Split('-')[6]) == int.Parse(item.ngay25.Split('-')[4]) && int.Parse(it.ngay25.Split('-')[7]) > int.Parse(item.ngay25.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay25.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay26 != null && item.ngay26 != null)
                        {
                            if (int.Parse(it.ngay26.Split('-')[4]) < int.Parse(item.ngay26.Split('-')[6]) && int.Parse(it.ngay26.Split('-')[6]) > int.Parse(item.ngay26.Split('-')[4]) ||
                                int.Parse(it.ngay26.Split('-')[4]) == int.Parse(item.ngay26.Split('-')[6]) && int.Parse(it.ngay26.Split('-')[5]) < int.Parse(item.ngay26.Split('-')[7]) ||
                                int.Parse(it.ngay26.Split('-')[6]) == int.Parse(item.ngay26.Split('-')[4]) && int.Parse(it.ngay26.Split('-')[7]) > int.Parse(item.ngay26.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay26.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay27 != null && item.ngay27 != null)
                        {
                            if (int.Parse(it.ngay27.Split('-')[4]) < int.Parse(item.ngay27.Split('-')[6]) && int.Parse(it.ngay27.Split('-')[6]) > int.Parse(item.ngay27.Split('-')[4]) ||
                                int.Parse(it.ngay27.Split('-')[4]) == int.Parse(item.ngay27.Split('-')[6]) && int.Parse(it.ngay27.Split('-')[5]) < int.Parse(item.ngay27.Split('-')[7]) ||
                                int.Parse(it.ngay27.Split('-')[6]) == int.Parse(item.ngay27.Split('-')[4]) && int.Parse(it.ngay27.Split('-')[7]) > int.Parse(item.ngay27.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay27.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay28 != null && item.ngay28 != null)
                        {
                            if (int.Parse(it.ngay28.Split('-')[4]) < int.Parse(item.ngay28.Split('-')[6]) && int.Parse(it.ngay28.Split('-')[6]) > int.Parse(item.ngay28.Split('-')[4]) ||
                                int.Parse(it.ngay28.Split('-')[4]) == int.Parse(item.ngay28.Split('-')[6]) && int.Parse(it.ngay28.Split('-')[5]) < int.Parse(item.ngay28.Split('-')[7]) ||
                                int.Parse(it.ngay28.Split('-')[6]) == int.Parse(item.ngay28.Split('-')[4]) && int.Parse(it.ngay28.Split('-')[7]) > int.Parse(item.ngay28.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay28.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay29 != null && item.ngay29 != null)
                        {
                            if (int.Parse(it.ngay29.Split('-')[4]) < int.Parse(item.ngay29.Split('-')[6]) && int.Parse(it.ngay29.Split('-')[6]) > int.Parse(item.ngay29.Split('-')[4]) ||
                                int.Parse(it.ngay29.Split('-')[4]) == int.Parse(item.ngay29.Split('-')[6]) && int.Parse(it.ngay29.Split('-')[5]) < int.Parse(item.ngay29.Split('-')[7]) ||
                                int.Parse(it.ngay29.Split('-')[6]) == int.Parse(item.ngay29.Split('-')[4]) && int.Parse(it.ngay29.Split('-')[7]) > int.Parse(item.ngay29.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay29.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay30 != null && item.ngay30 != null)
                        {
                            if (int.Parse(it.ngay30.Split('-')[4]) < int.Parse(item.ngay30.Split('-')[6]) && int.Parse(it.ngay30.Split('-')[6]) > int.Parse(item.ngay30.Split('-')[4]) ||
                                int.Parse(it.ngay30.Split('-')[4]) == int.Parse(item.ngay30.Split('-')[6]) && int.Parse(it.ngay30.Split('-')[5]) < int.Parse(item.ngay30.Split('-')[7]) ||
                                int.Parse(it.ngay30.Split('-')[6]) == int.Parse(item.ngay30.Split('-')[4]) && int.Parse(it.ngay30.Split('-')[7]) > int.Parse(item.ngay30.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay30.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                        if (it.ngay31 != null && item.ngay31 != null)
                        {
                            if (int.Parse(it.ngay31.Split('-')[4]) < int.Parse(item.ngay31.Split('-')[6]) && int.Parse(it.ngay31.Split('-')[6]) > int.Parse(item.ngay31.Split('-')[4]) ||
                                int.Parse(it.ngay31.Split('-')[4]) == int.Parse(item.ngay31.Split('-')[6]) && int.Parse(it.ngay31.Split('-')[5]) < int.Parse(item.ngay31.Split('-')[7]) ||
                                int.Parse(it.ngay31.Split('-')[6]) == int.Parse(item.ngay31.Split('-')[4]) && int.Parse(it.ngay31.Split('-')[7]) > int.Parse(item.ngay31.Split('-')[5])
                                )
                            {
                                var ngay = it.ngay31.Split('-');
                                TempData["testmsg"] = "Đăng lý lớp " + item.LopHoc.tenLopHoc + " không thành công vì lịch học đã bị trùng tại ngày " + ngay[1] + "-" + ngay[2] + "-" + ngay[3] + ".";
                                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
                            }
                        }
                    }
                }
            }

            var dslh = new DSLopHoc();

            dslh.idHV        = hv.id;
            dslh.idLH        = lophoc.ID;
            dslh.ngaydDangKy = DateTime.Now;
            int kt = 0;

            try
            {
                var daotb = new ThongBaoDAO();
                var tb    = new ThongBao();
                tb.icon      = "fa fa-address-card";
                tb.ngay      = DateTime.Now;
                tb.trangThai = 0;
                tb.idTK      = lophoc.Giangvien.TaiKhoan.iD;
                tb.link      = "http://localhost:52790/GiaoVien/QLLopHoc/" + lophoc.ID;
                tb.noiDung   = hv.TaiKhoan.hovaten + " đã đăng ký vào lớp học " + lophoc.tenLopHoc;
                daotb.Insert(tb);
                kt = dao.Insert(dslh);
            }
            catch (Exception ex)
            {
                TempData["testmsg"] = "Có lỗi trong quá trình đăng ký. Vui lòng thử lại sau";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }

            if (kt != 0)
            {
                TempData["testmsg"] = "Đăng ký thành công";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            else
            {
                TempData["testmsg"] = "Có lỗi trong quá trình đăng ký. Vui lòng thử lại sau";
                return(RedirectToAction("chitietlophoc/" + lophoc.ID, "Tim"));
            }
            //1 - 15 - 4 - 2021 - 9 - 00 - 11 - 30    2
            //1 - 15 - 4 - 2021 - 11 - 30 - 12 - 30    3
            //0   1    2    3     4   5    6     7
        }