CursonQuestionsTable
This commit is contained in:
parent
2633d93ee7
commit
16c224fa65
@ -1,5 +1,6 @@
|
|||||||
using DryIoc.ImTools;
|
using DryIoc.ImTools;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using StudentManager.Common;
|
using StudentManager.Common;
|
||||||
using StudentManager.Data;
|
using StudentManager.Data;
|
||||||
using System;
|
using System;
|
||||||
@ -16,6 +17,7 @@ namespace StudentManager.Common
|
|||||||
static public string UserTable { get; } = "users";
|
static public string UserTable { get; } = "users";
|
||||||
static public string QuesTable { get; } = "questions";
|
static public string QuesTable { get; } = "questions";
|
||||||
static public string UQTable { get; } = "user_data";
|
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).Gender = reader[2].ToString();
|
||||||
(data as StudentData).Contact = reader[3].ToString();
|
(data as StudentData).Contact = reader[3].ToString();
|
||||||
(data as StudentData).Address = reader[4].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))
|
else if(typeof(T) == typeof(QuestionData))
|
||||||
{
|
{
|
||||||
@ -53,6 +57,15 @@ namespace StudentManager.Common
|
|||||||
Enum.TryParse(reader[8].ToString(), true, out qStatus);
|
Enum.TryParse(reader[8].ToString(), true, out qStatus);
|
||||||
(data as QuestionData).Status = 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<int[]>(reader[1].ToString());
|
||||||
|
(data as CursonQuestionsData).CorrectIDS = JsonConvert.DeserializeObject<int[]>(reader[2].ToString());
|
||||||
|
(data as CursonQuestionsData).lesson = (int)reader[3];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +100,7 @@ namespace StudentManager.Common
|
|||||||
|
|
||||||
List<T> result = new List<T>();
|
List<T> result = new List<T>();
|
||||||
|
|
||||||
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
|
try
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
17
StudentManager/Data/CursonQuestionsData.cs
Normal file
17
StudentManager/Data/CursonQuestionsData.cs
Normal file
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,7 @@ namespace StudentManager.Data
|
|||||||
public string Category { get; set; } = string.Empty;
|
public string Category { get; set; } = string.Empty;
|
||||||
public string Tags { get; set; } = string.Empty;
|
public string Tags { get; set; } = string.Empty;
|
||||||
public string Source { get; set; } = string.Empty;
|
public string Source { get; set; } = string.Empty;
|
||||||
|
public int Lesson { get; set; } = 0;
|
||||||
public QStatus Status { get; set; } = QStatus.published;
|
public QStatus Status { get; set; } = QStatus.published;
|
||||||
|
|
||||||
|
|
||||||
|
12
StudentManager/Editor/DetailView.xaml
Normal file
12
StudentManager/Editor/DetailView.xaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="StudentManager.Editor.DetailView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
28
StudentManager/Editor/DetailView.xaml.cs
Normal file
28
StudentManager/Editor/DetailView.xaml.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DetailView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DetailView : UserControl
|
||||||
|
{
|
||||||
|
public DetailView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -80,8 +80,7 @@ namespace StudentManager.Model
|
|||||||
this.regionManager = regionManager;
|
this.regionManager = regionManager;
|
||||||
|
|
||||||
QueryAll();
|
QueryAll();
|
||||||
|
|
||||||
Query();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegionToStudents()
|
private void RegionToStudents()
|
||||||
@ -101,8 +100,8 @@ namespace StudentManager.Model
|
|||||||
studentDatas.Clear();
|
studentDatas.Clear();
|
||||||
questionDatas.Clear();
|
questionDatas.Clear();
|
||||||
SQLHelper.Query<StudentData>(Tables.UserTable).ForEach(x => studentDatas.Add(x));
|
SQLHelper.Query<StudentData>(Tables.UserTable).ForEach(x => studentDatas.Add(x));
|
||||||
SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => questionDatas.Add(x));
|
//SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => questionDatas.Add(x));
|
||||||
//SQLHelper.UnionQuery<QuestionData>(1).ForEach(x => questionDatas.Add(x));
|
SQLHelper.UnionQuery<QuestionData>(1).ForEach(x => questionDatas.Add(x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MySql.Data" Version="9.0.0" />
|
<PackageReference Include="MySql.Data" Version="9.0.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Prism.DryIoc" Version="9.0.537" />
|
<PackageReference Include="Prism.DryIoc" Version="9.0.537" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Editor\DetailView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Editor\MainEditor.xaml.cs">
|
<Compile Update="Editor\MainEditor.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -18,6 +21,9 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Editor\DetailView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Editor\MainEditor.xaml">
|
<Page Update="Editor\MainEditor.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
Loading…
Reference in New Issue
Block a user