コード例 #1
0
        public ActionResult TryTest(Student_Submit st)
        {
            st.StudentID = User.Identity.Name;
            st.TrangThaiBienDich = 0;
            st.TrangThaiCham = (int)TrangThaiCham.ChuaCham;
            st.LanguageID = 1;
            st.SubmitTime = DateTime.Now;
            if (st.ContestID == 0)
                st.ContestID = null;
            db.Student_Submit.AddObject(st);
            db.SaveChanges();

            ChamDiemServise chamThiService = new ChamDiemServise();

            st.TrangThaiCham = (int)TrangThaiCham.DangCham;
            db.SaveChanges();
            KetQuaThiSinh kq = chamThiService.ChamBai(st.ProblemID, st.SourceCode, st.Language.Name);
            kq.SubmitID = st.ID;
            chamThiService_ChamThiCompleted(null, kq);
            if (st.ContestID == null)
            {
                return RedirectToAction("TryTestResult", "Result", new { ID = st.ID, Message = "Bạn đã gửi bài làm thành công" });//trả ra thông tin ở trang kết quả.
            }
            else
            {
                blContest.UpdateScoreForContest((int)st.ContestID, st.StudentID);
                return RedirectToAction("ContestDetail", "Contest", new { contestID = st.ContestID});//trả ra thông tin ở trang kết quả.
            }
        }
コード例 #2
0
 void ChamLai(int SubmitID)
 {
     Student_Submit st = db.Student_Submit.FirstOrDefault(s => s.ID == SubmitID);
     ChamDiemServise chamThiService = new ChamDiemServise();
     st.TrangThaiCham = (int)TrangThaiCham.DangCham;
     db.SaveChanges();
     KetQuaThiSinh kq = chamThiService.ChamBai(st.ProblemID, st.SourceCode, st.Language.Name);
     kq.SubmitID = st.ID;
     chamThiService_ChamLai(null, kq);
 }