From 1e914941de3fc963689999c7694e5cbf87d55b40 Mon Sep 17 00:00:00 2001 From: wangxiner55 <1468441589@qq.com> Date: Tue, 10 Sep 2024 19:17:56 +0800 Subject: [PATCH] User --- StudentManager/App.xaml.cs | 3 + StudentManager/Common/SQLHelper.cs | 12 +- StudentManager/Data/CursonQuestionsData.cs | 10 +- StudentManager/Data/StudentData.cs | 4 + StudentManager/Editor/CheckView.xaml | 49 +++++++++ StudentManager/Editor/CheckView.xaml.cs | 28 +++++ StudentManager/Editor/DetailCheckView.xaml | 28 +++++ StudentManager/Editor/DetailCheckView.xaml.cs | 28 +++++ StudentManager/Editor/DetailView.xaml | 104 +++++++++++++++++- StudentManager/Editor/DetailView.xaml.cs | 14 ++- StudentManager/Editor/MainEditor.xaml | 5 +- StudentManager/Editor/StudentsView.xaml | 29 +++-- StudentManager/Model/Students.cs | 101 ++++++++++++++++- StudentManager/StudentManager.csproj.user | 12 ++ 14 files changed, 403 insertions(+), 24 deletions(-) create mode 100644 StudentManager/Editor/CheckView.xaml create mode 100644 StudentManager/Editor/CheckView.xaml.cs create mode 100644 StudentManager/Editor/DetailCheckView.xaml create mode 100644 StudentManager/Editor/DetailCheckView.xaml.cs diff --git a/StudentManager/App.xaml.cs b/StudentManager/App.xaml.cs index 9932779..f90829b 100644 --- a/StudentManager/App.xaml.cs +++ b/StudentManager/App.xaml.cs @@ -21,6 +21,9 @@ namespace StudentManager containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); } } diff --git a/StudentManager/Common/SQLHelper.cs b/StudentManager/Common/SQLHelper.cs index 7625fb8..5c7829d 100644 --- a/StudentManager/Common/SQLHelper.cs +++ b/StudentManager/Common/SQLHelper.cs @@ -61,10 +61,12 @@ namespace StudentManager.Common { (data as CursonQuestionsData).UID = (int)reader[0]; - (data as CursonQuestionsData).ProblemIDS = JsonConvert.DeserializeObject(reader[1].ToString()); - (data as CursonQuestionsData).CorrectIDS = JsonConvert.DeserializeObject(reader[2].ToString()); - (data as CursonQuestionsData).lesson = (int)reader[3]; - + (data as CursonQuestionsData).ProblemIDS = string.IsNullOrEmpty(reader[1].ToString()) ? Array.Empty() : JsonConvert.DeserializeObject(reader[1].ToString()); + (data as CursonQuestionsData).CorrectIDS = string.IsNullOrEmpty(reader[2].ToString()) ? Array.Empty() : JsonConvert.DeserializeObject(reader[2].ToString()); + (data as CursonQuestionsData).Lesson = (byte)reader[3]; + (data as CursonQuestionsData).Status = (byte)reader[4]; + (data as CursonQuestionsData).TotalCount = (data as CursonQuestionsData).ProblemIDS.Length; + (data as CursonQuestionsData).CorrectCount = (data as CursonQuestionsData).CorrectIDS.Length; } @@ -100,7 +102,7 @@ namespace StudentManager.Common List result = new List(); - string idName = typeof(T) == typeof(StudentData) ? Tables.UserTable : typeof(T) == typeof(QuestionData) ? Tables.QuesTable : Tables.CQTable; + string idName = typeof(T) == typeof(StudentData) ? "user_id" : typeof(T) == typeof(QuestionData) ? "problem_id" : "user_id"; try { connection.Open(); diff --git a/StudentManager/Data/CursonQuestionsData.cs b/StudentManager/Data/CursonQuestionsData.cs index dc06b8f..74946b0 100644 --- a/StudentManager/Data/CursonQuestionsData.cs +++ b/StudentManager/Data/CursonQuestionsData.cs @@ -6,12 +6,18 @@ using System.Threading.Tasks; namespace StudentManager.Data { - public class CursonQuestionsData + public class CursonQuestionsData : IDataCommon { public int UID { get; set; } = 0; public int[] ProblemIDS { get; set; } = { }; public int[] CorrectIDS { get; set; } = { }; - public int lesson = 0; + public int Lesson { get; set; } = 0; + public int TotalCount { get; set; } = 0; + public int CorrectCount { get; set; } = 0; + public int Status { get; set; } = 0; + + + public string TableName { get => "users"; set => throw new NotImplementedException(); } } } diff --git a/StudentManager/Data/StudentData.cs b/StudentManager/Data/StudentData.cs index 7f9a08d..2f744bd 100644 --- a/StudentManager/Data/StudentData.cs +++ b/StudentManager/Data/StudentData.cs @@ -18,6 +18,10 @@ namespace StudentManager.Data public int CorrectionCount { get; set; } = 0; + public float ErrorRate { get; set; } = 0; + public float CorrectRate { get; set; } = 0; + public int UnCorrectCount { get; set; } = 0; + public string TableName { get => "users"; set => throw new NotImplementedException(); } diff --git a/StudentManager/Editor/CheckView.xaml b/StudentManager/Editor/CheckView.xaml new file mode 100644 index 0000000..24f2f96 --- /dev/null +++ b/StudentManager/Editor/CheckView.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StudentManager/Editor/CheckView.xaml.cs b/StudentManager/Editor/CheckView.xaml.cs new file mode 100644 index 0000000..a99b67b --- /dev/null +++ b/StudentManager/Editor/CheckView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace StudentManager.Editor +{ + /// + /// CheckView.xaml 的交互逻辑 + /// + public partial class CheckView : UserControl + { + public CheckView() + { + InitializeComponent(); + } + } +} diff --git a/StudentManager/Editor/DetailCheckView.xaml b/StudentManager/Editor/DetailCheckView.xaml new file mode 100644 index 0000000..7440aa8 --- /dev/null +++ b/StudentManager/Editor/DetailCheckView.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + +