/
Motlokhov
/
ASKYZ
Обзор
Документация
Войти
/
Motlokhov
/
ASKYZ
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
SystemVerifyKnowledge.CoreLib/Model/Result.cs
46 строк
2 KB
Mikhail Motlokhov
Changed Corelib from Framework to net standart
13 апр 2021, 18:12
13 апр 2021, 18:12
e82a717
Код
Авторство
О чём код?
using System; using SystemVerifyKnowledge.Common.Interface; using SystemVerifyKnowledge.CoreLib.Common; namespace SystemVerifyKnowledge.CoreLib.Model { public class Result { private readonly IQueryResult _queryResult; public byte TrueAnswers { get; set; } public byte FalseAnswers { get; set; } public byte Points { get; set; } public Result(IQueryResult queryResult) { _queryResult = queryResult; } public Result(IQueryResult queryResult, ulong testingDateID,ExerciseType exerciseType) { _queryResult = queryResult; Load(testingDateID , exerciseType); } public ExerciseType ExerciseType { get; set; } public void CalculateFalseAnswers(int parentCountQuestions) { FalseAnswers = Convert.ToByte(parentCountQuestions - TrueAnswers); } private void Load(ulong testingDateID,ExerciseType exerciseType) { ExerciseType = exerciseType; (byte trueAnswersCount, byte falseAnswerCount, byte points)? testResult = _queryResult.LoadTestResult(testingDateID, (int)exerciseType); if(testResult.HasValue) { TrueAnswers = testResult.Value.trueAnswersCount; FalseAnswers = testResult.Value.falseAnswerCount; Points = testResult.Value.points; return; } throw new Exception("Нет данных по результатам тестирования."); } } }