public int SetCourseTimeAndLength(CourseDetailsDto courseDetails) { var classState = new ClassState(); var res = classState.SetCourseTimeAndLength(courseDetails); classState.UpdateResults(courseDetails); return res; }
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; }
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; }
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) }); }
public int SetState(CourseDetailsDto courseDetails) { return _classState.SetState(courseDetails); }
public int SetCourseTimeAndLength(CourseDetailsDto courseDetails) { return _classState.SetCourseTimeAndLength(courseDetails); }
public void UpdateResults(CourseDetailsDto courseDetails) { _classState.UpdateResults(courseDetails); }
public int SetState(CourseDetailsDto courseDetails) { return new ClassState().SetState(courseDetails); }
public JsonResult SetState(CourseDetailsDto courseDetails) { var result = new Fpp.Domain.Managers.ClassManager().SetState(courseDetails); return Json(new { Status = 0, Result = result }); }