
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 13s
- 重构AppMainStruct、AssignmentQuestion、Question等实体模型 - 更新相关DTO以匹配新的数据结构 - 优化前端页面布局和组件 - 添加全局信息和笔记功能相关代码 - 更新数据库迁移和程序配置
190 lines
4.0 KiB
C#
190 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Entities.Contracts
|
|
{
|
|
public enum Layout : byte
|
|
{
|
|
horizontal = 0,
|
|
vertical = 1,
|
|
|
|
Auto = 2
|
|
}
|
|
|
|
public enum Publisher : byte
|
|
{
|
|
Unknown = 0,
|
|
统编版,
|
|
部编版,
|
|
}
|
|
|
|
public enum GradeEnum : byte
|
|
{
|
|
Unknown = 0,
|
|
一年级 = 1,
|
|
二年级 = 2,
|
|
三年级 = 3,
|
|
四年级 = 4,
|
|
五年级 = 5,
|
|
六年级 = 6
|
|
}
|
|
|
|
public enum DifficultyLevel : byte
|
|
{
|
|
simple,
|
|
easy,
|
|
medium,
|
|
hard,
|
|
veryHard
|
|
}
|
|
|
|
public enum QuestionType : byte
|
|
{
|
|
Unknown = 0,
|
|
Spelling, // 拼写
|
|
Pronunciation, // 给带点字选择正确读音
|
|
WordFormation, // 组词
|
|
FillInTheBlanks, // 选词填空 / 补充词语
|
|
SentenceDictation, // 默写句子
|
|
SentenceRewriting, // 仿句 / 改写句子
|
|
ReadingComprehension, // 阅读理解
|
|
Composition // 作文
|
|
|
|
}
|
|
|
|
public enum SubjectAreaEnum : byte
|
|
{
|
|
[Display(Name = "未知", Description = "未知")]
|
|
Unknown = 0,
|
|
|
|
[Display(Name = "数学", Description = "数")]
|
|
Mathematics, // 数学
|
|
|
|
[Display(Name = "物理", Description = "物")]
|
|
Physics, // 物理
|
|
|
|
[Display(Name = "化学", Description = "化")]
|
|
Chemistry, // 化学
|
|
|
|
[Display(Name = "生物", Description = "生")]
|
|
Biology, // 生物
|
|
|
|
[Display(Name = "历史", Description = "史")]
|
|
History, // 历史
|
|
|
|
[Display(Name = "地理", Description = "地")]
|
|
Geography, // 地理
|
|
|
|
[Display(Name = "语文", Description = "语")]
|
|
Literature, // 语文/文学
|
|
|
|
[Display(Name = "英语", Description = "英")]
|
|
English, // 英语
|
|
|
|
[Display(Name = "计算机科学", Description = "计")]
|
|
ComputerScience // 计算机科学
|
|
}
|
|
|
|
public enum AssignmentStructType : byte
|
|
{
|
|
[Display(Name = "根节点", Description = "根")]
|
|
Root,
|
|
[Display(Name = "单个问题", Description = "问")]
|
|
Question,
|
|
[Display(Name = "问题组", Description = "组")]
|
|
Group,
|
|
[Display(Name = "结构", Description = "结")]
|
|
Struct,
|
|
[Display(Name = "子问题", Description = "子")]
|
|
SubQuestion,
|
|
[Display(Name = "选项", Description = "选")]
|
|
Option
|
|
}
|
|
|
|
public enum ExamType : byte
|
|
{
|
|
[Display(Name = "期中考试", Description = "中")]
|
|
MidtermExam,
|
|
|
|
[Display(Name = "期末考试", Description = "末")]
|
|
FinalExam,
|
|
|
|
[Display(Name = "月考", Description = "月")]
|
|
MonthlyExam,
|
|
|
|
[Display(Name = "周考", Description = "周")]
|
|
WeeklyExam,
|
|
|
|
[Display(Name = "平时测试", Description = "平")]
|
|
DailyTest,
|
|
|
|
[Display(Name = "AI测试", Description = "AI")]
|
|
AITest,
|
|
}
|
|
|
|
public enum SubmissionStatus
|
|
{
|
|
[Display(Name = "待提交/未开始", Description = "待")]
|
|
Pending,
|
|
|
|
[Display(Name = "已提交", Description = "提")]
|
|
Submitted,
|
|
|
|
[Display(Name = "已批改", Description = "批")]
|
|
Graded,
|
|
|
|
[Display(Name = "待重新提交", Description = "重")]
|
|
Resubmission,
|
|
|
|
[Display(Name = "迟交", Description = "迟")]
|
|
Late,
|
|
|
|
[Display(Name = "草稿", Description = "草")]
|
|
Draft,
|
|
}
|
|
|
|
public static class EnumExtensions
|
|
{
|
|
public static string GetDisplayName(this Enum enumValue)
|
|
{
|
|
var fieldInfo = enumValue.GetType().GetField(enumValue.ToString());
|
|
|
|
if (fieldInfo == null)
|
|
{
|
|
return enumValue.ToString();
|
|
}
|
|
|
|
var displayAttribute = fieldInfo.GetCustomAttribute<DisplayAttribute>();
|
|
|
|
if (displayAttribute != null)
|
|
{
|
|
return displayAttribute.Name;
|
|
}
|
|
|
|
return enumValue.ToString();
|
|
}
|
|
|
|
public static string GetShortName(this Enum enumValue)
|
|
{
|
|
var memberInfo = enumValue.GetType().GetMember(enumValue.ToString()).FirstOrDefault();
|
|
|
|
if (memberInfo != null)
|
|
{
|
|
var displayAttribute = memberInfo.GetCustomAttribute<DisplayAttribute>();
|
|
|
|
if (displayAttribute != null && !string.IsNullOrEmpty(displayAttribute.Description))
|
|
{
|
|
return displayAttribute.Description;
|
|
}
|
|
}
|
|
|
|
return enumValue.ToString();
|
|
}
|
|
}
|
|
}
|