public ActionResult VaoThi(string id) { var phong = new QuanLyThiDAO().ExamitionRoom(id); if (phong.TrangThai.Equals("Chưa Thi")) { ViewBag.MaPhong = id; return(View("PhongCho")); } var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; var DeThi = new QuanLyThiDAO().SeachForTheExam(phong, session.TaiKhoan1); if (DeThi == null) { var list = new BoDeDao().ChapterStudy(long.Parse(phong.MaBoDe.ToString())); DeThi = new BoDeDao().MixExemQuestion(list, session.TaiKhoan1); } new BoDeDao().UpdateDsThi(phong, DeThi, session.TaiKhoan1, "Đã vào phòng"); Session[ComMon.ComMonStants.ExamQuesTion] = DeThi; DateTime dateTime = DateTime.Parse(phong.ThoiGianDong.ToString()); CT_Dethi cT_Dethi = new CT_Dethi(); cT_Dethi.MADETHI = DeThi.MaDeThi; cT_Dethi.LYDO = "Sinh viên đã vào phòng"; TracNghiemOnlineDB db = new TracNghiemOnlineDB(); db.CT_Dethi.Add(cT_Dethi); db.SaveChanges(); ViewBag.GioThi = dateTime.AddMinutes(5).ToString("yyyy/MM/dd HH:mm:ss"); ViewBag.DeThi = DeThi; return(View(phong)); }
public ActionResult Loald(string id) { string tgbd = (string)Session["TGTHI"]; var ngay = tgbd.Split('/'); var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; var list = new BoDeDao().ChapterStudy(long.Parse(id)); var Exem = new De_Thi(); try { Exem = (De_Thi)Session[ComMon.ComMonStants.ExamQuesTion]; if (Exem == null) { Exem = new BoDeDao().MixExemQuestion(list, session.TaiKhoan1); } } catch { Exem = new BoDeDao().MixExemQuestion(list, session.TaiKhoan1); } Session[ComMon.ComMonStants.ExamQuesTion] = Exem; DateTime data = new DateTime(int.Parse(ngay[0]), int.Parse(ngay[1]), int.Parse(ngay[2]), int.Parse(ngay[3]), int.Parse(ngay[4]), int.Parse(ngay[5])).AddMinutes(double.Parse(list.ThoiGianThi)); ViewBag.GioThi = data.ToString("yyyy/MM/dd HH:mm:ss"); ViewBag.DeThi = (De_Thi)Exem; return(View()); }
public JsonResult VaoThi(string id) { var classRom = new QuanLyThiDAO().ExamitionRoom(id); TracNghiemOnlineDB db = new TracNghiemOnlineDB(); Session[ComMon.ComMonStants.ExamRoom] = classRom; var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; bool quyen = true; var bode = new BoDeDao().ListALLChapterStudy(long.Parse(classRom.LopHocPhan.MaMon.ToString()), session.TaiKhoan1); if (session.ChưcVu.Equals("Cán Bộ")) { bode = new TracNghiemOnlineDB().Bo_De.Where(x => x.Ma_Mon == classRom.LopHocPhan.MaMon && x.Ma_NguoiTao.Equals(session.TaiKhoan1) && x.Xoa == true && x.LoaiDe == false).ToList(); foreach (var item in db.Shares.Where(x => x.MaGV.Equals(session.TaiKhoan1) && x.Loai == 0)) { try { var bode2 = db.Bo_De.Where(x => x.Ma_BoDe == item.MA && x.Xoa == true).ToList(); if (bode2.Count > 0) { bode.Add(bode2[0]); } } catch { } } } long made = 0; string trangthai = classRom.TrangThai; try { made = long.Parse(classRom.MaBoDe.ToString()); } catch { made = 0; } var bode1 = (from n in bode select new { Ten = n.NoiDung, MaDe = n.Ma_BoDe, SoCau = n.SoCau, ThoiGian = n.ThoiGianThi, TenMon = n.MonHoc.TenMon, NguoiTao = new TracNghiemOnlineDB().GiaoViens.Find(n.Ma_NguoiTao).TenGV }).ToList(); return(Json(new { Bode = bode1, trangthai, made, }, JsonRequestBehavior.AllowGet));; }
public ActionResult DSDETHI(string id) { reseach(); var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin]; List <Bo_De> bo_Des = new BoDeDao().ListALLChapterStudy(); bo_Des = new TracNghiemOnlineDB().Bo_De.Where(x => x.Ma_NguoiTao == session.TaiKhoan1 && x.Xoa == true && x.NguoiDuyet == null).ToList(); Session["mads"] = null; return(View(bo_Des)); }