Beispiel #1
0
        public override void AddResult(SubmissionResult r, int sid)
        {
            if (r.TestNumber < 0)
            {
                r.TestNumber = 0;
            }
            r.Info = r.Info.Trim();
            string update = "UPDATE Submissions SET Code=?code,Test=?test,Info=?info,[Memory Used]=?mem,[Time Worked]=?time WHERE SID=?sid";

            /*r.Code.ToString(),r.TestNumber,r.Info,r.MemoryUsed,
             *      r.TimeWorked.,sid);*/
            MySqlCommand comm = new MySqlCommand(update, (MySqlConnection)conn);

            comm.Parameters.Add("?code", r.Code.ToString());
            comm.Parameters.Add("?test", r.TestNumber);
            comm.Parameters.Add("?info", r.Info);
            comm.Parameters.Add("?mem", r.MemoryUsed);
            comm.Parameters.Add("?time", r.TimeWorked.ToString(CultureInfo.InvariantCulture));
            comm.Parameters.Add("?sid", sid);
            MySqlTransaction trans = ((MySqlConnection)conn).BeginTransaction(IsolationLevel.ReadCommitted);

            comm.Transaction = trans;
            try
            {
                comm.ExecuteNonQuery();
                trans.Commit();
            }
            catch (MySqlException)
            {
                trans.Rollback();
            }
        }
Beispiel #2
0
 public Submission(int sid, int pid, int uid, int tid, DateTime time, Language lang, SubmissionResult r)
     : this(sid, pid, uid, tid, time, lang)
 {
     this.r = r;
 }
Beispiel #3
0
 public abstract void AddResult(SubmissionResult s, int sid);