コード例 #1
0
 public int SetCourseTimeAndLength(CourseDetailsDto courseDetails)
 {
     var classState = new ClassState();
     var res = classState.SetCourseTimeAndLength(courseDetails);
     classState.UpdateResults(courseDetails);
     return res;
 }
コード例 #2
0
 public int SetState(CourseDetailsDto courseDetails)
 {
     var data = new MySqlParameter[] {
                 new MySqlParameter("@classid", courseDetails.ClassId),
                 new MySqlParameter("@state", courseDetails.State)
                 };
     if (CheckCourseDetails(courseDetails.ClassId))
     {
         RunProcedure("UPDATE ClassState SET State = @state, LastUpdated = now() WHERE ClassId = @classid", data, "result");
         return 1;
     }
     RunProcedure("INSERT INTO ClassState (ClassId, State, LastUpdated) VALUES (@classid, @state, now())", data, "result");
     return 0;
 }
コード例 #3
0
 public int SetCourseTimeAndLength(CourseDetailsDto courseDetails)
 {
     var data = new MySqlParameter[] {
                 new MySqlParameter("@classid", courseDetails.ClassId),
                 new MySqlParameter("@coursetime", courseDetails.CourseTime),
                 new MySqlParameter("@courselength", courseDetails.CourseLength)
                 };
     if (CheckCourseDetails(courseDetails.ClassId))
     {
         RunProcedure("UPDATE ClassState SET CourseTime=@coursetime, CourseLength=@courselength, LastUpdated = now() WHERE ClassId = @classid",
             data, "result");
         return 1;
     }
     RunProcedure("INSERT INTO ClassState (ClassId, CourseTime, CourseLength, LastUpdated) VALUES (@classid, @coursetime, @courselength, now())",
         data, "result");
     return 0;
 }
コード例 #4
0
 public void UpdateResults(CourseDetailsDto courseDetails)
 {
     RunProcedure(@"update Results dest, (
     SELECT r.Dogid, case
     WHEN instr(r.Faults, 'E')> 0
         THEN 100
        WHEN length(r.Faults) > 0
         THEN (ROUND ((LENGTH(r.Faults) - LENGTH( REPLACE ( r.Faults, '5', '') ) ) / LENGTH('5') )  * 5)+
                 IF(round(r.Time - cs.CourseTime, 2) > 0, round(r.Time - cs.CourseTime, 2), 0)
     else
     0 + IF(round(r.Time - cs.CourseTime, 2) > 0, round(r.Time - cs.CourseTime, 2), 0)
     End as value
     from ClassState cs
     inner  join results r on r.ClassId = cs.classid
     where cs.ClassId = @classId ) src
     set dest.TotalFaults = src.value
     where dest.Classid = @classid and dest.dogid = src.Dogid", new MySqlParameter[]
     { new MySqlParameter("@classid", courseDetails.ClassId) });
 }
コード例 #5
0
 public int SetState(CourseDetailsDto courseDetails)
 {
     return _classState.SetState(courseDetails);
 }
コード例 #6
0
 public int SetCourseTimeAndLength(CourseDetailsDto courseDetails)
 {
     return _classState.SetCourseTimeAndLength(courseDetails);
 }
コード例 #7
0
 public void UpdateResults(CourseDetailsDto courseDetails)
 {
     _classState.UpdateResults(courseDetails);
 }
コード例 #8
0
 public int SetState(CourseDetailsDto courseDetails)
 {
     return new ClassState().SetState(courseDetails);
 }
コード例 #9
0
 public JsonResult SetState(CourseDetailsDto courseDetails)
 {
     var result = new Fpp.Domain.Managers.ClassManager().SetState(courseDetails);
     return Json(new
     {
         Status = 0,
         Result = result
     });
 }