All Finished

This commit is contained in:
wangxiner55 2024-09-30 18:58:56 +08:00
parent 6ace9eabd8
commit 597981281f
13 changed files with 317 additions and 90 deletions

View File

@ -92,7 +92,7 @@ namespace StudentManager.Common
{
list.Add(new DetailErrorInfo
{
QuestionData = QuestionLib.Get(item.Key),
QuestionData = QuestionLib.Instance.Get(item.Key),
CorrectCount = item.Value.CorrectCount,
ErrorCount = item.Value.ErrorCount,
TotalUseCount = item.Value.TotalUseCount,

View File

@ -10,18 +10,34 @@ namespace StudentManager.Common
{
public class FileSystem : Singleton<FileSystem>
{
public Action AutoSaveInvoke { get; set; }
public void SaveAll()
{
StudentLib.Save();
QuestionLib.Save();
QuestionLib.Instance.Save();
}
public void FreashAllInfo()
{
StudentLib.FreshAllStudentInfo();
QuestionLib.FreshAllQuestion();
QuestionLib.Instance.FreshAllQuestion();
SaveAll();
}
public async void AutoSave(int time = 1)
{
await Task.Delay(time * 60 * 1000);
AutoSaveInvoke?.Invoke();
await Task.Delay(10000);
SaveAll();
AutoSave(time);
}
}
}

View File

@ -11,14 +11,33 @@ using System.Threading.Tasks;
namespace StudentManager.Common
{
public class HomeWorkError
{
public int Total { get; set; }
public int Error { get; set; }
public int Correct { get; set; }
}
public class HomeWorkManager : Singleton<HomeWorkManager>
{
public void PublicHomework(uint lesson, bool appedCommonWork = false, bool appendErrorSet = false, int workNum = -1)
public HomeWorkError PublicHomework(uint lesson, bool appedCommonWork = false, bool appendErrorSet = false, int workNum = -1)
{
HomeWorkError error= new HomeWorkError();
foreach (var item in StudentLib.StudentDic)
{
item.Value.PublicHomeWork(lesson, appedCommonWork, appendErrorSet, workNum);
if (item.Value.PublicHomeWork(lesson, appedCommonWork, appendErrorSet, workNum))
{
error.Total++;
error.Correct++;
}
else
{
error.Total++;
error.Error++;
}
}
return error;
}
internal void DeleteHomework(DetailHomeWorkSetInfo homeWork)

View File

@ -56,7 +56,7 @@ namespace StudentManager.Common
//QuestionData = {
// QuestionData = QuestionLib.Get(item.ID),
// Status = item.Status },
QuestionData = QuestionLib.Get(item.ID),
QuestionData = QuestionLib.Instance.Get(item.ID),
Status = Status,
//Lesson = Lesson,
//DateTime = DateTime,
@ -200,7 +200,7 @@ namespace StudentManager.Common
{
list.Add(new DetailHomeWorkInfo
{
QuestionData = QuestionLib.Get(item.ID),
QuestionData = QuestionLib.Instance.Get(item.ID),
Status = item.Status,
PID = item.ID
});

View File

@ -238,8 +238,8 @@ namespace StudentManager.Common
}
string sql = $"DELETE " +
$"FROM {tableName}" +
"WHERE problem_id = @problem_id";
$"FROM {tableName} " +
" WHERE problem_id = @problem_id";
using (var cmd = new MySqlCommand(sql, connection))
{
@ -423,7 +423,7 @@ namespace StudentManager.Common
{
connection.Open();
string updateQuery = "UPDATE users SET total_hwq_count = @totalCont, total_hwq_error_count = @totalErrorCount, " +
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))
{

View File

@ -0,0 +1,36 @@
using Newtonsoft.Json.Linq;
using StudentManager.Interface;
using System.Net.Http;
using System.Windows.Threading;
namespace StudentManager.Common
{
public class Timer
{
private DispatcherTimer _timer;
private Action _onMinuteChanged;
private int _lastMinute;
public Timer(Action onMinuteChanged)
{
_onMinuteChanged = onMinuteChanged;
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromSeconds(1);
_timer.Tick += Timer_Tick;
_timer.Start();
_lastMinute = DateTime.Now.Minute;
}
private void Timer_Tick(object sender, EventArgs e)
{
var now = DateTime.Now;
if (now.Minute != _lastMinute)
{
_onMinuteChanged?.Invoke();
_lastMinute = now.Minute;
}
}
}
}

View File

@ -1,6 +1,7 @@
using Google.Protobuf.WellKnownTypes;
using Microsoft.VisualBasic;
using StudentManager.Common;
using StudentManager.Interface;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -22,7 +23,7 @@ namespace StudentManager.Data
}
public static class QuestionLib
public class QuestionLib : Singleton<QuestionLib>
{
public static string FileName = "questionLib.dbqi";
public static string TableDicFileName = "questionTableDicLib.dbqi";
@ -32,7 +33,7 @@ namespace StudentManager.Data
public static Dictionary<uint, Dictionary<int, QuestionData>> QuestionTableDic { get; set; } = new Dictionary<uint, Dictionary<int, QuestionData>>();
public static int TotalCount { get { return QuestionDic.Count; } }
public static void Load()
public void Load()
{
QuestionDic.Clear();
@ -57,14 +58,14 @@ namespace StudentManager.Data
if (file.Length != 0)
QuestionTableDesc = JsonSerializer.Deserialize<Dictionary<uint, QuestionSetDesc>>(file);
}
public static void Save()
public void Save()
{
File.WriteAllText((StudentLib.LibPath + FileName), JsonSerializer.Serialize(QuestionDic));
File.WriteAllText((StudentLib.LibPath + TableDicFileName), JsonSerializer.Serialize(QuestionTableDic));
File.WriteAllText((StudentLib.LibPath + TableDescFileName), JsonSerializer.Serialize(QuestionTableDesc));
}
public static void FreshAllQuestion()
public void FreshAllQuestion()
{
QuestionDic.Clear ();
@ -90,7 +91,7 @@ namespace StudentManager.Data
}
}
public static ObservableCollection<QuestionData> GetAllQuestion()
public ObservableCollection<QuestionData> GetAllQuestion()
{
var list = new ObservableCollection<QuestionData>();
foreach (QuestionData data in QuestionDic.Values)
@ -99,7 +100,7 @@ namespace StudentManager.Data
}
return list;
}
public static ObservableCollection<QuestionData> GetAllQuestionByLesson(uint lesson)
public ObservableCollection<QuestionData> GetAllQuestionByLesson(uint lesson)
{
var list = new ObservableCollection<QuestionData>();
foreach (QuestionData data in QuestionTableDic[lesson].Values)
@ -109,24 +110,28 @@ namespace StudentManager.Data
return list;
}
public static QuestionData Get(int id)
public QuestionData Get(int id)
{
if (!QuestionDic.ContainsKey(id)) return null;
return QuestionDic[id];
}
public static QuestionData Get(uint lesson , int id)
public QuestionData Get(uint lesson , int id)
{
if (!QuestionDic.ContainsKey(id)) return null;
return QuestionDic[id];
}
public static void Add(QuestionData question)
public bool Add(QuestionData question)
{
if(question == null) return false;
if(QuestionDic.ContainsKey(question.Id)) return false;
if (!SQLHelper.Instance.Add(question)) return false;
QuestionDic.Add(question.Id, question);
if (!QuestionTableDic.ContainsKey(question.Lesson))
{
QuestionTableDic[question.Lesson] = new Dictionary<int, QuestionData>();
@ -135,25 +140,25 @@ namespace StudentManager.Data
QuestionTableDesc[question.Lesson].UpdateTime = DateTime.Now;
QuestionTableDesc[question.Lesson].TotalQuestions = (uint)QuestionTableDic[question.Lesson].Count;
SQLHelper.Instance.Add(question);
return true;
}
public static void Remove(QuestionData question)
public bool Remove(QuestionData question)
{
if (question == null) throw new NullReferenceException();
QuestionDic.Remove(question.Id);
if (question == null || !QuestionDic.ContainsKey(question.Id) || !QuestionTableDic[question.Lesson].ContainsKey(question.Id)) return false;
QuestionDic.Remove(question.Id);
QuestionTableDic[question.Lesson].Remove(question.Id);
QuestionTableDesc[question.Lesson].TotalQuestions = (uint)QuestionTableDic[question.Lesson].Count;
return true;
}
public static void Remove(int id)
public void Remove(int id)
{
QuestionDic.Remove(id);
}
internal static void Update(QuestionData selectedQuestion)
internal void Update(QuestionData selectedQuestion)
{
if(QuestionDic[selectedQuestion.Id] != null)
QuestionDic[selectedQuestion.Id] = selectedQuestion;

View File

@ -126,7 +126,7 @@ namespace StudentManager.Data
public uint CurrentHomeWorkIndex = 0;
public HomeWork CurentHomeWork { get; set; } = new HomeWork();
public void PublicHomeWork(uint lesson, bool appendCommonWork = false, bool appendErrorSet = false, int workNum = -1)
public bool PublicHomeWork(uint lesson, bool appendCommonWork = false, bool appendErrorSet = false, int workNum = -1)
{
HomeWork homeWork = new HomeWork();
homeWork.Lesson = (uint)(HomeWorkSet.TotalSetCount + 1);
@ -142,7 +142,7 @@ namespace StudentManager.Data
}
if (appendCommonWork)
{
foreach (var item in QuestionLib.GetAllQuestionByLesson(lesson))
foreach (var item in QuestionLib.Instance.GetAllQuestionByLesson(lesson))
{
homeWork.AddHomeWork(item.Id);
}
@ -174,10 +174,14 @@ namespace StudentManager.Data
{
HomeWorkSet.AddHomeWork(homeWork);
HomeWorkSet.UpdateDate();
SQLHelper.Instance.UpdateHomeworkTotalInfo(UID, (uint)HomeWorkSet.TotalQuestionCount, (uint)HomeWorkSet.TotalErrorQuestionCount);
CurentHomeWork = homeWork;
return true;
}
else
{
//TODO: NOTIFY
return false;
}
}
}

View File

@ -9,6 +9,7 @@
xmlns:extent="clr-namespace:StudentManager.Extensions"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:dt="clr-namespace:StudentManager.Data"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
Background="#00000000" WindowStyle="None"
mc:Ignorable="d"
Title="MainEditor" Height="800" Width="1400">
@ -48,7 +49,7 @@
</DockPanel>
<Border BorderBrush="Gray" BorderThickness="1,0,0,0" Margin="2,50" Grid.Column="1"/>
<Border BorderBrush="Gray" BorderThickness="1,0,0,0" Margin="2,50" Grid.Column="1" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
@ -57,21 +58,46 @@
</Grid.RowDefinitions>
<Grid Margin="10">
<Border Background="#FFFFFFFF" CornerRadius="10"/>
<md:ColorZone Background="#FFFFFFFF" CornerRadius="10" Height="100" x:Name="Bar" />
<DockPanel VerticalAlignment="Center" LastChildFill="False">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border Margin="50,0" CornerRadius="50" Height="20" Width="20" Background="Gray"/>
<StackPanel VerticalAlignment="Center" Margin="20,0">
<TextBlock DockPanel.Dock="Left" Text="USERNAME" HorizontalAlignment="Left" Margin="2" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock DockPanel.Dock="Left" Text="desc" HorizontalAlignment="Left" FontSize="8" Foreground="Gray" Margin="2" VerticalAlignment="Center"/>
<Border Margin="20,0" CornerRadius="50" Height="20" Width="20" Background="Gray"/>
<StackPanel VerticalAlignment=" Center" Margin="10,0">
<TextBlock DockPanel.Dock="Left" Text="HELLO" HorizontalAlignment="Left" Margin="2" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock DockPanel.Dock="Left" Text="美好的一天从此刻开始" HorizontalAlignment="Left" FontSize="8" Foreground="Gray" Margin="2" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
<TextBlock DockPanel.Dock="Right" Text="NAME" HorizontalAlignment="Left" Margin="20" VerticalAlignment="Center"/>
<Button DockPanel.Dock="Right" Style="{DynamicResource MaterialDesignFlatDarkButton}" Click="Button_Click" Height="80">
<StackPanel>
<md:PackIcon Kind="Close" VerticalAlignment="Top"/>
<TextBlock Text="QUIT" FontSize="10" Margin="0,10"/>
</StackPanel>
</Button>
<TextBlock Text="{Binding CurrentTime}" HorizontalAlignment="Left" Margin="20,0,20,5" FontWeight="Bold" VerticalAlignment="Center"/>
<StackPanel DockPanel.Dock="Right" HorizontalAlignment="Center" Margin="20,20">
<TextBlock Text="DESIGNED BY" HorizontalAlignment="Left" Margin="20,0,20,5" FontWeight="Bold" VerticalAlignment="Center"/>
<TextBlock Text="XINER" HorizontalAlignment="Left" FontSize="10" Foreground="Gray" Margin="20,1" VerticalAlignment="Center"/>
</StackPanel>
</DockPanel>
</Grid>
<md:Snackbar x:Name="SnackBar" MessageQueue="{md:MessageQueue}" Panel.ZIndex="1"
Background="#FFFAFAFA" Foreground="Black"
HorizontalAlignment="Center" VerticalAlignment="Top"
Margin="0,20"
>
<md:Snackbar.Effect>
<DropShadowEffect Color="#FFE5E5E5" BlurRadius="20" ShadowDepth="1" Direction="180"/>
</md:Snackbar.Effect>
</md:Snackbar>
<Grid Grid.Row="1">
<ContentControl Grid.Row="1" Margin="10" prism:RegionManager.RegionName="{x:Static extent:PrismManager.MainRegionName}" BorderBrush="White"/>
</Grid>
</Grid>
</Grid>
</Window>

View File

@ -1,5 +1,6 @@
using StudentManager.Common;
using StudentManager.Data;
using StudentManager.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
@ -18,9 +19,40 @@ namespace StudentManager.Editor
{
public partial class MainEditor : Window
{
public MainEditor()
private readonly IEventAggregator eventAggregator;
public MainEditor(IEventAggregator aggregator)
{
InitializeComponent();
this.eventAggregator = eventAggregator;
aggregator.ResgiterMessage(arg =>
{
SnackBar.MessageQueue.Enqueue(arg);
});
Bar.MouseMove += (s, e) =>
{
if(e.LeftButton == MouseButtonState.Pressed)
this.DragMove();
};
Bar.MouseDoubleClick += (s, e) =>
{
if (this.WindowState == WindowState.Normal)
this.WindowState = WindowState.Maximized;
else
this.WindowState = WindowState.Normal;
};
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var c = MessageBox.Show("确定退出吗?", "确认", MessageBoxButton.OKCancel);
if (c != MessageBoxResult.OK) return;
FileSystem.Instance.SaveAll();
this.Close();
}
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentManager.Event
{
public class MessageEvent : PubSubEvent<string>
{
}
}

View File

@ -0,0 +1,22 @@
using StudentManager.Event;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StudentManager.Extensions
{
internal static class DialogExtensions
{
public static void ResgiterMessage(this IEventAggregator aggregator, Action<string> message)
{
aggregator.GetEvent<MessageEvent>().Subscribe(message);
}
public static void SendMessage(this IEventAggregator aggregator, string message)
{
aggregator.GetEvent<MessageEvent>().Publish(message);
}
}
}

View File

@ -2,6 +2,7 @@
using LiveCharts;
using LiveCharts.Wpf;
using Mysqlx.Crud;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json;
using Org.BouncyCastle.Utilities;
using StudentManager.Common;
@ -18,6 +19,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Timer = StudentManager.Common.Timer;
namespace StudentManager.Model
{
@ -209,7 +211,18 @@ namespace StudentManager.Model
set { labels = value; RaisePropertyChanged(); }
}
private string currentTime;
public string CurrentTime
{
get { return currentTime; }
set { currentTime = value; RaisePropertyChanged(); }
}
private readonly IRegionManager regionManager;
private readonly IEventAggregator aggregator;
public DelegateCommand<string> RegionTo { get; set; }
public DelegateCommand<StudentInfo> SelectedCommand { get; set; }
@ -230,9 +243,23 @@ namespace StudentManager.Model
public DelegateCommand PublicHomeWorkCommand { get; set; }
public DelegateCommand FreshAllCommand { get; set; }
Students(IRegionManager regionManager)
Students(IRegionManager regionManager, IEventAggregator aggregator)
{
CreateMenuBar();
CurrentTime = DateTime.Now.ToString("HH:mm");
Timer timer = new Timer(() => {
CurrentTime = DateTime.Now.ToString("HH:mm");
});
FileSystem.Instance.AutoSaveInvoke += () =>
{
aggregator.SendMessage(" 将在10秒后自动保存 ");
};
FileSystem.Instance.AutoSave();
RegionTo = new DelegateCommand<string>((x) =>
{
@ -275,11 +302,20 @@ namespace StudentManager.Model
DeleteQuestionCommand = new DelegateCommand(() =>
{
if (SelectedQuestion == null) return;
if (SelectedQuestion == null)
{
aggregator.SendMessage($" 当前没有选中任何题目 ");
return;
}
var c = MessageBox.Show("确定删除吗?", "确认", MessageBoxButton.OKCancel);
if (c != MessageBoxResult.OK) return;
QuestionLib.Remove(SelectedQuestion);
QuestionDatas = QuestionLib.GetAllQuestion();
if (!SQLHelper.Instance.Delete(SelectedQuestion)) return;
QuestionLib.Instance.Remove(SelectedQuestion);
QuestionDatas = QuestionLib.Instance.GetAllQuestion();
aggregator.SendMessage($" 成功删除 ");
FileSystem.Instance.SaveAll();
});
UpdateQuestionCommand = new DelegateCommand(() =>
@ -287,23 +323,13 @@ namespace StudentManager.Model
if (SelectedQuestion == null) return;
var c = MessageBox.Show("确定修改吗?", "确认", MessageBoxButton.OKCancel);
if (c != MessageBoxResult.OK) return;
QuestionLib.Update(SelectedQuestion);
QuestionLib.Instance.Update(SelectedQuestion);
SelectedQuestion.UpdateTime = DateTime.Now;
SQLHelper.Instance.UpdateQuestion(SelectedQuestion);
});
ShowContextMenuCommand = new DelegateCommand<MouseButtonEventArgs>((e) =>
{
if (e.OriginalSource is FrameworkElement element)
{
var contextMenu = element.FindResource("MyContextMenu") as ContextMenu;
if (contextMenu != null)
{
contextMenu.PlacementTarget = element;
contextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
contextMenu.IsOpen = true;
}
}
aggregator.SendMessage("已更新问题信息");
FileSystem.Instance.SaveAll();
});
SelectedQuestionChangedCommand = new DelegateCommand<QuestionData>((x) =>
@ -313,19 +339,6 @@ namespace StudentManager.Model
});
RemoveNewColumnCommand = new DelegateCommand<QuestionData>((x) =>
{
if (x == null) return;
var c = MessageBox.Show("确定删除吗?", "确认", MessageBoxButton.OKCancel);
if (c != MessageBoxResult.OK) return;
ADDQuestionDatas.Remove(x);
});
AddNewColumnCommand = new DelegateCommand(() =>
{
ADDQuestionDatas.Add(new QuestionData { });
});
ClearnAddQuestionsCommand = new DelegateCommand(() =>
{
var c = MessageBox.Show("确定清除吗?", "清除所有题目", MessageBoxButton.OKCancel);
@ -341,7 +354,8 @@ namespace StudentManager.Model
});
PublicHomeWorkCommand = new DelegateCommand(() =>
{
HomeWorkManager.Instance.PublicHomework(PublicLesson, IsAddPublicQuestionsLib, isNeedErrorset);
var result = HomeWorkManager.Instance.PublicHomework(PublicLesson, IsAddPublicQuestionsLib, isNeedErrorset);
aggregator.SendMessage($"总发布{result.Total}个作业, {result.Correct}已发布, {result.Error}未发布");
});
@ -350,14 +364,19 @@ namespace StudentManager.Model
var cq = new CursonQuestionsData { Lesson = SelectedHomeWorkSet.Lesson, UID = SelectedStudent.UID };
if(!SQLHelper.Instance.Delete(cq))
if (!SQLHelper.Instance.Delete(cq))
{
//TODO: NOTIFY:
aggregator.SendMessage(" 服务器删除失败 ");
return;
}
if (SelectedHomeWorkSet != null && SelectedStudent != null)
SelectedStudent.HomeWorkSet.DeleteHomework(SelectedHomeWorkSet.Lesson);
else
{
aggregator.SendMessage(" 本地数据错误,已为你从服务器更新 ");
QuestionLib.Instance.FreshAllQuestion();
}
if (SelectedStudent != null)
{
@ -366,6 +385,11 @@ namespace StudentManager.Model
}
aggregator.SendMessage(" 删除成功 ");
FileSystem.Instance.SaveAll();
});
@ -375,13 +399,21 @@ namespace StudentManager.Model
Debug.Assert(Lesson != 0);
preToRemove.Clear();
foreach (var item in ADDQuestionDatas)
{
item.Id = ConvertToHashInt(item.Stem);
item.Lesson = Lesson;
if (!(QuestionLib.Get(item.Id) == null)) continue;
if (!(QuestionLib.Instance.Get(item.Id) == null)) continue;
if (string.IsNullOrEmpty(item.Stem) || string.IsNullOrEmpty(item.Source) || string.IsNullOrEmpty(item.Answer)) continue;
QuestionLib.Add(item);
if (!SQLHelper.Instance.Add(item))
{
aggregator.SendMessage($" {item.Stem}服务器添加失败, ID 可能重复 ");
continue;
}
QuestionLib.Instance.Add(item);
preToRemove.Add(item);
}
@ -390,7 +422,9 @@ namespace StudentManager.Model
ADDQuestionDatas.Remove(item);
}
QuestionLib.Save();
aggregator.SendMessage($" {preToRemove.Count}添加成功, {ADDQuestionDatas.Count}添加失败 ");
QuestionLib.Instance.Save();
});
@ -406,12 +440,12 @@ namespace StudentManager.Model
UpdateGird();
this.regionManager = regionManager;
this.aggregator = aggregator;
}
private void UpdateGird()
{
if(SelectedStudent == null) return;
if (SelectedStudent == null) return;
SelectedStudent.HomeWorkSet.UpdateDataView();
@ -445,17 +479,30 @@ namespace StudentManager.Model
private void UpdateHomeWork()
{
// update error set and local homework
bool isChanged = false;
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Questions.ForEach(x =>
{
if (x.Status != HomeWork.FirstOrDefault(hw => hw.PID == x.ID).Status || selectedHomeWorkSet.Status == false)
{
isChanged = true;
x.Status = HomeWork.FirstOrDefault(hw => hw.PID == x.ID).Status;
SelectedStudent.ErrorSet.AddQuestion(x);
ErrorBase error = SelectedStudent.ErrorSet.Get(x.ID) ?? new ErrorBase { QuestionBase = new QuestionBase { ID = x.ID, Status = x.Status} };
SQLHelper.Instance.UpdateErrorSet(SelectedStudent.UID, error);
ErrorBase error = SelectedStudent.ErrorSet.Get(x.ID) ?? new ErrorBase { QuestionBase = new QuestionBase { ID = x.ID, Status = x.Status } };
if (!SQLHelper.Instance.UpdateErrorSet(SelectedStudent.UID, error))
{
aggregator.SendMessage($"{error.QuestionBase.ID} 更新错题集数据失败");
}
}
});
if (!isChanged)
{
aggregator.SendMessage($" 当前作业没有变更 ");
return;
}
});
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).UpdateData();
SelectedStudent.HomeWorkSet.UpdateDate();
SQLHelper.Instance.UpdateErrorSetUserInfo(SelectedStudent.UID, (uint)SelectedStudent.ErrorSet.TotalCount, (uint)SelectedStudent.ErrorSet.CorrectCount);
@ -476,7 +523,14 @@ namespace StudentManager.Model
SelectedStudent.HomeWorkSet.Get(SelectedHomeWorkSet.Lesson).Status);
SQLHelper.Instance.UpdateHomeworkTotalInfo(SelectedStudent.UID, (uint)SelectedStudent.HomeWorkSet.TotalQuestionCount, (uint)SelectedStudent.HomeWorkSet.TotalErrorQuestionCount);
aggregator.SendMessage($" 更新错题集数据和家庭作业成功 ");
selectedHomeWorkSet.Status = true;
HomeWorkSet = SelectedStudent.HomeWorkSet.GetDetailHomeWorkSetList();
FileSystem.Instance.SaveAll();
//TODO: Notify
}
@ -516,7 +570,7 @@ namespace StudentManager.Model
private void Load()
{
StudentLib.Load();
QuestionLib.Load();
QuestionLib.Instance.Load();
Reload();
}
@ -525,7 +579,7 @@ namespace StudentManager.Model
studentDatas.Clear();
questionDatas.Clear();
StudentDatas = StudentLib.GetAllStudents();
QuestionDatas = QuestionLib.GetAllQuestion();
QuestionDatas = QuestionLib.Instance.GetAllQuestion();
}
@ -534,7 +588,7 @@ namespace StudentManager.Model
HomeworkTestData.Clear();
if (IsAddPublicQuestionsLib)
{
HomeworkTestData = QuestionLib.GetAllQuestionByLesson(PublicLesson);
HomeworkTestData = QuestionLib.Instance.GetAllQuestionByLesson(PublicLesson);
}
if (IsNeedErrorset)
{