diff --git a/StudentManager/Common/SQLHelper.cs b/StudentManager/Common/SQLHelper.cs index 09fd088..7625fb8 100644 --- a/StudentManager/Common/SQLHelper.cs +++ b/StudentManager/Common/SQLHelper.cs @@ -1,5 +1,6 @@ using DryIoc.ImTools; using MySql.Data.MySqlClient; +using Newtonsoft.Json; using StudentManager.Common; using StudentManager.Data; using System; @@ -16,6 +17,7 @@ namespace StudentManager.Common static public string UserTable { get; } = "users"; static public string QuesTable { get; } = "questions"; static public string UQTable { get; } = "user_data"; + static public string CQTable { get; } = "curson_questions"; } @@ -35,7 +37,9 @@ namespace StudentManager.Common (data as StudentData).Gender = reader[2].ToString(); (data as StudentData).Contact = reader[3].ToString(); (data as StudentData).Address = reader[4].ToString(); - (data as StudentData).Grade = (int)reader[5]; + (data as StudentData).Grade = (byte)reader[5]; + (data as StudentData).TotalsQuestions = (UInt16)reader[6]; + (data as StudentData).CorrectionCount = (UInt16)reader[7]; } else if(typeof(T) == typeof(QuestionData)) { @@ -53,6 +57,15 @@ namespace StudentManager.Common Enum.TryParse(reader[8].ToString(), true, out qStatus); (data as QuestionData).Status = qStatus; } + else if (typeof(T) == typeof(CursonQuestionsData)) + { + + (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]; + + } @@ -87,7 +100,7 @@ namespace StudentManager.Common List result = new List(); - string idName = typeof(T) == typeof(StudentData) ? Tables.UserTable : Tables.QuesTable; + string idName = typeof(T) == typeof(StudentData) ? Tables.UserTable : typeof(T) == typeof(QuestionData) ? Tables.QuesTable : Tables.CQTable; try { connection.Open(); diff --git a/StudentManager/Data/CursonQuestionsData.cs b/StudentManager/Data/CursonQuestionsData.cs new file mode 100644 index 0000000..dc06b8f --- /dev/null +++ b/StudentManager/Data/CursonQuestionsData.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentManager.Data +{ + public class CursonQuestionsData + { + public int UID { get; set; } = 0; + public int[] ProblemIDS { get; set; } = { }; + public int[] CorrectIDS { get; set; } = { }; + public int lesson = 0; + + } +} diff --git a/StudentManager/Data/QuestionData.cs b/StudentManager/Data/QuestionData.cs index 47c0d4e..e38bfed 100644 --- a/StudentManager/Data/QuestionData.cs +++ b/StudentManager/Data/QuestionData.cs @@ -30,6 +30,7 @@ namespace StudentManager.Data public string Category { get; set; } = string.Empty; public string Tags { get; set; } = string.Empty; public string Source { get; set; } = string.Empty; + public int Lesson { get; set; } = 0; public QStatus Status { get; set; } = QStatus.published; diff --git a/StudentManager/Editor/DetailView.xaml b/StudentManager/Editor/DetailView.xaml new file mode 100644 index 0000000..b595849 --- /dev/null +++ b/StudentManager/Editor/DetailView.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/StudentManager/Editor/DetailView.xaml.cs b/StudentManager/Editor/DetailView.xaml.cs new file mode 100644 index 0000000..7149afc --- /dev/null +++ b/StudentManager/Editor/DetailView.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 +{ + /// + /// DetailView.xaml 的交互逻辑 + /// + public partial class DetailView : UserControl + { + public DetailView() + { + InitializeComponent(); + } + } +} diff --git a/StudentManager/Model/Students.cs b/StudentManager/Model/Students.cs index 2469518..3eb2e71 100644 --- a/StudentManager/Model/Students.cs +++ b/StudentManager/Model/Students.cs @@ -80,8 +80,7 @@ namespace StudentManager.Model this.regionManager = regionManager; QueryAll(); - - Query(); + } private void RegionToStudents() @@ -101,8 +100,8 @@ namespace StudentManager.Model studentDatas.Clear(); questionDatas.Clear(); SQLHelper.Query(Tables.UserTable).ForEach(x => studentDatas.Add(x)); - SQLHelper.Query(Tables.QuesTable).ForEach(x => questionDatas.Add(x)); - //SQLHelper.UnionQuery(1).ForEach(x => questionDatas.Add(x)); + //SQLHelper.Query(Tables.QuesTable).ForEach(x => questionDatas.Add(x)); + SQLHelper.UnionQuery(1).ForEach(x => questionDatas.Add(x)); } } } diff --git a/StudentManager/StudentManager.csproj b/StudentManager/StudentManager.csproj index cbd6c43..7158781 100644 --- a/StudentManager/StudentManager.csproj +++ b/StudentManager/StudentManager.csproj @@ -10,6 +10,7 @@ + diff --git a/StudentManager/StudentManager.csproj.user b/StudentManager/StudentManager.csproj.user index bfa7adc..db48d24 100644 --- a/StudentManager/StudentManager.csproj.user +++ b/StudentManager/StudentManager.csproj.user @@ -7,6 +7,9 @@ + + Code + Code @@ -18,6 +21,9 @@ + + Designer + Designer