Finish Detail Data Info
This commit is contained in:
parent
fe9c8a3f0c
commit
6ec84c76b9
@ -2,6 +2,7 @@
|
||||
using StudentManager.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -22,6 +23,25 @@ namespace StudentManager.Common
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class DetailErrorInfo
|
||||
{
|
||||
public QuestionData QuestionData { get; set; } = new QuestionData();
|
||||
public int TotalUseCount { get; set; } = 1;
|
||||
public int ErrorCount { get; set; } = 1;
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
public bool Status { get; set; } = false;
|
||||
}
|
||||
|
||||
public class DetailErrorSetInfo
|
||||
{
|
||||
public int TotalCount { get; set; } = 0;
|
||||
public int TotalErrorCount { get; set; } = 0;
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
public int ErrorCount { get; set; } = 0;
|
||||
public float ErrorRate { get; set; } = 0;
|
||||
public float CorrectRate { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class ErrorSet
|
||||
{
|
||||
public int TotalCount { get; set; } = 0;
|
||||
@ -40,6 +60,36 @@ namespace StudentManager.Common
|
||||
}
|
||||
}
|
||||
|
||||
public DetailErrorSetInfo GetDetailErrorSetInfo()
|
||||
{
|
||||
return new DetailErrorSetInfo
|
||||
{
|
||||
TotalCount = QuestionLib.GetQuestionCount(),
|
||||
TotalErrorCount = Errores.Count(),
|
||||
CorrectCount = CorrectArray.Count(),
|
||||
ErrorCount = ErrorArray.Count(),
|
||||
ErrorRate = ErrorArray.Count() / QuestionLib.GetQuestionCount(),
|
||||
CorrectRate = CorrectArray.Count() / Errores.Count()
|
||||
};
|
||||
}
|
||||
|
||||
public ObservableCollection<DetailErrorInfo> GetDetailErrorQuestionList()
|
||||
{
|
||||
ObservableCollection<DetailErrorInfo> list = new ObservableCollection<DetailErrorInfo>();
|
||||
foreach (var item in Errores)
|
||||
{
|
||||
list.Add(new DetailErrorInfo
|
||||
{
|
||||
QuestionData = QuestionLib.Get(item.Key),
|
||||
CorrectCount = item.Value.CorrectCount,
|
||||
ErrorCount = item.Value.ErrorCount,
|
||||
Status = item.Value.QuestionBase.Status
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void AddQuestion(QuestionBase question)
|
||||
{
|
||||
if (question.Status)
|
||||
@ -131,7 +181,7 @@ namespace StudentManager.Common
|
||||
|
||||
SQLHelper.Query<UserQuestionData>(Tables.UQTable, id).ForEach(x =>
|
||||
{
|
||||
AddQuestion(new QuestionBase { ID = x.PID, Status = x.Status});
|
||||
AddQuestion(new QuestionBase { ID = x.PID, Status = x.Status });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace StudentManager.Common
|
||||
{
|
||||
public static HomeWork CommonHomeWork { get; set; } = new HomeWork();
|
||||
|
||||
public static void Create(StudentInfo student,int lesson, int workNum = 10)
|
||||
public static void Create(StudentInfo student,int lesson, bool appedCommonWork = false, int workNum = 10)
|
||||
{
|
||||
HomeWork work = new HomeWork { Lesson = lesson};
|
||||
foreach(var item in student.ErrorSet.ErrorArray)
|
||||
@ -21,21 +21,21 @@ namespace StudentManager.Common
|
||||
work.AddHomeWork(item);
|
||||
}
|
||||
|
||||
if (CommonHomeWork.Questions.Count > 0)
|
||||
if (appedCommonWork && CommonHomeWork.Questions.Count > 0)
|
||||
{
|
||||
work.Append(CommonHomeWork);
|
||||
}
|
||||
|
||||
student.CurentHomeWork = work;
|
||||
Public(work);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void Public()
|
||||
public static void Public(HomeWork homeWork)
|
||||
{
|
||||
foreach (var item in StudentLib.StudentDic)
|
||||
{
|
||||
item.Value.PublicHomeWork();
|
||||
item.Value.PublicHomeWork(homeWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,98 @@
|
||||
using DryIoc.ImTools;
|
||||
using MySqlX.XDevAPI;
|
||||
using StudentManager.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentManager.Common
|
||||
{
|
||||
public class DetailQuestionBase
|
||||
{
|
||||
public QuestionData QuestionData { get; set; } = new QuestionData();
|
||||
public bool Status { get; set; } = false;
|
||||
}
|
||||
|
||||
public class DetailHomeWorkInfo
|
||||
{
|
||||
public DetailQuestionBase QuestionData { get; set; } = new DetailQuestionBase();
|
||||
public DateTime DateTime { get; set; } = DateTime.Now;
|
||||
public int Lesson { get; set; } = 0;
|
||||
public bool Status { get; set; } = false;
|
||||
|
||||
public int TotalCount { get; set; } = 0;
|
||||
public int ErrorCount { get; set; } = 0;
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class HomeWork
|
||||
{
|
||||
public int Lesson { get; set; } = 0;
|
||||
public bool Status { get; set; } = false;
|
||||
public HashSet<QuestionBase> Questions { get; set; } = new HashSet<QuestionBase>();
|
||||
public DateTime DateTime { get; set; } = DateTime.Now;
|
||||
public List<QuestionBase> Questions { get; set; } = new List<QuestionBase>();
|
||||
|
||||
|
||||
public int TotalCount { get; set; } = 0;
|
||||
public int ErrorCount { get; set; } = 0;
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
|
||||
public ObservableCollection<DetailHomeWorkInfo> GetDetailHomeWorkList()
|
||||
{
|
||||
ObservableCollection<DetailHomeWorkInfo> list = new ObservableCollection<DetailHomeWorkInfo>();
|
||||
foreach (var item in Questions)
|
||||
{
|
||||
list.Add(new DetailHomeWorkInfo
|
||||
{
|
||||
QuestionData = {
|
||||
QuestionData = QuestionLib.Get(item.ID),
|
||||
Status = item.Status },
|
||||
Status = Status,
|
||||
Lesson = Lesson,
|
||||
DateTime = DateTime,
|
||||
TotalCount = TotalCount,
|
||||
ErrorCount = ErrorCount,
|
||||
CorrectCount = CorrectCount
|
||||
});
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void FreshData()
|
||||
{
|
||||
CorrectCount = 0;
|
||||
ErrorCount = 0;
|
||||
TotalCount = Questions.Count;
|
||||
foreach (var item in Questions)
|
||||
{
|
||||
if (item.Status == true) CorrectCount++;
|
||||
else ErrorCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void AddHomeWork(QuestionBase workInfo)
|
||||
{
|
||||
Questions.Add(workInfo);
|
||||
FreshData();
|
||||
}
|
||||
|
||||
public void AddHomeWork(int id)
|
||||
{
|
||||
Questions.Add(new QuestionBase { ID = id });
|
||||
FreshData();
|
||||
}
|
||||
|
||||
public void RemoveHomeWork(QuestionBase workInfo)
|
||||
{
|
||||
Questions.Remove(workInfo);
|
||||
FreshData();
|
||||
}
|
||||
|
||||
public void Append(HomeWork homeWork)
|
||||
@ -40,14 +105,74 @@ namespace StudentManager.Common
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class DetailHomeWorkSetInfo
|
||||
{
|
||||
public int TotalCount { get; set; } = 0;
|
||||
public bool Status { get; set; } = false;
|
||||
|
||||
public DateTime DateTime { get; set; } = DateTime.Now;
|
||||
public int Lesson { get; set; } = 0;
|
||||
|
||||
public int ErrorCount { get; set; } = 0;
|
||||
public int CorrectCount { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
public class HomeWorkSet
|
||||
{
|
||||
[JsonInclude]
|
||||
private Dictionary<int, HomeWork> HomeWorks { get; set; } = new Dictionary<int, HomeWork>();
|
||||
public int TotalCount { get; set; } = 0;
|
||||
|
||||
|
||||
public void AddHomeWork(HomeWork homeWork)
|
||||
{
|
||||
HomeWorks.Add(homeWork.Lesson, homeWork);
|
||||
TotalCount = HomeWorks.Count;
|
||||
}
|
||||
|
||||
public ObservableCollection<DetailHomeWorkInfo> GetDetailHomeWorkList(int lesson)
|
||||
{
|
||||
ObservableCollection<DetailHomeWorkInfo> list = new ObservableCollection<DetailHomeWorkInfo>();
|
||||
foreach (var item in HomeWorks[lesson].Questions)
|
||||
{
|
||||
list.Add(new DetailHomeWorkInfo
|
||||
{
|
||||
QuestionData = {
|
||||
QuestionData = QuestionLib.Get(item.ID),
|
||||
Status = item.Status },
|
||||
Status = HomeWorks[lesson].Status,
|
||||
Lesson = HomeWorks[lesson].Lesson,
|
||||
DateTime = HomeWorks[lesson].DateTime,
|
||||
TotalCount = HomeWorks[lesson].TotalCount,
|
||||
ErrorCount = HomeWorks[lesson].ErrorCount,
|
||||
CorrectCount = HomeWorks[lesson].CorrectCount
|
||||
});
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ObservableCollection<DetailHomeWorkSetInfo> GetDetailHomeWorkSetList()
|
||||
{
|
||||
ObservableCollection<DetailHomeWorkSetInfo> list = new ObservableCollection<DetailHomeWorkSetInfo>();
|
||||
foreach (var item in HomeWorks)
|
||||
{
|
||||
list.Add(new DetailHomeWorkSetInfo
|
||||
{
|
||||
|
||||
Status = item.Value.Status,
|
||||
Lesson = item.Value.Lesson,
|
||||
DateTime = item.Value.DateTime,
|
||||
TotalCount = item.Value.TotalCount,
|
||||
ErrorCount = item.Value.ErrorCount,
|
||||
CorrectCount = item.Value.CorrectCount
|
||||
});
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +183,13 @@ namespace StudentManager.Common
|
||||
|
||||
public HomeWork Get(int cursonId)
|
||||
{
|
||||
return HomeWorks[cursonId];
|
||||
if (HomeWorks.ContainsKey(cursonId)) return HomeWorks[cursonId];
|
||||
return null;
|
||||
}
|
||||
|
||||
public HomeWork GetLast()
|
||||
{
|
||||
return HomeWorks[TotalCount];
|
||||
}
|
||||
|
||||
public List<HomeWork> GetAll()
|
||||
@ -77,15 +208,24 @@ namespace StudentManager.Common
|
||||
return works;
|
||||
}
|
||||
|
||||
public void QueryCQSet(int id)
|
||||
public void FreshAllHomeWork(int id)
|
||||
{
|
||||
HomeWorks.Clear();
|
||||
|
||||
SQLHelper.Query<CursonQuestionsData>(Tables.CQTable, id).ForEach(x =>
|
||||
{
|
||||
HashSet<QuestionBase> Questions = new HashSet<QuestionBase>();
|
||||
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, Questions = Questions, Status = x.Status == 1 });
|
||||
HomeWorks.Add(x.Lesson, new HomeWork
|
||||
{
|
||||
Lesson = x.Lesson,
|
||||
TotalCount = x.ProblemIDS.Length,
|
||||
CorrectCount = x.CorrectCount,
|
||||
ErrorCount = x.TotalCount - x.CorrectCount,
|
||||
DateTime = x.DateTime,
|
||||
Questions = Questions,
|
||||
Status = x.Status == 1
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ namespace StudentManager.Common
|
||||
(data as StudentData).Grade = (byte)reader[5];
|
||||
(data as StudentData).TotalsQuestions = (UInt16)reader[6];
|
||||
(data as StudentData).CorrectionCount = (UInt16)reader[7];
|
||||
(data as StudentData).HomeWork = (UInt16)reader[8];
|
||||
}
|
||||
else if (typeof(T) == typeof(QuestionData))
|
||||
{
|
||||
@ -65,6 +66,7 @@ namespace StudentManager.Common
|
||||
(data as CursonQuestionsData).CorrectIDS = string.IsNullOrEmpty(reader[2].ToString()) ? Array.Empty<int>() : JsonConvert.DeserializeObject<int[]>(reader[2].ToString());
|
||||
(data as CursonQuestionsData).Lesson = (byte)reader[3];
|
||||
(data as CursonQuestionsData).Status = (byte)reader[4];
|
||||
(data as CursonQuestionsData).DateTime = (DateTime)reader[5];
|
||||
(data as CursonQuestionsData).TotalCount = (data as CursonQuestionsData).ProblemIDS.Length;
|
||||
(data as CursonQuestionsData).CorrectCount = (data as CursonQuestionsData).CorrectIDS.Length;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace StudentManager.Data
|
||||
public int UID { get; set; } = 0;
|
||||
public int[] ProblemIDS { get; set; } = { };
|
||||
public int[] CorrectIDS { get; set; } = { };
|
||||
public DateTime DateTime { get; set; } = DateTime.Now;
|
||||
|
||||
public int Lesson { get; set; } = 0;
|
||||
public int TotalCount { get; set; } = 0;
|
||||
|
@ -2,6 +2,7 @@
|
||||
using StudentManager.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -15,7 +16,13 @@ namespace StudentManager.Data
|
||||
{
|
||||
public static string FileName = "questionLib.dbqi";
|
||||
public static Dictionary<int, QuestionData> QuestionDic { get; set; } = new Dictionary<int, QuestionData>();
|
||||
public static int TotalCount { get; set; } = 0;
|
||||
|
||||
public static int GetQuestionCount()
|
||||
{
|
||||
TotalCount = QuestionDic.Count;
|
||||
return TotalCount;
|
||||
}
|
||||
public static void Load()
|
||||
{
|
||||
QuestionDic.Clear();
|
||||
@ -34,6 +41,16 @@ namespace StudentManager.Data
|
||||
SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => QuestionDic.Add(x.Id, x));
|
||||
}
|
||||
|
||||
public static ObservableCollection<QuestionData> GetAllQuestion()
|
||||
{
|
||||
var list = new ObservableCollection<QuestionData>();
|
||||
foreach (QuestionData data in QuestionDic.Values)
|
||||
{
|
||||
list.Add(data);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static QuestionData Get(int id)
|
||||
{
|
||||
if (!QuestionDic.ContainsKey(id)) return null;
|
||||
|
@ -16,7 +16,7 @@ namespace StudentManager.Data
|
||||
public int Grade { get; set; } = 1;
|
||||
public int TotalsQuestions { get; set; } = 0;
|
||||
public int CorrectionCount { get; set; } = 0;
|
||||
|
||||
public int HomeWork { get; set; } = 0;
|
||||
|
||||
public float ErrorRate { get; set; } = 0;
|
||||
public float CorrectRate { get; set; } = 0;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using StudentManager.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -50,6 +51,7 @@ namespace StudentManager.Data
|
||||
Address = x.Address,
|
||||
Contact = x.Contact,
|
||||
Grade = x.Grade,
|
||||
CurrentHomeWorkIndex = x.HomeWork,
|
||||
}));
|
||||
|
||||
foreach (var item in StudentDic)
|
||||
@ -58,6 +60,16 @@ namespace StudentManager.Data
|
||||
}
|
||||
}
|
||||
|
||||
public static ObservableCollection<StudentInfo> GetAllStudents()
|
||||
{
|
||||
var list = new ObservableCollection<StudentInfo>();
|
||||
foreach (var item in StudentDic)
|
||||
{
|
||||
list.Add(item.Value);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static StudentInfo QueryStudentDetailInfo(int uid)
|
||||
{
|
||||
return GetStudentDetailInfo(Get(uid));
|
||||
@ -82,14 +94,15 @@ namespace StudentManager.Data
|
||||
public static StudentInfo GetStudentDetailInfo(StudentInfo studentData)
|
||||
{
|
||||
studentData.ErrorSet.QueryErrorSet(studentData.UID);
|
||||
studentData.HomeWorkSet.QueryCQSet(studentData.UID);
|
||||
studentData.HomeWorkSet.FreshAllHomeWork(studentData.UID);
|
||||
studentData.CurentHomeWork = studentData.HomeWorkSet.Get(studentData.CurrentHomeWorkIndex);
|
||||
return studentData;
|
||||
}
|
||||
|
||||
public static void GetStudentDetailInfo(ref StudentInfo studentData)
|
||||
{
|
||||
studentData.ErrorSet.QueryErrorSet(studentData.UID);
|
||||
studentData.HomeWorkSet.QueryCQSet(studentData.UID);
|
||||
studentData.HomeWorkSet.FreshAllHomeWork(studentData.UID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,15 +114,18 @@ namespace StudentManager.Data
|
||||
public string Contact { get; set; } = "Contact";
|
||||
public string Address { get; set; } = "Address";
|
||||
public int Grade { get; set; } = 1;
|
||||
public int HomeWorkCount { get; set; } = 0;
|
||||
|
||||
|
||||
public ErrorSet ErrorSet { get; set; } = new ErrorSet();
|
||||
public HomeWorkSet HomeWorkSet { get; set; } = new HomeWorkSet();
|
||||
|
||||
public int CurrentHomeWorkIndex = 0;
|
||||
public HomeWork CurentHomeWork { get; set; } = new HomeWork();
|
||||
|
||||
public void PublicHomeWork()
|
||||
public void PublicHomeWork(HomeWork homeWork)
|
||||
{
|
||||
HomeWorkSet.AddHomeWork(CurentHomeWork);
|
||||
HomeWorkSet.AddHomeWork(homeWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,7 @@ namespace StudentManager.Editor
|
||||
|
||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var c = DataContext as Students;
|
||||
if (c != null)
|
||||
{
|
||||
c.SelectedCQData = (Data.CursonQuestionsData)(sender as ListBox).SelectedItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,11 @@
|
||||
<Grid>
|
||||
<DockPanel LastChildFill="False">
|
||||
|
||||
<ListBox ItemsSource="{Binding CQDatas}"
|
||||
SelectedItem="{Binding SelectedStudent}">
|
||||
<ListBox ItemsSource="{Binding SelectedHomeWorkSet}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction
|
||||
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||
Command="{Binding DataContext.HomeWorkSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListBox.ItemTemplate>
|
||||
@ -25,13 +24,14 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding StudentCQDatas}">
|
||||
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding HomeWork}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel Width="800" HorizontalAlignment="Stretch" LastChildFill="False">
|
||||
<TextBlock DockPanel.Dock="Left" Text="{Binding Id}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Stem}" TextWrapping="Wrap"/>
|
||||
<CheckBox Grid.Column="2" DockPanel.Dock="Right" Content="正确?"/>
|
||||
<TextBlock Text="{Binding DateTime}"/>
|
||||
<TextBlock Text="{Binding QuestionData.QuestionData.Stem}"/>
|
||||
<TextBlock Text="{Binding QuestionData.Stem}" TextWrapping="Wrap"/>
|
||||
<CheckBox DockPanel.Dock="Right" Content="正确?"/>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
@ -27,6 +27,7 @@
|
||||
<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}}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
@ -65,12 +66,12 @@
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalQuestions}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding SelectedStudent.TotalsQuestions}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding SelectedStudent.CorrectionCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding SelectedStudent.UnCorrectCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding SelectedStudent.ErrorRate}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding SelectedStudent.CorrectRate}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.TotalCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.TotalErrorCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.CorrectCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.ErrorCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.ErrorRate}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorSet.CorrectRate}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
@ -87,14 +88,18 @@
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="状态"/>
|
||||
</StackPanel>
|
||||
|
||||
<ListBox ItemsSource="{Binding CQDatas}"
|
||||
SelectionChanged="ListBox_SelectionChanged">
|
||||
<ListBox ItemsSource="{Binding HomeWorkSet}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<i:InvokeCommandAction
|
||||
CommandParameter="DetailCheckView"
|
||||
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction
|
||||
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
|
||||
Command="{Binding DataContext.HomeWorkSetSelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
|
@ -28,11 +28,7 @@ namespace StudentManager.Editor
|
||||
|
||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var c = DataContext as Students;
|
||||
if (c != null)
|
||||
{
|
||||
c.SelectedCQData = (Data.CursonQuestionsData)(sender as ListBox).SelectedItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,11 +18,6 @@
|
||||
SelectedItem="{Binding SelectedStudent}">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<!--<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction
|
||||
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||
</i:EventTrigger>-->
|
||||
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<i:InvokeCommandAction
|
||||
CommandParameter="DetailView"
|
||||
@ -33,11 +28,11 @@
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Name}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalsQuestions}"/>
|
||||
<!--<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalsQuestions}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectionCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding UnCorrectCount}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorRate}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectRate}"/>
|
||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectRate}"/>-->
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
@ -23,6 +23,12 @@ namespace StudentManager.Editor
|
||||
public StudentsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
Initialized += StudentsView_Initialized;
|
||||
}
|
||||
|
||||
private void StudentsView_Initialized(object? sender, EventArgs e)
|
||||
{
|
||||
var data = DataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,21 +47,24 @@ namespace StudentManager.Model
|
||||
class Students : BindableBase
|
||||
{
|
||||
|
||||
private ObservableCollection<StudentData> studentDatas = new ObservableCollection<StudentData>();
|
||||
public ReadOnlyObservableCollection<StudentData> StudentDatas { get; private set; }
|
||||
private ObservableCollection<StudentInfo> studentDatas = new ObservableCollection<StudentInfo>();
|
||||
public ReadOnlyObservableCollection<StudentInfo> StudentDatas { get; private set; }
|
||||
|
||||
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
|
||||
public ReadOnlyObservableCollection<QuestionData> QuestionDatas { get; private set; }
|
||||
|
||||
private ObservableCollection<QuestionData> studentQuestionDatas = new ObservableCollection<QuestionData>();
|
||||
public ReadOnlyObservableCollection<QuestionData> StudentQuestionDatas { get; private set; }
|
||||
private ObservableCollection<DetailErrorInfo> errorSetDatas = new ObservableCollection<DetailErrorInfo>();
|
||||
public ReadOnlyObservableCollection<DetailErrorInfo> ErrorSetDatas { get; private set; }
|
||||
|
||||
private ObservableCollection<CursonQuestionsData> cQDatas = new ObservableCollection<CursonQuestionsData>();
|
||||
public ReadOnlyObservableCollection<CursonQuestionsData> CQDatas { get; private set; }
|
||||
|
||||
|
||||
private ObservableCollection<QuestionData> studentCQDatas = new ObservableCollection<QuestionData>();
|
||||
public ReadOnlyObservableCollection<QuestionData> StudentCQDatas { get; private set; }
|
||||
private ObservableCollection<DetailHomeWorkSetInfo> homeWorkSet = new ObservableCollection<DetailHomeWorkSetInfo>();
|
||||
public ObservableCollection<DetailHomeWorkSetInfo> HomeWorkSet { get { return homeWorkSet; } private set { homeWorkSet = value; RaisePropertyChanged(); } }
|
||||
|
||||
private ObservableCollection<DetailHomeWorkInfo> homeWork = new ObservableCollection<DetailHomeWorkInfo>();
|
||||
public ObservableCollection<DetailHomeWorkInfo> HomeWork { get { return homeWork; } private set { homeWork = value; RaisePropertyChanged(); } }
|
||||
|
||||
private ObservableCollection<MenuBar> menuBars = new ObservableCollection<MenuBar>();
|
||||
public ReadOnlyObservableCollection<MenuBar> MenuBars { get; private set; }
|
||||
@ -76,27 +79,53 @@ namespace StudentManager.Model
|
||||
}
|
||||
|
||||
|
||||
private StudentData selectedStudent;
|
||||
public StudentData SelectedStudent
|
||||
private StudentInfo selectedStudent;
|
||||
public StudentInfo SelectedStudent
|
||||
{
|
||||
get { return selectedStudent; }
|
||||
set { selectedStudent = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private CursonQuestionsData selectedCQData;
|
||||
public CursonQuestionsData SelectedCQData
|
||||
private DetailHomeWorkSetInfo selectedHomeWorkSet;
|
||||
public DetailHomeWorkSetInfo SelectedHomeWorkSet
|
||||
{
|
||||
get { return selectedCQData; }
|
||||
set { selectedCQData = value; RaisePropertyChanged(); }
|
||||
get { return selectedHomeWorkSet; }
|
||||
set { selectedHomeWorkSet = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DetailHomeWorkInfo selectedHomeWork;
|
||||
public DetailHomeWorkInfo SelectedHomeWork
|
||||
{
|
||||
get { return selectedHomeWork; }
|
||||
set { selectedHomeWork = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private StudentInfo studentInfo;
|
||||
|
||||
public StudentInfo StudentInfo
|
||||
{
|
||||
get { return studentInfo; }
|
||||
set { studentInfo = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DetailErrorSetInfo errorSet;
|
||||
|
||||
public DetailErrorSetInfo ErrorSet
|
||||
{
|
||||
get { return errorSet; }
|
||||
set { errorSet = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private readonly IRegionManager regionManager;
|
||||
|
||||
public DelegateCommand<string> RegionTo { get; set; }
|
||||
public DelegateCommand SelectedCommand { get; set; }
|
||||
public DelegateCommand<CursonQuestionsData> CQSelectedCommand { get; set; }
|
||||
public DelegateCommand<StudentInfo> SelectedCommand { get; set; }
|
||||
public DelegateCommand<DetailHomeWorkInfo> HomeWorkSelectedCommand { get; set; }
|
||||
public DelegateCommand<DetailHomeWorkSetInfo> HomeWorkSetSelectedCommand { get; set; }
|
||||
public DelegateCommand RegionToDetailCommand { get; set; }
|
||||
|
||||
Students(IRegionManager regionManager)
|
||||
@ -107,28 +136,44 @@ namespace StudentManager.Model
|
||||
regionManager.Regions[PrismManager.MainRegionName].RequestNavigate(x.ToString());
|
||||
if(x == "DetailCheckView")
|
||||
{
|
||||
RegionToDCV();
|
||||
RegionToDetailCheckView();
|
||||
}
|
||||
if (x == "DetailView")
|
||||
{
|
||||
RegionToDetailView();
|
||||
}
|
||||
RegionToStudents();
|
||||
});
|
||||
|
||||
SelectedCommand = new DelegateCommand(() =>
|
||||
SelectedCommand = new DelegateCommand<StudentInfo>((x) =>
|
||||
{
|
||||
cQDatas.Clear();
|
||||
SQLHelper.Query<CursonQuestionsData>(Tables.CQTable, SelectedStudent.UID).ForEach(x => cQDatas.Add(x));
|
||||
if (x == null) return;
|
||||
SelectedStudent = x;
|
||||
RegionToDetailView();
|
||||
});
|
||||
|
||||
CQSelectedCommand = new DelegateCommand<CursonQuestionsData>((e) =>
|
||||
HomeWorkSetSelectedCommand = new DelegateCommand<DetailHomeWorkSetInfo>((x) =>
|
||||
{
|
||||
selectedCQData = e;
|
||||
if (x == null) return;
|
||||
selectedHomeWorkSet = x;
|
||||
HomeWork = SelectedStudent.HomeWorkSet.GetDetailHomeWorkList(SelectedHomeWorkSet.Lesson);
|
||||
});
|
||||
|
||||
StudentDatas = new ReadOnlyObservableCollection<StudentData>(studentDatas);
|
||||
HomeWorkSelectedCommand = new DelegateCommand<DetailHomeWorkInfo>((e) =>
|
||||
{
|
||||
if(e == null) return;
|
||||
//HomeWork =
|
||||
});
|
||||
|
||||
|
||||
Load();
|
||||
|
||||
StudentDatas = new ReadOnlyObservableCollection<StudentInfo>(studentDatas);
|
||||
QuestionDatas = new ReadOnlyObservableCollection<QuestionData>(questionDatas);
|
||||
StudentQuestionDatas = new ReadOnlyObservableCollection<QuestionData>(studentQuestionDatas);
|
||||
ErrorSetDatas = new ReadOnlyObservableCollection<DetailErrorInfo>(errorSetDatas);
|
||||
MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars);
|
||||
CQDatas = new ReadOnlyObservableCollection<CursonQuestionsData>(cQDatas);
|
||||
StudentCQDatas = new ReadOnlyObservableCollection<QuestionData>(studentCQDatas);
|
||||
//CQDatas = new ReadOnlyObservableCollection<CursonQuestionsData>(cQDatas);
|
||||
HomeWorkSet = new ObservableCollection<DetailHomeWorkSetInfo>(homeWorkSet);
|
||||
|
||||
|
||||
|
||||
@ -136,22 +181,20 @@ namespace StudentManager.Model
|
||||
this.regionManager = regionManager;
|
||||
|
||||
|
||||
|
||||
StudentInfo studentInfo = new StudentInfo();
|
||||
|
||||
//QueryAll();
|
||||
|
||||
StudentLib.FreshAllStudentInfo();
|
||||
StudentLib.Save();
|
||||
|
||||
QuestionLib.Load();
|
||||
QuestionLib.Save();
|
||||
SaveAll();
|
||||
}
|
||||
|
||||
private void RegionToDCV()
|
||||
private void RegionToDetailView()
|
||||
{
|
||||
Debug.Assert(SelectedCQData != null);
|
||||
GetQuestions(SelectedCQData.ProblemIDS);
|
||||
if(selectedStudent == null) return;
|
||||
ErrorSet = selectedStudent.ErrorSet.GetDetailErrorSetInfo();
|
||||
HomeWorkSet = selectedStudent.HomeWorkSet.GetDetailHomeWorkSetList();
|
||||
}
|
||||
|
||||
private void RegionToDetailCheckView()
|
||||
{
|
||||
if (selectedHomeWorkSet == null) return;
|
||||
HomeWork = SelectedStudent.HomeWorkSet.GetDetailHomeWorkList(SelectedHomeWorkSet.Lesson);
|
||||
}
|
||||
|
||||
private void RegionToStudents()
|
||||
@ -169,43 +212,18 @@ namespace StudentManager.Model
|
||||
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "DetailCheckView" });
|
||||
}
|
||||
|
||||
|
||||
private void QueryAll()
|
||||
private void Load()
|
||||
{
|
||||
studentDatas.Clear();
|
||||
questionDatas.Clear();
|
||||
//cQDatas.Clear();
|
||||
//SQLHelper.Query<CursonQuestionsData>(Tables.CQTable,1).ForEach(x => cQDatas.Add(x));
|
||||
SQLHelper.Query<StudentData>(Tables.UserTable).ForEach(x => studentDatas.Add(x));
|
||||
SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => questionDatas.Add(x));
|
||||
|
||||
|
||||
|
||||
ComputeData();
|
||||
//SQLHelper.UnionQuery<QuestionData>().ForEach(x => questionDatas.Add(x));
|
||||
StudentLib.Load();
|
||||
QuestionLib.Load();
|
||||
studentDatas = StudentLib.GetAllStudents();
|
||||
questionDatas = QuestionLib.GetAllQuestion();
|
||||
}
|
||||
|
||||
private void ComputeData()
|
||||
private void SaveAll()
|
||||
{
|
||||
TotalQuestions = questionDatas.Count();
|
||||
|
||||
foreach (var item in StudentDatas)
|
||||
{
|
||||
item.UnCorrectCount = item.TotalsQuestions - item.CorrectionCount;
|
||||
item.ErrorRate = item.TotalsQuestions / TotalQuestions;
|
||||
item.CorrectRate = item.CorrectionCount / item.TotalsQuestions;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetQuestions(int[] ids)
|
||||
{
|
||||
if (SelectedCQData == null) return;
|
||||
studentCQDatas.Clear();
|
||||
foreach (var id in ids)
|
||||
{
|
||||
var q = QuestionDatas.FirstOrDefault((s) => s.Id == id);
|
||||
studentCQDatas.Add(q);
|
||||
}
|
||||
StudentLib.Save();
|
||||
QuestionLib.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user