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ả.
            }
        }
 public ActionResult TryTest(int ID, int ContestID = 0)
 {
     Problem p = blProblem.LayTheoMa(ID);
     Student_Submit st = new Student_Submit();
     st.Problem = p;
     st.ContestID = ContestID;
     return View(st);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Student_Submit EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStudent_Submit(Student_Submit student_Submit)
 {
     base.AddObject("Student_Submit", student_Submit);
 }
 /// <summary>
 /// Create a new Student_Submit object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="problemID">Initial value of the ProblemID property.</param>
 /// <param name="studentID">Initial value of the StudentID property.</param>
 /// <param name="sourceCode">Initial value of the SourceCode property.</param>
 /// <param name="trangThaiBienDich">Initial value of the TrangThaiBienDich property.</param>
 /// <param name="trangThaiCham">Initial value of the TrangThaiCham property.</param>
 /// <param name="timeStamp">Initial value of the TimeStamp property.</param>
 /// <param name="submitTime">Initial value of the SubmitTime property.</param>
 public static Student_Submit CreateStudent_Submit(global::System.Int32 id, global::System.Int32 problemID, global::System.String studentID, global::System.String sourceCode, global::System.Int32 trangThaiBienDich, global::System.Int32 trangThaiCham, global::System.Byte[] timeStamp, global::System.DateTime submitTime)
 {
     Student_Submit student_Submit = new Student_Submit();
     student_Submit.ID = id;
     student_Submit.ProblemID = problemID;
     student_Submit.StudentID = studentID;
     student_Submit.SourceCode = sourceCode;
     student_Submit.TrangThaiBienDich = trangThaiBienDich;
     student_Submit.TrangThaiCham = trangThaiCham;
     student_Submit.TimeStamp = timeStamp;
     student_Submit.SubmitTime = submitTime;
     return student_Submit;
 }
Beispiel #5
0
 //class ThamSo
 //{
 //    public int MaBai { get; set; }
 //    public String SourceCode { get; set; }
 //    public string NgonNgu { get; set; }
 //}
 public void ChamBaiThread(Student_Submit st)
 {
     Thread t = new Thread(new ParameterizedThreadStart(Start));
     t.Start(st);
 }