//sua phong tho internal void UpDatePhongThi(Phong_Thi classRoom) { // classRoom.ThoiGianDong = classRoom.ThoiGianMo.AddMinutes(double.Parse(classRoom.Bo_De.ThoiGianThi)); var Room = db.Phong_Thi.Find(classRoom.MaPhong); Room.MaBoDe = classRoom.MaBoDe; Room.TrangThai = classRoom.TrangThai; Room.Xoa = classRoom.Xoa; Room.ThoiGianMo = classRoom.ThoiGianMo; Room.ThoiGianDong = classRoom.ThoiGianDong; db.SaveChanges(); db = new TracNghiemOnlineDB(); var ds = db.DS_SVThi.Where(x => x.MaPhong == classRoom.MaPhong).ToList(); foreach (var item in ds) { if (item.MaDeThi == null) { var list = new BoDeDao().ChapterStudy(long.Parse(classRoom.MaBoDe.ToString())); var dethi = new BoDeDao().MixExemQuestion(list, item.Ma_SV); new BoDeDao().UpdateDsThi(classRoom, dethi, item.Ma_SV, "Chưa Làm"); } } }
public void CreateSinhVienRoom(string maphong, List <DS_SVThi> dSSV) { foreach (var item in dSSV) { item.MaPhong = maphong; db.DS_SVThi.Add(item); db.SaveChanges(); try { if (new TracNghiemOnlineDB().Phong_Thi.Find(maphong).MaBoDe != null) { var list = new BoDeDao().ChapterStudy(long.Parse(new TracNghiemOnlineDB().Phong_Thi.Find(maphong).MaBoDe.ToString())); var dethi = new BoDeDao().MixExemQuestion(list, item.Ma_SV); new BoDeDao().UpdateDsThi(new TracNghiemOnlineDB().Phong_Thi.Find(maphong), dethi, item.Ma_SV, "Chưa Làm"); } } catch { } } }