/// <summary> /// 添加验证是否存在 /// </summary> /// <param name="SutId"></param> /// <param name="CourseId"></param> /// <param name="SemesterId"></param> /// <returns></returns> public static bool IsTrue(int SutId, int CourseId) { Results res = ResultsDAL.GetByWhere(SutId, CourseId); if (res != null && res.ResultsId != 0) { return(true); } return(false); }
/// <summary> /// Запись в БД. /// </summary> public void InsertIntoDB() { ResultsDAL results = new ResultsDAL(); results.InsertNewRecord(new TetrisDAL.Models.TetrisResults { Name = this.Name, Points = this.Points, Lines = this.CompletedLinesNumber, Time = this.Time.ToString() }); }
public string AttemptDistributionData(int selectedAssessment = 0, string scorebandNameForPass = "******") { var accountModel = AuthHelper.GetAccountModel(Request); var results = ResultsDAL.GetResultsForAssessment(accountModel, selectedAssessment).ToList(); var firstPassedResults = GetFirstPassedResults(scorebandNameForPass, results); var totalAttempts = firstPassedResults.Count; var meanAttempts = GetRoundedMeanAttempts(firstPassedResults); var standardDeviationAttempts = GetRoundedStandardDeviationAttempts(firstPassedResults, meanAttempts); var medianAttempts = GetRoundedMedianAttempts(firstPassedResults); var highestResultCount = GetHighestResultCount(firstPassedResults); var chartData = GetAttemptDistributionChartData(firstPassedResults); var meanAttemptsAsString = !double.IsNaN(meanAttempts) ? string.Format("{0:F1}", meanAttempts) : "-"; var standardDeviationAttemptsAsString = !double.IsNaN(standardDeviationAttempts) ? string.Format("{0:F1}", standardDeviationAttempts) : "-"; var medianAttemptsAsString = !double.IsNaN(medianAttempts) ? string.Format("{0:F1}", medianAttempts) : "-"; var jsonData = string.Format(@" {{ ""totalAttempts"":[{0}], ""meanAttempts"":[""{1}""], ""standardDeviationAttempts"":[""{2}""], ""medianAttempts"":[""{3}""], ""highestResultCount"":[{4}], ""chartData"":[{5}] }}", totalAttempts, meanAttemptsAsString, standardDeviationAttemptsAsString, medianAttemptsAsString, highestResultCount, chartData); return(jsonData); }
public string ScoreCorrelationData(int firstSelectedAssessment = 0, int secondSelectedAssessment = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var resultsForFirstAssessment = ResultsDAL.GetResultsForAssessment(accountModel, firstSelectedAssessment).ToList(); var resultsForSecondAssessment = ResultsDAL.GetResultsForAssessment(accountModel, secondSelectedAssessment).ToList(); // only look at the first attempts for each result to ensure a valid comparison var resultsForFirstAssessmentFirstAttempt = GetOnlyFirstAttempts(resultsForFirstAssessment); var resultsForSecondAssessmentFirstAttempt = GetOnlyFirstAttempts(resultsForSecondAssessment); var chartData = GetScoreCorrelationChartData(resultsForFirstAssessmentFirstAttempt, resultsForSecondAssessmentFirstAttempt); var jsonData = string.Format(@" {{ ""chartData"":[{0}] }}", chartData); return(jsonData); }
public string ScoreDistributionData(int selectedAssessment = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var results = ResultsDAL.GetResultsForAssessment(accountModel, selectedAssessment).ToList(); var highestResultCount = GetHighestResultCountGroupedByPercentile(results); var numberOfResults = results.Count; var meanPercentageScore = GetRoundedMeanPercentageScore(results); var standardDeviation = GetRoundedStandardDeviation(results, meanPercentageScore); var chartData = GetScoreDistributionChartData(results); var meanPercentageScoreAsString = !double.IsNaN(meanPercentageScore) ? string.Format("{0}%", meanPercentageScore) : "-"; var standardDeviationAsString = !double.IsNaN(standardDeviation) ? string.Format("{0}%", standardDeviation) : "-"; var jsonData = string.Format(@" {{ ""highestResultCount"":{0}, ""numberOfResults"":{1}, ""meanPercentageScore"":""{2}"", ""standardDeviation"":""{3}"", ""chartData"":[{4}] }}", highestResultCount, numberOfResults, meanPercentageScoreAsString, standardDeviationAsString, chartData); return(jsonData); }
public string PreTestPostTestData( int firstAssessment = 0, Attempt firstAssessmentAttemptToUse = Attempt.First, int firstAssessmentAttemptNumber = 0, int secondAssessment = 0, Attempt secondAssessmentAttemptToUse = Attempt.First, int secondAssessmentAttemptNumber = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var resultsForFirstAssessment = ResultsDAL.GetResultsForAssessment(accountModel, firstAssessment).ToList(); var resultsForSecondAssessment = ResultsDAL.GetResultsForAssessment(accountModel, secondAssessment).ToList(); var singleAttemptResultsForFirstAssessment = FilterResultsForAttemptNumber(resultsForFirstAssessment, firstAssessmentAttemptToUse, firstAssessmentAttemptNumber); var singleAttemptResultsForSecondAssessment = FilterResultsForAttemptNumber(resultsForSecondAssessment, secondAssessmentAttemptToUse, secondAssessmentAttemptNumber); var filteredResultsForFirstAssessment = FilterResultsMissingFromOtherAssessment(singleAttemptResultsForFirstAssessment, singleAttemptResultsForSecondAssessment); var filteredResultsForSecondAssessment = FilterResultsMissingFromOtherAssessment(singleAttemptResultsForSecondAssessment, singleAttemptResultsForFirstAssessment); var countOfFilteredResultsForFirstAssessment = filteredResultsForFirstAssessment.Count; var countOfIgnoredResultsForFirstAssessment = singleAttemptResultsForFirstAssessment.Count - filteredResultsForFirstAssessment.Count; var meanScoreOfFilteredResultsForFirstAssessment = GetRoundedMeanPercentageScore(filteredResultsForFirstAssessment); var standardDeviationOfFilteredResultsForFirstAssessment = GetRoundedStandardDeviation(filteredResultsForFirstAssessment, meanScoreOfFilteredResultsForFirstAssessment); var medianScoreOfFilteredResultsForFirstAssessment = GetRoundedMedianPercentageScore(filteredResultsForFirstAssessment); var meanScoreOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(meanScoreOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", meanScoreOfFilteredResultsForFirstAssessment) : "-"; var standardDeviationOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(standardDeviationOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", standardDeviationOfFilteredResultsForFirstAssessment) : "-"; var medianScoreOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(medianScoreOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", medianScoreOfFilteredResultsForFirstAssessment) : "-"; var countOfFilteredResultsForSecondAssessment = filteredResultsForSecondAssessment.Count; var countOfIgnoredResultsForSecondAssessment = singleAttemptResultsForSecondAssessment.Count - filteredResultsForSecondAssessment.Count; var meanScoreOfFilteredResultsForSecondAssessment = GetRoundedMeanPercentageScore(filteredResultsForSecondAssessment); var standardDeviationOfFilteredResultsForSecondAssessment = GetRoundedStandardDeviation(filteredResultsForSecondAssessment, meanScoreOfFilteredResultsForSecondAssessment); var medianScoreOfFilteredResultsForSecondAssessment = GetRoundedMedianPercentageScore(filteredResultsForSecondAssessment); var meanScoreOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(meanScoreOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", meanScoreOfFilteredResultsForSecondAssessment) : "-"; var standardDeviationOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(standardDeviationOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", standardDeviationOfFilteredResultsForSecondAssessment) : "-"; var medianScoreOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(medianScoreOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", medianScoreOfFilteredResultsForSecondAssessment) : "-"; var quartileScoresForFirstAssessment = GetQuartileScores(filteredResultsForFirstAssessment); var quartileScoresForSecondAssessment = GetQuartileScores(filteredResultsForSecondAssessment); var q0ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile0Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile0Score) : "-"; var q1ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile1Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile1Score) : "-"; var q2ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile2Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile2Score) : "-"; var q3ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile3Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile3Score) : "-"; var q4ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile4Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile4Score) : "-"; var q0ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile0Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile0Score) : "-"; var q1ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile1Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile1Score) : "-"; var q2ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile2Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile2Score) : "-"; var q3ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile3Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile3Score) : "-"; var q4ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile4Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile4Score) : "-"; var nameForFirstAssessment = resultsForFirstAssessment.Count > 0 ? resultsForFirstAssessment[0].AssessmentName : "-"; var nameForSecondAssessment = resultsForSecondAssessment.Count > 0 ? resultsForSecondAssessment[0].AssessmentName : "-"; var chartData = GetPreTestPostTestChartData(nameForFirstAssessment, quartileScoresForFirstAssessment, nameForSecondAssessment, quartileScoresForSecondAssessment); var jsonData = string.Format(@" {{ ""countOfFilteredResultsForFirstAssessment"":{0}, ""countOfIgnoredResultsForFirstAssessment"":{1}, ""meanScoreOfFilteredResultsForFirstAssessment"":""{2}"", ""standardDeviationOfFilteredResultsForFirstAssessment"":""{3}"", ""medianScoreOfFilteredResultsForFirstAssessment"":""{4}"", ""quartile0ScoreForFirstAssessment"":""{5}"", ""quartile1ScoreForFirstAssessment"":""{6}"", ""quartile2ScoreForFirstAssessment"":""{7}"", ""quartile3ScoreForFirstAssessment"":""{8}"", ""quartile4ScoreForFirstAssessment"":""{9}"", ""countOfFilteredResultsForSecondAssessment"":{10}, ""countOfIgnoredResultsForSecondAssessment"":{11}, ""meanScoreOfFilteredResultsForSecondAssessment"":""{12}"", ""standardDeviationOfFilteredResultsForSecondAssessment"":""{13}"", ""medianScoreOfFilteredResultsForSecondAssessment"":""{14}"", ""quartile0ScoreForSecondAssessment"":""{15}"", ""quartile1ScoreForSecondAssessment"":""{16}"", ""quartile2ScoreForSecondAssessment"":""{17}"", ""quartile3ScoreForSecondAssessment"":""{18}"", ""quartile4ScoreForSecondAssessment"":""{19}"", ""chartData"":[{20}] }}", countOfFilteredResultsForFirstAssessment, countOfIgnoredResultsForFirstAssessment, meanScoreOfFilteredResultsForFirstAssessmentAsString, standardDeviationOfFilteredResultsForFirstAssessmentAsString, medianScoreOfFilteredResultsForFirstAssessmentAsString, q0ScoreForFirstAssessmentAsString, q1ScoreForFirstAssessmentAsString, q2ScoreForFirstAssessmentAsString, q3ScoreForFirstAssessmentAsString, q4ScoreForFirstAssessmentAsString, countOfFilteredResultsForSecondAssessment, countOfIgnoredResultsForSecondAssessment, meanScoreOfFilteredResultsForSecondAssessmentAsString, standardDeviationOfFilteredResultsForSecondAssessmentAsString, medianScoreOfFilteredResultsForSecondAssessmentAsString, q0ScoreForSecondAssessmentAsString, q1ScoreForSecondAssessmentAsString, q2ScoreForSecondAssessmentAsString, q3ScoreForSecondAssessmentAsString, q4ScoreForSecondAssessmentAsString, chartData); return(jsonData); }
/// <summary> /// Метод отображает таблицу рекордов (данные считываются из БД). /// </summary> /// <param name="tetris"></param> public void ShowRecordTable(ITetris tetris) { Console.Clear(); Console.WindowWidth = 50; Console.BufferWidth = Console.WindowWidth; Console.WindowHeight = 17; Console.BufferHeight = Console.WindowHeight; ResultsDAL results = new ResultsDAL(); List <TetrisResults> recordList = results.GetTopFive(); // Если записи в БД отсутствуют, то сообщаем, что запией нет. if (recordList == null) { Console.WriteLine(" Записи отсутствуют."); Console.SetCursorPosition(2, 15); Console.Write("Нажмите пробел, чтобы вернуться в главное меню"); while (true) { if (Console.KeyAvailable) { var key = Console.ReadKey(); if (key.Key == ConsoleKey.Spacebar) { break; } else { Console.SetCursorPosition(0, 14); Console.WriteLine(" "); } } Thread.Sleep(100); } tetris.MainMenuShow(tetris); } else { string heading = "Пять лучших результатов"; int indexOfCentralPosition = (Console.WindowWidth - heading.Length) / 2; Console.SetCursorPosition(indexOfCentralPosition, 1); Console.Write(heading); string table = String.Format("| {0, 1} | {1,-3} | {2,-4} | {3,-3} | {4,-10} |", "№", "Очки", "Время", "Линии", "Имя"); indexOfCentralPosition = (Console.WindowWidth - table.Length) / 2; Console.SetCursorPosition(indexOfCentralPosition, 3); Console.Write(table); Console.SetCursorPosition(indexOfCentralPosition, 4); Console.Write(String.Format("| {0, 1} | {1,-3} | {2,-4} | {3,-3} | {4,-10} |", "-", "----", "-----", "-----", "----------")); for (int i = 0; i < recordList.Count; i++) { Console.SetCursorPosition(indexOfCentralPosition, i + 5); Console.WriteLine(String.Format("| {0, 1} | {1,-4} | {2:00}:{3:00} | {4,-5} | {5,-10} |", i + 1, recordList[i].Points, TimeSpan.Parse(recordList[i].Time).Minutes, TimeSpan.Parse(recordList[i].Time).Seconds, recordList[i].Lines, recordList[i].Name)); Console.SetCursorPosition(indexOfCentralPosition, i + 6); } Console.WriteLine("| {0, 1} | {1,-3} | {2,-4} | {3,-3} | {4,-10} |", "-", "----", "-----", "-----", "----------"); Console.WriteLine(); Console.WriteLine("Нажмите пробел, чтобы вернуться в главное меню"); while (true) { if (Console.KeyAvailable) { var key = Console.ReadKey(); if (key.Key == ConsoleKey.Spacebar) { tetris.MainMenuShow(tetris); break; } else { Console.SetCursorPosition(0, 14); Console.WriteLine(" "); } } Thread.Sleep(100); } } }
/// <summary> /// 根据成绩统计 /// </summary> public static List <Results> StatisticalByType(int CourseId, int SemesterId) { return(ResultsDAL.StatisticalByType(CourseId, SemesterId)); }
/// <summary> /// 根据主键查询实体 ///</summary> public static Results GetIdByResults(int Id) { return(ResultsDAL.GetIdByResults(Id)); }
/// <summary> /// 查询条数 ///</summary> public static int CountNumber(string NewWHere) { return(ResultsDAL.CountNumber(NewWHere)); }
/// <summary> /// 查询全部 ///</summary> public static List <Results> AllData(string WhereSrc, string PXzd, string PXType) { return(ResultsDAL.AllData(WhereSrc, PXzd, PXType)); }
/// <summary> /// 修改 ///</summary> public static int UpdateResults(Results ResultsModel) { return(ResultsDAL.UpdateResults(ResultsModel)); }
/// <summary> /// 分页 ///</summary> public static List <Results> PageSelectResults(int pageSize, int pageIndex, string WhereSrc, string PXzd, string PXType) { pageIndex = pageIndex - 1; return(ResultsDAL.PageSelectResults(pageSize, pageIndex, WhereSrc, PXzd, PXType)); }
/// <summary> /// 查询全部 /// </summary> public static DataTable GetAllData(string WhereSrc, string PXzd, string PXType) { return(ResultsDAL.GetAllData(WhereSrc, PXzd, PXType)); }
/// <summary> /// 根据主键删除 ///</summary> public static int DeleteResults(int Id) { return(ResultsDAL.DeleteResults(Id)); }
/// <summary> /// 添加 ///</summary> public static int AddResults(Results ResultsModel) { return(ResultsDAL.AddResults(ResultsModel)); }