UIAndData

This commit is contained in:
wangxiner55 2024-09-27 19:07:59 +08:00
parent ab4d872f3e
commit 6ace9eabd8
17 changed files with 614 additions and 260 deletions

View File

@ -11,6 +11,5 @@ namespace StudentManager.Common
public int CursonIndex { get; set; } = 0;
public int CursonCount { get; set; } = 0;
public string CursonName { get; set; } = string.Empty;
}
}

View File

@ -52,6 +52,11 @@ namespace StudentManager.Common
public List<int> CorrectArray { get; set; } = new List<int>();
public int CorrectThresholds { get; set; } = 2;
public ErrorBase Get(int id)
{
return Errores.ContainsKey(id) ? Errores[id] : null;
}
public void UpdateErrorSetData()
{
foreach (var item in Errores)
@ -90,6 +95,7 @@ namespace StudentManager.Common
QuestionData = QuestionLib.Get(item.Key),
CorrectCount = item.Value.CorrectCount,
ErrorCount = item.Value.ErrorCount,
TotalUseCount = item.Value.TotalUseCount,
Status = item.Value.QuestionBase.Status
});
}
@ -174,9 +180,9 @@ namespace StudentManager.Common
{
Errores.Clear();
SQLHelper.Query<UserQuestionData>(id).ForEach(x =>
SQLHelper.Instance.Query<UserQuestionData>(id).ForEach(x =>
{
AddQuestion(new QuestionBase { ID = x.PID, Status = x.Status });
Errores.Add(x.PID, new ErrorBase { CorrectCount = x.CorrectCount, ErrorCount = x.ErrorCount, TotalUseCount = x.CorrectCount + x.ErrorCount, QuestionBase = new QuestionBase { ID= x.PID, Status = x.Status } });
});
}
}

View File

@ -1,4 +1,5 @@
using StudentManager.Data;
using StudentManager.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
@ -7,15 +8,15 @@ using System.Threading.Tasks;
namespace StudentManager.Common
{
public static class FileSystem
public class FileSystem : Singleton<FileSystem>
{
public static void SaveAll()
public void SaveAll()
{
StudentLib.Save();
QuestionLib.Save();
}
public static void FreashAllInfo()
public void FreashAllInfo()
{
StudentLib.FreshAllStudentInfo();
QuestionLib.FreshAllQuestion();

View File

@ -1,7 +1,9 @@
using DryIoc.ImTools;
using StudentManager.Data;
using StudentManager.Interface;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@ -9,16 +11,19 @@ using System.Threading.Tasks;
namespace StudentManager.Common
{
public static class HomeWorkManager
public class HomeWorkManager : Singleton<HomeWorkManager>
{
public static HomeWork CommonHomeWork { get; set; } = new HomeWork();
public static void PublicHomework(uint lesson, bool appedCommonWork = false, bool appendErrorSet = false, int workNum = -1)
public void PublicHomework(uint lesson, bool appedCommonWork = false, bool appendErrorSet = false, int workNum = -1)
{
foreach (var item in StudentLib.StudentDic)
{
item.Value.PublicHomeWork(lesson, appedCommonWork, appendErrorSet, workNum);
}
}
internal void DeleteHomework(DetailHomeWorkSetInfo homeWork)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,4 +1,5 @@
using DryIoc.ImTools;
using LiveCharts;
using MySqlX.XDevAPI;
using StudentManager.Data;
using System;
@ -40,7 +41,7 @@ namespace StudentManager.Common
public List<QuestionBase> Questions { get; set; } = new List<QuestionBase>();
public int TotalCount { get; set; } = 0;
public int TotalCount { get{return Questions.Count;} }
public int ErrorCount { get; set; } = 0;
public int CorrectCount { get; set; } = 0;
@ -69,11 +70,11 @@ namespace StudentManager.Common
return list;
}
public void UpdateData()
public void UpdateData(bool FirstAdd = false)
{
CorrectCount = 0;
ErrorCount = 0;
TotalCount = Questions.Count;
if(FirstAdd) return;
foreach (var item in Questions)
{
if (item.Status == true) CorrectCount++;
@ -92,7 +93,6 @@ namespace StudentManager.Common
public void AddHomeWork(int id)
{
Questions.Add(new QuestionBase { ID = id });
UpdateData();
}
public void RemoveHomeWork(QuestionBase workInfo)
@ -136,25 +136,61 @@ namespace StudentManager.Common
public int TotalCorrectQuestionCount { get; set; } = 0;
public int TotalErrorQuestionRate { get; set; } = 0;
[JsonIgnore]
public List<string> Lessons { get; set; } = new List<string>();
[JsonIgnore]
public ChartValues<double> ErrorCounts { get; set; } = new ChartValues<double>();
[JsonIgnore]
public ChartValues<double> CorrectCounts { get; set; } = new ChartValues<double>();
public void UpdateDataView()
{
if(ErrorCounts.Count == 0)
{
foreach (var item in HomeWorks)
{
Lessons.Add(item.Key.ToString());
ErrorCounts.Add(item.Value.ErrorCount);
CorrectCounts.Add(item.Value.CorrectCount);
}
}
}
public void UpdateDate()
{
TotalSetCount = HomeWorks.Count;
TotalQuestionCount = 0;
TotalErrorQuestionCount = 0;
TotalCorrectQuestionCount = 0;
Lessons.Clear();
ErrorCounts.Clear();
CorrectCounts.Clear();
foreach (var item in HomeWorks)
{
TotalQuestionCount = item.Value.TotalCount;
TotalErrorQuestionCount = item.Value.ErrorCount;
TotalCorrectQuestionCount = item.Value.CorrectCount;
TotalQuestionCount += item.Value.TotalCount;
TotalErrorQuestionCount += item.Value.ErrorCount;
TotalCorrectQuestionCount += item.Value.CorrectCount;
Lessons.Add(item.Key.ToString());
ErrorCounts.Add(item.Value.ErrorCount);
CorrectCounts.Add(item.Value.CorrectCount);
}
TotalErrorQuestionRate = TotalQuestionCount == 0 ? 0 : TotalErrorQuestionCount / TotalQuestionCount;
}
TotalErrorQuestionRate = TotalErrorQuestionCount / TotalQuestionCount;
public bool Contain(uint id)
{
return HomeWorks.ContainsKey(id);
}
public void AddHomeWork(HomeWork homeWork)
{
HomeWorks.Add(homeWork.Lesson, homeWork);
UpdateDate();
}
public ObservableCollection<DetailHomeWorkInfo> GetDetailHomeWorkList(uint lesson)
@ -164,16 +200,8 @@ namespace StudentManager.Common
{
list.Add(new DetailHomeWorkInfo
{
//QuestionData = {
// QuestionData = QuestionLib.Get(item.ID),
// Status = item.Status },
QuestionData = QuestionLib.Get(item.ID),
Status = item.Status,
//Lesson = HomeWorks[lesson].Lesson,
//DateTime = HomeWorks[lesson].DateTime,
//TotalCount = HomeWorks[lesson].TotalCount,
//ErrorCount = HomeWorks[lesson].ErrorCount,
//CorrectCount = HomeWorks[lesson].CorrectCount,
PID = item.ID
});
@ -239,16 +267,15 @@ namespace StudentManager.Common
{
HomeWorks.Clear();
SQLHelper.Query<CursonQuestionsData>(id).ForEach(x =>
SQLHelper.Instance.Query<CursonQuestionsData>(id).ForEach(x =>
{
List<QuestionBase> Questions = new List<QuestionBase>();
x.ProblemIDS.ForEach(y => Questions.Add(new QuestionBase { ID = y, Status = x.CorrectIDS.Contains(y) }));
HomeWorks.Add(x.Lesson, new HomeWork
{
Lesson = x.Lesson,
TotalCount = x.ProblemIDS.Length,
CorrectCount = x.CorrectCount,
ErrorCount = x.TotalCount - x.CorrectCount,
ErrorCount = x.Status == 1 ? x.TotalCount - x.CorrectCount : 0,
DateTime = x.DateTime,
Questions = Questions,
Status = x.Status == 1
@ -257,6 +284,12 @@ namespace StudentManager.Common
UpdateDate();
}
internal void DeleteHomework(uint lesson)
{
HomeWorks.Remove(lesson);
UpdateDate();
}
}
}

View File

@ -7,18 +7,10 @@ using System.Diagnostics;
using System;
using Enum = System.Enum;
using System.Security.Cryptography;
using StudentManager.Interface;
namespace StudentManager.Common
{
static class Tables
{
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";
}
public static class SQLMapping
{
public static void Mapping<T>(MySqlDataReader reader)
@ -66,7 +58,7 @@ namespace StudentManager.Common
else if (typeof(T) == typeof(CursonQuestionsData))
{
(data as CursonQuestionsData).UID = (int)reader[0];
(data as CursonQuestionsData).UID = (long)reader[0];
(data as CursonQuestionsData).ProblemIDS = string.IsNullOrEmpty(reader[1].ToString()) ? Array.Empty<int>() : JsonConvert.DeserializeObject<int[]>(reader[1].ToString());
(data as CursonQuestionsData).CorrectIDS = string.IsNullOrEmpty(reader[2].ToString()) ? Array.Empty<int>() : JsonConvert.DeserializeObject<int[]>(reader[2].ToString());
(data as CursonQuestionsData).Lesson = (uint)reader[3];
@ -82,28 +74,12 @@ namespace StudentManager.Common
(data as UserQuestionData).CorrectCount = (byte)reader[3];
(data as UserQuestionData).Status = (byte)reader[4] == 1;
}
//for (int i = 0; i < reader.FieldCount; ++i)
//{
// data?.GetType().GetProperties().ForEach(x => { x.SetValue(reader[i].GetType(), reader[i]); });
//}
}
}
}
struct userTable
public class SQLHelper : Singleton<SQLHelper>
{
}
public static class SQLHelper
{
private static Dictionary<System.Type, string> TypeMap = new Dictionary<System.Type, string>
private Dictionary<System.Type, string> TypeMap = new Dictionary<System.Type, string>
{
{ typeof(QuestionData), "questions" },
{ typeof(CursonQuestionsData), "curson_questions" },
@ -111,127 +87,91 @@ namespace StudentManager.Common
{ typeof(UserQuestionData), "user_data" },
};
static string config = "server=8.137.125.29;port=3306;user=StudentManager;password=wangxin55;database=studentmanager";
static MySqlConnection connection = null;
static MySqlCommand cmd = null;
private string config = "server=8.137.125.29;port=3306;user=StudentManager;password=wangxin55;database=studentmanager";
private MySqlConnection connection = null;
private MySqlCommand cmd = null;
// update ** set ** = '**',... where ** = **;
// insert into ** values('**','**'...);
// delete from ** where ** = **;
public static List<T> Query<T>(long id = 9999999, params string[] queryParams) where T : IDataCommon, new()
public List<T> Query<T>(long? id = null, params string[] queryParams) where T : IDataCommon, new()
{
string tableName = string.Empty;
TypeMap.TryGetValue(typeof(T), out tableName);
connection = new MySqlConnection(config);
using (var connection = new MySqlConnection(config))
{
List<T> result = new List<T>();
string idName = typeof(T) == typeof(StudentData) ? "user_id" : typeof(T) == typeof(QuestionData) ? "problem_id" : "user_id";
try
{
connection.Open();
string queryStr = "";
if (queryParams.Length > 0)
{
string filedList = string.Join(",", queryParams);
queryStr = $"select {filedList} from {tableName};";
string fieldList = string.Join(",", queryParams);
queryStr = $"SELECT {fieldList} FROM {tableName}";
if (id != 9999999)
queryStr = $@"select {filedList} from {tableName} WHERE {idName} = {id};";
if (id.HasValue)
queryStr += $" WHERE {idName} = @id";
}
else
{
queryStr = $"select * from {tableName};";
if (id != 9999999)
queryStr = $@"select * from {tableName} WHERE {idName} = {id};";
queryStr = $"SELECT * FROM {tableName}";
if (id.HasValue)
queryStr += $" WHERE {idName} = @id";
}
cmd = new MySqlCommand(queryStr, connection);
MySqlDataReader reader = cmd.ExecuteReader();
using (var cmd = new MySqlCommand(queryStr, connection))
{
if (id.HasValue)
cmd.Parameters.AddWithValue("@id", id.Value);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
T row = new T();
SQLMapping.Mapping(row, reader);
result.Add(row);
}
return result;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
finally
{
cmd.Dispose();
connection.Close();
}
}
public static List<T> UnionQuery<T>(int id = 9999999, string tableName = "questions", string otherTable = "user_data") where T : IDataCommon, new()
{
connection = new MySqlConnection(config);
List<T> result = new List<T>();
try
{
connection = new MySqlConnection(config);
string queryStr = "";
if (id == 9999999)
queryStr = $@"SELECT u.user_id, q.* FROM {otherTable} u JOIN {tableName} q ON u.problem_id = q.problem_id";
else
queryStr = $@"SELECT q.* FROM {tableName} q JOIN {otherTable} u ON q.problem_id = u.problem_id WHERE u.user_id = {id}";
cmd = new MySqlCommand(queryStr, connection);
MySqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
T row = new T();
SQLMapping.Mapping(row, reader);
result.Add(row);
}
return result;
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return new List<T> { };
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
Console.WriteLine($"General error: {ex.Message}");
return new List<T> { };
}
finally
{
cmd.Dispose();
connection.Close();
}
}
public static void Add<T>(T value)
public bool Add<T>(T value) where T : IDataCommon
{
string tableName = string.Empty;
TypeMap.TryGetValue(typeof(T), out tableName);
using (var connection = new MySqlConnection(config))
{
connection = new MySqlConnection(config);
try
{
string stableName = string.Empty;
TypeMap.TryGetValue(typeof(T), out stableName);
connection.Open();
if (typeof(T) == typeof(QuestionData))
{
var ques = value as QuestionData;
string sql = $"INSERT INTO {stableName} " +
$"(problem_id, problem_type, problem_stem, problem_answer, difficulty_level, category, tags, source, lesson, status) " +
$"VALUES (@Id, @Type, @Stem, @Answer, @DifficultyLevel, @Category, @Tags, @Source, @Lesson, @Status)";
string sql = $"INSERT INTO {tableName} " +
"(problem_id, problem_type, problem_stem, problem_answer, difficulty_level, category, tags, source, lesson, status) " +
"VALUES (@Id, @Type, @Stem, @Answer, @DifficultyLevel, @Category, @Tags, @Source, @Lesson, @Status)";
MySqlCommand cmd = new MySqlCommand(sql, connection);
using (var cmd = new MySqlCommand(sql, connection))
{
cmd.Parameters.AddWithValue("@Id", ques.Id);
cmd.Parameters.AddWithValue("@Type", ques.Type.ToString());
cmd.Parameters.AddWithValue("@Stem", ques.Stem);
@ -244,24 +184,89 @@ namespace StudentManager.Common
cmd.Parameters.AddWithValue("@Status", ques.Status.ToString());
cmd.ExecuteNonQuery();
cmd.Dispose();
}
//string sql = $"insert into {stableName}"
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine($"General error: {ex.Message}");
return false;
}
finally
{
//cmd.Dispose();
connection.Close();
return true;
}
}
internal static void UpdateErrorSet(long UID, int PID, bool status)
public bool Delete<T>(T value) where T : IDataCommon
{
string tableName = string.Empty;
TypeMap.TryGetValue(typeof(T), out tableName);
using (var connection = new MySqlConnection(config))
{
try
{
connection.Open();
if (typeof(T) == typeof(CursonQuestionsData))
{
var ques = value as CursonQuestionsData;
string sql = "DELETE FROM " +
$"{tableName} " +
"WHERE user_id = @user_id AND lesson = @lesson";
using (var cmd = new MySqlCommand(sql, connection))
{
cmd.Parameters.AddWithValue("@user_id", ques.UID);
cmd.Parameters.AddWithValue("@lesson", ques.Lesson);
cmd.ExecuteNonQuery();
}
}
if (typeof(T) == typeof(QuestionData))
{
var ques = value as QuestionData;
if (ques == null)
{
Console.WriteLine($"ERROR: Check Input");
return false;
}
string sql = $"DELETE " +
$"FROM {tableName}" +
"WHERE problem_id = @problem_id";
using (var cmd = new MySqlCommand(sql, connection))
{
cmd.Parameters.AddWithValue("@problem_id", ques.Id);
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine($"General error: {ex.Message}");
return false;
}
return true;
}
}
internal bool UpdateErrorSet(long UID, ErrorBase error)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
@ -274,32 +279,35 @@ namespace StudentManager.Common
using (MySqlCommand checkCmd = new MySqlCommand(checkQuery, connection))
{
checkCmd.Parameters.AddWithValue("@user_id", UID);
checkCmd.Parameters.AddWithValue("@problem_id", PID);
checkCmd.Parameters.AddWithValue("@problem_id", error.QuestionBase.ID);
int recordCount = Convert.ToInt32(checkCmd.ExecuteScalar());
if (recordCount > 0)
{
// 记录存在,执行更新操作
string updateQuery = "UPDATE user_data SET status = @status WHERE user_id = @user_id AND problem_id = @problem_id";
string updateQuery = "UPDATE user_data SET status = @status, error_count = @error_count, correct_count = @correct_count" +
" WHERE user_id = @user_id AND problem_id = @problem_id";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", UID);
updateCmd.Parameters.AddWithValue("@problem_id", PID);
updateCmd.Parameters.AddWithValue("@status", status);
updateCmd.Parameters.AddWithValue("@problem_id", error.QuestionBase.ID);
updateCmd.Parameters.AddWithValue("@error_count", error.ErrorCount);
updateCmd.Parameters.AddWithValue("@correct_count", error.CorrectCount);
updateCmd.Parameters.AddWithValue("@status", error.QuestionBase.Status);
updateCmd.ExecuteNonQuery();
}
}
else
{
if (status == false)
if (error.QuestionBase.Status == false)
{
string updateQuery = $"INSERT INTO user_data (user_id, problem_id) VALUES (@user_id, @problem_id)";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", UID);
updateCmd.Parameters.AddWithValue("@problem_id", PID);
updateCmd.Parameters.AddWithValue("@problem_id", error.QuestionBase.ID);
updateCmd.ExecuteNonQuery();
}
@ -307,18 +315,26 @@ namespace StudentManager.Common
}
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
finally
{
connection.Close();
}
return true;
}
}
internal static void UpdateHomework(long UID, uint lesson, string totalArray, string correctArray, DateTime dateTime, bool status)
internal bool UpdateHomework(long UID, uint lesson, string totalArray, string correctArray, DateTime dateTime, bool status)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
@ -341,19 +357,104 @@ namespace StudentManager.Common
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
finally
{
connection.Close();
}
return true;
}
}
internal static void AddHomework(CursonQuestionsData homeWork)
internal bool UpdateErrorSetUserInfo(long UID, uint totalCont, uint totalCorrectCount)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
try
{
connection.Open();
string updateQuery = "UPDATE users SET errset_totals_questions = @totalCont, errset_correction_count = @totalErrorCount " +
" WHERE user_id = @user_id";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", UID);
updateCmd.Parameters.AddWithValue("@totalCont", totalCont);
updateCmd.Parameters.AddWithValue("@totalErrorCount", totalCorrectCount);
updateCmd.ExecuteNonQuery();
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
finally
{
connection.Close();
}
return true;
}
}
internal bool UpdateHomeworkTotalInfo(long UID, uint totalCont, uint totalErrorCount)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
try
{
connection.Open();
string updateQuery = "UPDATE users SET total_hwq_count = @totalCont, total_hwq_error_count = @totalErrorCount, " +
"WHERE user_id = @user_id";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", UID);
updateCmd.Parameters.AddWithValue("@totalCont", totalCont);
updateCmd.Parameters.AddWithValue("@totalErrorCount", totalErrorCount);
updateCmd.ExecuteNonQuery();
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
finally
{
connection.Close();
}
return true;
}
}
internal bool AddHomework(CursonQuestionsData homeWork)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
@ -375,19 +476,37 @@ namespace StudentManager.Common
updateCmd.ExecuteNonQuery();
}
updateQuery = "UPDATE users SET home_work = @lesson " +
"WHERE user_id = @user_id";
using (MySqlCommand updateCmd = new MySqlCommand(updateQuery, connection))
{
updateCmd.Parameters.AddWithValue("@user_id", homeWork.UID);
updateCmd.Parameters.AddWithValue("@lesson", homeWork.Lesson);
updateCmd.ExecuteNonQuery();
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
return false;
}
finally
{
connection.Close();
}
return true;
}
}
internal static void UpdateQuestion(QuestionData ques)
internal bool UpdateQuestion(QuestionData ques)
{
using (MySqlConnection connection = new MySqlConnection(config))
{
@ -425,14 +544,21 @@ namespace StudentManager.Common
Console.WriteLine($"{rowsAffected} rows updated.");
}
}
catch (MySqlException ex)
{
Console.WriteLine($"MySQL error: {ex.Message}");
return false;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}
finally
{
connection.Close();
}
return true;
}
}
}

View File

@ -70,8 +70,8 @@ namespace StudentManager.Data
QuestionDic.Clear ();
QuestionTableDic.Clear ();
QuestionTableDesc.Clear ();
SQLHelper.Query<QuestionData>().ForEach(x => QuestionDic.Add(x.Id, x));
SQLHelper.Query<QuestionData>().ForEach(x => {
SQLHelper.Instance.Query<QuestionData>().ForEach(x => QuestionDic.Add(x.Id, x));
SQLHelper.Instance.Query<QuestionData>().ForEach(x => {
if (!QuestionTableDic.ContainsKey(x.Lesson))
{
QuestionTableDic[x.Lesson] = new Dictionary<int, QuestionData>();
@ -136,7 +136,7 @@ namespace StudentManager.Data
QuestionTableDesc[question.Lesson].UpdateTime = DateTime.Now;
QuestionTableDesc[question.Lesson].TotalQuestions = (uint)QuestionTableDic[question.Lesson].Count;
SQLHelper.Add(question);
SQLHelper.Instance.Add(question);
}
public static void Remove(QuestionData question)

View File

@ -28,7 +28,7 @@ namespace StudentManager.Data
{
StudentDic.Clear();
Debug.Assert(Path.Exists(LibPath));
if (!Path.Exists(LibPath + FileName)) return;
string file = File.ReadAllText(LibPath + FileName);
StudentDic = JsonSerializer.Deserialize<Dictionary<long, StudentInfo>>(file);
}
@ -43,7 +43,7 @@ namespace StudentManager.Data
{
StudentDic.Clear();
SQLHelper.Query<StudentData>().ForEach(x =>
SQLHelper.Instance.Query<StudentData>().ForEach(x =>
StudentDic.Add(x.UID, new StudentInfo
{
UID = x.UID,
@ -51,6 +51,7 @@ namespace StudentManager.Data
Address = x.Address,
Contact = x.Contact,
Grade = x.Grade,
Gender = x.Gender,
CurrentHomeWorkIndex = x.CurronHomeWorkIndex,
}));
@ -96,6 +97,8 @@ namespace StudentManager.Data
studentData.ErrorSet.QueryErrorSet(studentData.UID);
studentData.HomeWorkSet.FreshAllHomeWork(studentData.UID);
studentData.CurentHomeWork = studentData.HomeWorkSet.Get(studentData.CurrentHomeWorkIndex);
return studentData;
}
@ -127,6 +130,10 @@ namespace StudentManager.Data
{
HomeWork homeWork = new HomeWork();
homeWork.Lesson = (uint)(HomeWorkSet.TotalSetCount + 1);
while (HomeWorkSet.Contain(homeWork.Lesson))
{
homeWork.Lesson++;
}
homeWork.DateTime = DateTime.Now;
if (appendErrorSet)
{
@ -144,7 +151,7 @@ namespace StudentManager.Data
{
}
HomeWorkSet.AddHomeWork(homeWork);
homeWork.UpdateData(true);
CursonQuestionsData cqd = new CursonQuestionsData();
@ -163,7 +170,15 @@ namespace StudentManager.Data
cqd.Status = 0;
SQLHelper.AddHomework(cqd);
if (SQLHelper.Instance.AddHomework(cqd))
{
HomeWorkSet.AddHomeWork(homeWork);
HomeWorkSet.UpdateDate();
}
else
{
//TODO: NOTIFY
}
}
}
}

View File

@ -58,7 +58,7 @@
<ContextMenu x:Key="MyModernContextMenu" Style="{StaticResource ModernContextMenuStyle}">
<MenuItem Header="查看详情" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="DetailCheckView" Style="{StaticResource ModernMenuItemStyle}"/>
<MenuItem Header="删除" Command="{Binding Option2Command}" Style="{StaticResource ModernMenuItemStyle}"/>
<MenuItem Header="删除" Command="{Binding DataContext.DeleteHomeworkCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" Style="{StaticResource ModernMenuItemStyle}"/>
</ContextMenu>
</UserControl.Resources>
<Grid Background="Transparent">
@ -69,8 +69,8 @@
</Grid.ColumnDefinitions>
<Border CornerRadius="20"/>
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0"
SelectedItem="{Binding SelectedStudent}">
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0" x:Name="StudentListBox"
SelectedItem="{Binding SelectedStudent}" Loaded="StudentListBox_Loaded">
<ListBox.Resources>
<Style TargetType="ListBox">
<Setter Property="Template">
@ -122,8 +122,8 @@
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
CommandParameter="{Binding SelectedItem, ElementName=StudentListBox}"
Command="{Binding DataContext.SelectedCommand ,ElementName=StudentListBox}"/>
</i:EventTrigger>
</i:Interaction.Triggers>

View File

@ -45,5 +45,15 @@ namespace StudentManager.Editor
}
}
}
private void StudentListBox_Loaded(object sender, RoutedEventArgs e)
{
var listBox = sender as ListBox;
if (listBox != null)
{
listBox.SetBinding(ListBox.SelectedItemProperty, new Binding("SelectedStudent") { Source = this.DataContext });
listBox.SetBinding(ListBox.ItemsSourceProperty, new Binding("StudentDatas") { Source = this.DataContext });
}
}
}
}

View File

@ -126,7 +126,7 @@ Padding="5" Height="150" Width="120" IsHitTestVisible="True">
</ItemsControl>
</ScrollViewer>
<Button Grid.Row="1" MinHeight=" 50" Content="提交" Command="{Binding SubmitHomeWorkCommand}" Style="{DynamicResource MaterialDesignFlatDarkButton}"/>
<Button Grid.Row="1" MinHeight=" 50" Content="提交" Command="{Binding UpdateHomeWorkCommand}" Style="{DynamicResource MaterialDesignFlatDarkButton}"/>
</Grid>
</Grid>

View File

@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StudentManager.Editor"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
@ -24,6 +25,7 @@
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0"
x:Name="StudentListBox" SelectedIndex="0" Loaded="StudentListBox_Loaded"
SelectedItem="{Binding SelectedStudent}">
<ListBox.Resources>
<Style TargetType="ListBox">
@ -76,8 +78,8 @@
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
CommandParameter="{Binding SelectedItem, ElementName=StudentListBox}"
Command="{Binding DataContext.SelectedCommand ,ElementName=StudentListBox}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
@ -140,13 +142,58 @@
</Border>
<Grid Grid.Row="1">
<Border Background="#FF666666" Margin="5" Grid.RowSpan="2" Grid.ColumnSpan="2" CornerRadius="10"/>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Margin="10" CornerRadius="10" Background="LightBlue">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".4*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Margin="10" >
<TextBlock Text="错题集总数量" FontWeight="Bold"
FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Margin="20,10,60,10">
<DockPanel LastChildFill="False">
<TextBlock Margin="5" Text="总数量" />
<TextBlock Margin="5" DockPanel.Dock="Right" Text="{Binding SelectedStudent.ErrorSet.TotalCount}"/>
</DockPanel>
<DockPanel LastChildFill="False">
<TextBlock Margin="5" Text="正确数量"/>
<TextBlock Margin="5" DockPanel.Dock="Right" Text="{Binding SelectedStudent.ErrorSet.CorrectCount}"/>
</DockPanel>
<DockPanel LastChildFill="False">
<TextBlock Margin="5" Text="错误数量"/>
<TextBlock Margin="5" DockPanel.Dock="Right" Text="{Binding SelectedStudent.ErrorSet.ErrorCount}"/>
</DockPanel>
</StackPanel>
</Grid>
</Border>
<Border Grid.Column="1">
<lvc:CartesianChart Series="{Binding SeriesCollection}" LegendLocation="Top">
<lvc:CartesianChart.AxisX>
<lvc:Axis Title="Time" Labels="{Binding Labels}"></lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis Title="Values"></lvc:Axis>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Border>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
@ -214,14 +261,14 @@
<TextBlock TextWrapping="Wrap" FontSize="12" Text="状态" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
Text="{Binding TotalUseCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
Text="{Binding Status}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="正确数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
Text="{Binding ErrorCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
Text="{Binding CorrectCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</Grid>
</StackPanel>

View File

@ -35,5 +35,15 @@ namespace StudentManager.Editor
{
}
private void StudentListBox_Loaded(object sender, RoutedEventArgs e)
{
var listBox = sender as ListBox;
if (listBox != null)
{
listBox.SetBinding(ListBox.SelectedItemProperty, new Binding("SelectedStudent") { Source = this.DataContext });
listBox.SetBinding(ListBox.ItemsSourceProperty, new Binding("StudentDatas") { Source = this.DataContext });
}
}
}
}

View File

@ -59,7 +59,6 @@
<ContextMenu x:Key="MyModernContextMenu" Style="{StaticResource ModernContextMenuStyle}">
<MenuItem Header="查看详情" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="DetailView" Style="{StaticResource ModernMenuItemStyle}"/>
<MenuItem Header="删除" Command="{Binding Option2Command}" Style="{StaticResource ModernMenuItemStyle}"/>
</ContextMenu>
</UserControl.Resources>
<Grid Background="Transparent">
@ -75,7 +74,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="#FFFEFEFE" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
Padding="5" Height="200" Width="120" Margin="5" IsHitTestVisible="True" MouseRightButtonDown="Border_MouseRightButtonDown">
Padding="5" Height="240" Width="120" Margin="5" IsHitTestVisible="True" MouseRightButtonDown="Border_MouseRightButtonDown">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:ChangePropertyAction PropertyName="Background" Value="#FFFEFEFE"/>
@ -98,34 +97,41 @@
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总数" Margin="5" Foreground="Gray"
<TextBlock TextWrapping="Wrap" FontSize="12" Text="错误总数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
Text="{Binding ErrorSet.TotalCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总数" Margin="5" Foreground="Gray"
<TextBlock TextWrapping="Wrap" FontSize="12" Text="修正总数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
Text="{Binding ErrorSet.TotalCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
Text="{Binding ErrorSet.CorrectCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>
<Border BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5"/>
<StackPanel Orientation="Vertical" >
<TextBlock TextWrapping="Wrap" FontSize="12" Text="作业次数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding HomeWorkSet.TotalSetCount}" Margin="5"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="正确数" Margin="5" Foreground="Gray"
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总题数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding ErrorSet.CorrectCount}" Margin="5"
<TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding HomeWorkSet.TotalQuestionCount}" Margin="5"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap" FontSize="12" Text="正确数" Margin="5" Foreground="Gray"
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总错题数" Margin="5" Foreground="Gray"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding ErrorSet.CorrectCount}" Margin="5"
<TextBlock TextWrapping="Wrap" FontSize="18" Text="{Binding HomeWorkSet.TotalErrorQuestionCount}" Margin="5"
VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentManager.Interface
{
public class Singleton<T> where T : class, new()
{
private static readonly Lazy<T> instance = new Lazy<T>(() => new T());
public Singleton() { }
public static T Instance
{
get
{
return instance.Value;
}
}
}
}

View File

@ -1,4 +1,6 @@
using DryIoc.ImTools;
using LiveCharts;
using LiveCharts.Wpf;
using Mysqlx.Crud;
using Newtonsoft.Json;
using Org.BouncyCastle.Utilities;
@ -55,7 +57,7 @@ namespace StudentManager.Model
{
private ObservableCollection<StudentInfo> studentDatas = new ObservableCollection<StudentInfo>();
public ReadOnlyObservableCollection<StudentInfo> StudentDatas { get; private set; }
public ObservableCollection<StudentInfo> StudentDatas { get { return studentDatas; } private set { studentDatas = value; RaisePropertyChanged(); } }
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
public ObservableCollection<QuestionData> QuestionDatas { get { return questionDatas; } private set { questionDatas = value; RaisePropertyChanged(); } }
@ -193,6 +195,19 @@ namespace StudentManager.Model
public SeriesCollection seriesCollection;
public SeriesCollection SeriesCollection
{
get { return seriesCollection; }
set { seriesCollection = value; RaisePropertyChanged(); }
}
public List<string> labels;
public List<string> Labels
{
get { return labels; }
set { labels = value; RaisePropertyChanged(); }
}
private readonly IRegionManager regionManager;
@ -206,7 +221,8 @@ namespace StudentManager.Model
public DelegateCommand<QuestionData> RemoveNewColumnCommand { get; set; }
public DelegateCommand<QuestionData> SelectedQuestionChangedCommand { get; set; }
public DelegateCommand RegionToDetailCommand { get; set; }
public DelegateCommand SubmitHomeWorkCommand { get; set; }
public DelegateCommand UpdateHomeWorkCommand { get; set; }
public DelegateCommand DeleteHomeworkCommand { get; set; }
public DelegateCommand AddNewColumnCommand { get; set; }
public DelegateCommand SubmitAddQuestionsCommand { get; set; }
public DelegateCommand ClearnAddQuestionsCommand { get; set; }
@ -232,19 +248,21 @@ namespace StudentManager.Model
RegionToStudents();
});
SubmitHomeWorkCommand = new DelegateCommand(() => SubmitHomeWork());
UpdateHomeWorkCommand = new DelegateCommand(() => UpdateHomeWork());
SelectedCommand = new DelegateCommand<StudentInfo>((x) =>
{
if (x == null) return;
SelectedStudent = x;
UpdateGird();
RegionToDetailView();
});
HomeWorkSetSelectedCommand = new DelegateCommand<DetailHomeWorkSetInfo>((x) =>
{
if (x == null) return;
selectedHomeWorkSet = x;
if (x == null || SelectedStudent == null) return;
SelectedHomeWorkSet = x;
HomeWork = SelectedStudent.HomeWorkSet.GetDetailHomeWorkList(SelectedHomeWorkSet.Lesson);
});
@ -271,7 +289,7 @@ namespace StudentManager.Model
if (c != MessageBoxResult.OK) return;
QuestionLib.Update(SelectedQuestion);
SelectedQuestion.UpdateTime = DateTime.Now;
SQLHelper.UpdateQuestion(SelectedQuestion);
SQLHelper.Instance.UpdateQuestion(SelectedQuestion);
});
ShowContextMenuCommand = new DelegateCommand<MouseButtonEventArgs>((e) =>
@ -315,13 +333,43 @@ namespace StudentManager.Model
ADDQuestionDatas.Clear();
});
SaveAllCommand = new DelegateCommand(() => FileSystem.SaveAll());
FreshAllCommand = new DelegateCommand(() => FileSystem.FreashAllInfo());
SaveAllCommand = new DelegateCommand(() => FileSystem.Instance.SaveAll());
FreshAllCommand = new DelegateCommand(() =>
{
FileSystem.Instance.FreashAllInfo();
Reload();
});
PublicHomeWorkCommand = new DelegateCommand(() =>
{
HomeWorkManager.PublicHomework(PublicLesson, IsAddPublicQuestionsLib, isNeedErrorset);
HomeWorkManager.Instance.PublicHomework(PublicLesson, IsAddPublicQuestionsLib, isNeedErrorset);
});
DeleteHomeworkCommand = new DelegateCommand(() =>
{
var cq = new CursonQuestionsData { Lesson = SelectedHomeWorkSet.Lesson, UID = SelectedStudent.UID };
if(!SQLHelper.Instance.Delete(cq))
{
//TODO: NOTIFY:
return;
}
if (SelectedHomeWorkSet != null && SelectedStudent != null)
SelectedStudent.HomeWorkSet.DeleteHomework(SelectedHomeWorkSet.Lesson);
if (SelectedStudent != null)
{
HomeWorkSet = SelectedStudent.HomeWorkSet.GetDetailHomeWorkSetList();
SelectedStudent.HomeWorkSet.UpdateDate();
}
});
SubmitAddQuestionsCommand = new DelegateCommand(() =>
{
@ -348,19 +396,43 @@ namespace StudentManager.Model
Load();
StudentDatas = new ReadOnlyObservableCollection<StudentInfo>(studentDatas);
StudentDatas = new ObservableCollection<StudentInfo>(studentDatas);
QuestionDatas = new ObservableCollection<QuestionData>(questionDatas);
ErrorSetDatas = new ObservableCollection<DetailErrorInfo>(errorSetDatas);
MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars);
HomeWorkSet = new ObservableCollection<DetailHomeWorkSetInfo>(homeWorkSet);
UpdateGird();
this.regionManager = regionManager;
}
private void UpdateGird()
{
if(SelectedStudent == null) return;
SelectedStudent.HomeWorkSet.UpdateDataView();
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Title = "错题数量",
Values = SelectedStudent.HomeWorkSet.ErrorCounts,
},
new LineSeries
{
Title = "正确数量",
Values = SelectedStudent.HomeWorkSet.CorrectCounts,
}
};
Labels = SelectedStudent.HomeWorkSet.Lessons;
}
private int ConvertToHashInt(string item)
{
var hash = SHA256.Create();
@ -368,7 +440,9 @@ namespace StudentManager.Model
return BitConverter.ToInt32(result, 0);
}
private void SubmitHomeWork()
private void UpdateHomeWork()
{
// update error set and local homework
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Questions.ForEach(x =>
@ -377,15 +451,14 @@ namespace StudentManager.Model
{
x.Status = HomeWork.FirstOrDefault(hw => hw.PID == x.ID).Status;
SelectedStudent.ErrorSet.AddQuestion(x);
SQLHelper.UpdateErrorSet(SelectedStudent.UID, x.ID, x.Status);
ErrorBase error = SelectedStudent.ErrorSet.Get(x.ID) ?? new ErrorBase { QuestionBase = new QuestionBase { ID = x.ID, Status = x.Status} };
SQLHelper.Instance.UpdateErrorSet(SelectedStudent.UID, error);
}
});
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).UpdateData();
ErrorSet = SelectedStudent.ErrorSet.GetDetailErrorSetInfo();
ErrorSetDatas = SelectedStudent.ErrorSet.GetDetailErrorQuestionList();
SelectedStudent.HomeWorkSet.UpdateDate();
SQLHelper.Instance.UpdateErrorSetUserInfo(SelectedStudent.UID, (uint)SelectedStudent.ErrorSet.TotalCount, (uint)SelectedStudent.ErrorSet.CorrectCount);
// update homework other info and online info
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Status = true;
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).DateTime = DateTime.Now;
@ -397,7 +470,7 @@ namespace StudentManager.Model
if (x.Status != false) correctHomeworkArray.Add(x.ID);
});
SQLHelper.UpdateHomework(SelectedStudent.UID, SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Lesson,
SQLHelper.Instance.UpdateHomework(SelectedStudent.UID, SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Lesson,
JsonConvert.SerializeObject(totalHomeworkArray),
JsonConvert.SerializeObject(correctHomeworkArray), SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).DateTime,
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Status);
@ -415,7 +488,7 @@ namespace StudentManager.Model
private void RegionToDetailView()
{
if (selectedStudent == null) return;
ErrorSet = selectedStudent.ErrorSet.GetDetailErrorSetInfo();
ErrorSetDatas = selectedStudent.ErrorSet.GetDetailErrorQuestionList();
HomeWorkSet = selectedStudent.HomeWorkSet.GetDetailHomeWorkSetList();
}
@ -451,8 +524,8 @@ namespace StudentManager.Model
{
studentDatas.Clear();
questionDatas.Clear();
studentDatas = StudentLib.GetAllStudents();
questionDatas = QuestionLib.GetAllQuestion();
StudentDatas = StudentLib.GetAllStudents();
QuestionDatas = QuestionLib.GetAllQuestion();
}

View File

@ -10,14 +10,13 @@
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.1" />
<PackageReference Include="LiveCharts" Version="0.9.7" />
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
<PackageReference Include="MyNet.Wpf.LiveCharts" Version="6.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" />
</ItemGroup>
<ItemGroup>
<Folder Include="Interface\" />
</ItemGroup>
</Project>