Quizzer-8: Migrating to .NET 10

This commit is contained in:
Karsten Jeppesen
2026-05-01 11:40:09 +02:00
parent 15445b6e4a
commit f22c7dfb0c
116 changed files with 79176 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using Dapper.Contrib.Extensions;
namespace Quizzer.Models
{
public class Cat
{
[Key]
public string CId { get; set; }
public string UID { get; set; }
public string CParentId { get; set; }
public string Txt { get; set; }
public string Descr { get; set; }
public Cat()
{
CId = String.Empty;
UID = String.Empty;
CParentId = String.Empty;
Txt = String.Empty;
Descr = String.Empty;
}
}
}

View File

@@ -0,0 +1,10 @@
namespace Quizzer.Models
{
public class ChartConnector
{
public string ChartData { get; set; }
public string ChartLabel { get; set; }
public string ChartBackground { get; set; }
public string ChartBorder { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Quizzer.Models
{
public class Coverage
{
public string Email { get; set; }
public string Name { get; set; }
public string Date { get; set; }
public string TheClass { get; set; }
}
}

View File

@@ -0,0 +1,89 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Quizzer.Models
{
/// <summary>
/// This is the database model for the journal, which is used to store the quiz results and other related information. It is used to display the quiz results in the journal page and to store the quiz results in the database.
/// </summary>
public class Journal
{
public string PID { get; set; }
public string QuizzID { get; set; }
public string Category { get; set; }
public int IsOpen { get; set; }
public bool Anonymous { get; set; }
public int Score { get; set; }
public int ScoreAcc { get; set; }
// This is the JSON string that contains the quiz results, which is used to display the quiz results in the journal page. It is also used to store the quiz results in the database.
// The JSON string is in the following format:
// {
// "items": [
// {
// "itemID": "1",
// "isOpen": 1,
// "score": 1,
// "maxScore": 1,
// "replyMC": [true, false, false, false]
// },
// {
// "itemID": "2",
// "isOpen": 0,
// "score": 0,
// "maxScore": 1,
// "replyMC": [false, false, false, false]
// }
// ]
// }
public string JournalJson { get; set; }
}
public class Item
{
public string ItemID { get; set; }
public int IsOpen { get; set; }
public int Score { get; set; }
public int MaxScore { get; set; }
public List<bool> ReplyMC { get; set; }
}
/// <summary>
/// Used for web page building
/// </summary>
public class JournalHtml
{
public Journal2 Journal { get; set; }
public string Text { get; set; }
}
/// <summary>
/// Table for the journal. One is created for each test available to the PID.
/// </summary>
[Table("Journal2")]
public class Journal2
{
public string PID { get; set; } // VARCHAR 256 Primary key
public string QuizzID { get; set; } // VARCHAR 50 Primary key
public string Category { get; set; } // VARCHAR 50
public int IsOpen { get; set; } // INT 11
public bool Anonymous { get; set; } // INT 11
public int Score { get; set; } // INT 11
public int ScoreAcc { get; set; } // INT 11
public List<Journal2Item> Items { get; set; } // This field does not store in the DB, but is serialized to JSON and stored in the JournalJson field of the JournalHead table. The JSON string is in the following format: {"items": [{"itemID": "1", "isOpen": 1, "score": 1, "maxScore": 1, "replyMC": [true, false, false, false]}, {"itemID": "2", "isOpen": 0, "score": 0, "maxScore": 1, "replyMC": [false, false, false, false]}]}
}
/// <summary>
/// One is created for each question in the test, and linked to the JournalHead by the QuizzID and PID. The ItemID is used to identify the question in the test, and the IsOpen, Score, MaxScore, and ReplyMCJson are used to store the quiz results for that question.
/// </summary>
[Table("Journal2Item")]
public class Journal2Item
{
public string PID { get; set; } // VARCHAR 256, Foreign key to the JournalHead table. Primary key
public string QuizzID { get; set; } // VARCHAR 50, Foreign key to the JournalHead table. Primary key
public required string QuestionID { get; set; } // VARCHAR 50, used to identify the question in the test. Primary key
public int IsOpen { get; set; } // INT 11, used to indicate whether the question is open or not.
public int Score { get; set; } // INT 11, used to store the score for the question.
public int MaxScore { get; set; } // INT 11, used to store the maximum score for the question.
public List<bool> ReplyMC { get; set; } // This field does not store in the DB, but is serialized to JSON and stored in the JournalJson field of the JournalHead table. The JSON string is in the following format: [true, false, false, false]
public string ReplyMCJson { get; set; } // VARCHAR 512, used to store the JSON string for the ReplyMC field. The JSON string is in the following format: [true, false, false, false]
}
}

View File

@@ -0,0 +1,8 @@
namespace Quizzer.Models
{
public class OpenIDUCNData
{
public string theRole { get; set; }
public List<string> theClass { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Quizzer.Models
{
public class QAnswer
{
public string AId { get; set; }
public string QRef { get; set; }
public string Alternative { get; set; }
public bool IsRight { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
using Dapper.Contrib.Extensions;
namespace Quizzer.Models
{
/// <summary>
/// Multiple Choice Question
/// Missing: image upload
/// CREATE TABLE `Questions` (
/// `QId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
/// `Txt` VARCHAR(512) NOT NULL DEFAULT '0' COLLATE 'utf8mb4_general_ci',
/// PRIMARY KEY(`QId`) USING BTREE
/// )
/// COMMENT='The headline'
/// COLLATE='utf8mb4_general_ci'
/// ENGINE=InnoDB
/// AUTO_INCREMENT = 2
/// ;
/// </summary>
public class Question
{
[Key]
public string QuestionID { get; set; }
public string Category { get; set; }
public string QuestionText { get; set; }
public string QuestionType { get; set; }
public string ContentJson { get; set; }
public Question()
{
QuestionID = String.Empty;
Category = String.Empty;
QuestionText = String.Empty;
QuestionType = String.Empty;
ContentJson = String.Empty;
}
}
public class MCQuestion : Question
{
public List<Alternative> AList { get; set; }
public MCQuestion()
{
AList = new List<Alternative>();
}
}
public class Alternative
{
public string Atxt { get; set; }
public bool Aok { get; set; }
public int Counter { get; set; }
public Alternative()
{
Counter = 0;
Atxt = String.Empty;
Aok = false;
}
}
}

View File

@@ -0,0 +1,27 @@
using Dapper.Contrib.Extensions;
namespace Quizzer.Models
{
/// <summary>
/// QuizzID identifies the quizz
/// Owner teacher
/// Class Who gets this test
/// Descr Text to present to the student
/// </summary>
public class Quizz
{
[Key]
public string QuizzId { get; set; }
public string Owner { get; set; }
public string Class { get; set; }
public string Category { get; set; }
public string Descr { get; set; }
public bool Anonymous { get; set; }
public int QSize { get; set; }
}
public class QuizzDN : Quizz
{
public string CategoryText { get; set; }
}
}

View File

@@ -0,0 +1,78 @@
using System.Collections.Generic;
namespace Quizzer.Models
{
/// <summary>
/// Collective knowledge of quizz answers
/// </summary>
public class Statistic
{
public string QuizzID { get; set; }
public int Version { get; set; }
public string StatsJson { get; set; }
public Statistic()
{
QuizzID = String.Empty;
Version = 0;
StatsJson = String.Empty;
}
}
public class StatisticsMC : Statistic
{
public List<StatisticsMCItem> MCList { get; set; }
public StatisticsMC()
{
MCList = new List<StatisticsMCItem>();
}
}
public class StatisticsMCItem
{
public string QuestionID { get; set; }
public List<int> Counter { get; set; }
public StatisticsMCItem()
{
Counter = new List<int>();
QuestionID = string.Empty;
}
}
public class StatisticsMCDN : StatisticsMC
{
public List<MCQuestion> Questions { get; set; }
public StatisticsMCDN()
{
Questions = new List<MCQuestion>();
}
}
public class StatisticsStudentByCategory
{
public string CategoryID { get; set; }
public string CategoryName { get; set; }
public int percentage { get; set; }
private int score;
private int max;
public StatisticsStudentByCategory()
{
score = 0;
max = 0;
percentage = 0;
}
public void Update (int theScore, int theMax)
{
score += theScore;
max += theMax;
percentage = (score * 100) / max;
}
}
}

View File

@@ -0,0 +1,10 @@
using Dapper.Contrib.Extensions;
namespace Quizzer.Models
{
public class TheClass
{
[Key]
public string? Name { get; set; }
}
}