User
This commit is contained in:
parent
16c224fa65
commit
1e914941de
@ -21,6 +21,9 @@ namespace StudentManager
|
|||||||
containerRegistry.RegisterForNavigation<MainEditor, Students>();
|
containerRegistry.RegisterForNavigation<MainEditor, Students>();
|
||||||
containerRegistry.RegisterForNavigation<StudentsView>();
|
containerRegistry.RegisterForNavigation<StudentsView>();
|
||||||
containerRegistry.RegisterForNavigation<QuestionsView>();
|
containerRegistry.RegisterForNavigation<QuestionsView>();
|
||||||
|
containerRegistry.RegisterForNavigation<CheckView>();
|
||||||
|
containerRegistry.RegisterForNavigation<DetailView>();
|
||||||
|
containerRegistry.RegisterForNavigation<DetailCheckView>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +61,12 @@ namespace StudentManager.Common
|
|||||||
{
|
{
|
||||||
|
|
||||||
(data as CursonQuestionsData).UID = (int)reader[0];
|
(data as CursonQuestionsData).UID = (int)reader[0];
|
||||||
(data as CursonQuestionsData).ProblemIDS = JsonConvert.DeserializeObject<int[]>(reader[1].ToString());
|
(data as CursonQuestionsData).ProblemIDS = string.IsNullOrEmpty(reader[1].ToString()) ? Array.Empty<int>() : JsonConvert.DeserializeObject<int[]>(reader[1].ToString());
|
||||||
(data as CursonQuestionsData).CorrectIDS = JsonConvert.DeserializeObject<int[]>(reader[2].ToString());
|
(data as CursonQuestionsData).CorrectIDS = string.IsNullOrEmpty(reader[2].ToString()) ? Array.Empty<int>() : JsonConvert.DeserializeObject<int[]>(reader[2].ToString());
|
||||||
(data as CursonQuestionsData).lesson = (int)reader[3];
|
(data as CursonQuestionsData).Lesson = (byte)reader[3];
|
||||||
|
(data as CursonQuestionsData).Status = (byte)reader[4];
|
||||||
|
(data as CursonQuestionsData).TotalCount = (data as CursonQuestionsData).ProblemIDS.Length;
|
||||||
|
(data as CursonQuestionsData).CorrectCount = (data as CursonQuestionsData).CorrectIDS.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ namespace StudentManager.Common
|
|||||||
|
|
||||||
List<T> result = new List<T>();
|
List<T> result = new List<T>();
|
||||||
|
|
||||||
string idName = typeof(T) == typeof(StudentData) ? Tables.UserTable : typeof(T) == typeof(QuestionData) ? Tables.QuesTable : Tables.CQTable;
|
string idName = typeof(T) == typeof(StudentData) ? "user_id" : typeof(T) == typeof(QuestionData) ? "problem_id" : "user_id";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
@ -6,12 +6,18 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StudentManager.Data
|
namespace StudentManager.Data
|
||||||
{
|
{
|
||||||
public class CursonQuestionsData
|
public class CursonQuestionsData : IDataCommon
|
||||||
{
|
{
|
||||||
public int UID { get; set; } = 0;
|
public int UID { get; set; } = 0;
|
||||||
public int[] ProblemIDS { get; set; } = { };
|
public int[] ProblemIDS { get; set; } = { };
|
||||||
public int[] CorrectIDS { get; set; } = { };
|
public int[] CorrectIDS { get; set; } = { };
|
||||||
public int lesson = 0;
|
|
||||||
|
|
||||||
|
public int Lesson { get; set; } = 0;
|
||||||
|
public int TotalCount { get; set; } = 0;
|
||||||
|
public int CorrectCount { get; set; } = 0;
|
||||||
|
public int Status { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public string TableName { get => "users"; set => throw new NotImplementedException(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,10 @@ namespace StudentManager.Data
|
|||||||
public int CorrectionCount { get; set; } = 0;
|
public int CorrectionCount { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public float ErrorRate { get; set; } = 0;
|
||||||
|
public float CorrectRate { get; set; } = 0;
|
||||||
|
public int UnCorrectCount { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public string TableName { get => "users"; set => throw new NotImplementedException(); }
|
public string TableName { get => "users"; set => throw new NotImplementedException(); }
|
||||||
|
49
StudentManager/Editor/CheckView.xaml
Normal file
49
StudentManager/Editor/CheckView.xaml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<UserControl x:Class="StudentManager.Editor.CheckView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ListBox ItemsSource="{Binding StudentDatas}"
|
||||||
|
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:Interaction.Triggers>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{Binding SelectedStudent.Name}"/>
|
||||||
|
<ListBox ItemsSource="{Binding CQDatas}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding TotalCount}"/>
|
||||||
|
<TextBlock Text="{Binding CorrectCount}"/>
|
||||||
|
<TextBlock Text="{Binding Lesson}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
28
StudentManager/Editor/CheckView.xaml.cs
Normal file
28
StudentManager/Editor/CheckView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StudentManager.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CheckView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class CheckView : UserControl
|
||||||
|
{
|
||||||
|
public CheckView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
StudentManager/Editor/DetailCheckView.xaml
Normal file
28
StudentManager/Editor/DetailCheckView.xaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<UserControl x:Class="StudentManager.Editor.DetailCheckView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<DockPanel LastChildFill="False">
|
||||||
|
|
||||||
|
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding StudentCQDatas}">
|
||||||
|
<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="正确?"/>
|
||||||
|
</DockPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
<Button DockPanel.Dock="Bottom" Content="提交"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
28
StudentManager/Editor/DetailCheckView.xaml.cs
Normal file
28
StudentManager/Editor/DetailCheckView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StudentManager.Editor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DetailCheckView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class DetailCheckView : UserControl
|
||||||
|
{
|
||||||
|
public DetailCheckView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,9 +4,111 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:StudentManager.Editor"
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Style x:Key="TextStyle" TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Margin" Value="10,5"/>
|
||||||
|
<Setter Property="Width" Value="50"/>
|
||||||
|
</Style>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
|
||||||
|
<ListBox ItemsSource="{Binding StudentDatas}"
|
||||||
|
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:Interaction.Triggers>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="姓名"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="正确数"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="第几课"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="状态"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="总题数量"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="总错题数量"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="修正数量"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="错误数量"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="错误率"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="修正率"/>
|
||||||
|
|
||||||
|
</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}"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="第几课"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="总数"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="正确数"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="状态"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<ListBox ItemsSource="{Binding CQDatas}"
|
||||||
|
SelectionChanged="ListBox_SelectionChanged">
|
||||||
|
<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="MouseDoubleClick">
|
||||||
|
<i:InvokeCommandAction
|
||||||
|
CommandParameter="DetailCheckView"
|
||||||
|
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Lesson}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalCount}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectCount}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Status}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using StudentManager.Model;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -24,5 +25,14 @@ namespace StudentManager.Editor
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var c = DataContext as Students;
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
c.SelectedCQData = (Data.CursonQuestionsData)(sender as ListBox).SelectedItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,19 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StudentManager.Editor"
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
xmlns:prism="http://prismlibrary.com/"
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
xmlns:extent="clr-namespace:StudentManager.Extensions"
|
xmlns:extent="clr-namespace:StudentManager.Extensions"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainEditor" Height="450" Width="800">
|
Title="MainEditor" Height="450" Width="800">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="200"/>
|
<ColumnDefinition Width="100"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ItemsControl ItemsSource="{Binding MenuBars}">
|
<ItemsControl ItemsSource="{Binding MenuBars}">
|
||||||
|
|
||||||
|
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
<Button Content="{Binding Title}" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||||
|
@ -4,31 +4,40 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:StudentManager.Editor"
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<Style x:Key="TextStyle" TargetType="{x:Type TextBlock}">
|
<Style x:Key="TextStyle" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Margin" Value="10,5"/>
|
<Setter Property="Margin" Value="10,5"/>
|
||||||
|
<Setter Property="Width" Value="50"/>
|
||||||
</Style>
|
</Style>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<ListBox ItemsSource="{Binding StudentDatas}">
|
<ListBox ItemsSource="{Binding StudentDatas}"
|
||||||
<!--<i:Interaction.Triggers>
|
SelectedItem="{Binding SelectedStudent}">
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
|
||||||
<i:InvokeCommandAction x:Name="menuTrigger" Command="{Binding navigateCommand}" CommandParameter="{Binding ElementName=menu, Path=SelectedItem}"/>
|
<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"
|
||||||
|
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>-->
|
</i:Interaction.Triggers>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding UID}"/>
|
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Name}"/>
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Name}"/>
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Gender}"/>
|
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Contact}"/>
|
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Address}"/>
|
|
||||||
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Grade}"/>
|
|
||||||
<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 CorrectionCount}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding UnCorrectCount}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorRate}"/>
|
||||||
|
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectRate}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
|
@ -5,6 +5,7 @@ using StudentManager.Extensions;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -52,12 +53,51 @@ namespace StudentManager.Model
|
|||||||
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
|
private ObservableCollection<QuestionData> questionDatas = new ObservableCollection<QuestionData>();
|
||||||
public ReadOnlyObservableCollection<QuestionData> QuestionDatas { get; private set; }
|
public ReadOnlyObservableCollection<QuestionData> QuestionDatas { get; private set; }
|
||||||
|
|
||||||
|
private ObservableCollection<QuestionData> studentQuestionDatas = new ObservableCollection<QuestionData>();
|
||||||
|
public ReadOnlyObservableCollection<QuestionData> StudentQuestionDatas { 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<MenuBar> menuBars = new ObservableCollection<MenuBar>();
|
private ObservableCollection<MenuBar> menuBars = new ObservableCollection<MenuBar>();
|
||||||
public ReadOnlyObservableCollection<MenuBar> MenuBars { get; private set; }
|
public ReadOnlyObservableCollection<MenuBar> MenuBars { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private int totalQuestions;
|
||||||
|
public int TotalQuestions
|
||||||
|
{
|
||||||
|
get { return totalQuestions; }
|
||||||
|
set { totalQuestions = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private StudentData selectedStudent;
|
||||||
|
public StudentData SelectedStudent
|
||||||
|
{
|
||||||
|
get { return selectedStudent; }
|
||||||
|
set { selectedStudent = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private CursonQuestionsData selectedCQData;
|
||||||
|
public CursonQuestionsData SelectedCQData
|
||||||
|
{
|
||||||
|
get { return selectedCQData; }
|
||||||
|
set { selectedCQData = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private readonly IRegionManager regionManager;
|
private readonly IRegionManager regionManager;
|
||||||
|
|
||||||
public DelegateCommand<string> RegionTo { get; set; }
|
public DelegateCommand<string> RegionTo { get; set; }
|
||||||
|
public DelegateCommand SelectedCommand { get; set; }
|
||||||
|
public DelegateCommand<CursonQuestionsData> CQSelectedCommand { get; set; }
|
||||||
|
public DelegateCommand RegionToDetailCommand { get; set; }
|
||||||
|
|
||||||
Students(IRegionManager regionManager)
|
Students(IRegionManager regionManager)
|
||||||
{
|
{
|
||||||
@ -65,14 +105,30 @@ namespace StudentManager.Model
|
|||||||
|
|
||||||
RegionTo = new DelegateCommand<string>((x) => {
|
RegionTo = new DelegateCommand<string>((x) => {
|
||||||
regionManager.Regions[PrismManager.MainRegionName].RequestNavigate(x.ToString());
|
regionManager.Regions[PrismManager.MainRegionName].RequestNavigate(x.ToString());
|
||||||
|
if(x == "DetailCheckView")
|
||||||
|
{
|
||||||
|
RegionToDCV();
|
||||||
|
}
|
||||||
RegionToStudents();
|
RegionToStudents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
SelectedCommand = new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
cQDatas.Clear();
|
||||||
|
SQLHelper.Query<CursonQuestionsData>(Tables.CQTable, SelectedStudent.UID).ForEach(x => cQDatas.Add(x));
|
||||||
|
});
|
||||||
|
|
||||||
|
CQSelectedCommand = new DelegateCommand<CursonQuestionsData>((e) =>
|
||||||
|
{
|
||||||
|
selectedCQData = e;
|
||||||
|
});
|
||||||
|
|
||||||
StudentDatas = new ReadOnlyObservableCollection<StudentData>(studentDatas);
|
StudentDatas = new ReadOnlyObservableCollection<StudentData>(studentDatas);
|
||||||
QuestionDatas = new ReadOnlyObservableCollection<QuestionData>(questionDatas);
|
QuestionDatas = new ReadOnlyObservableCollection<QuestionData>(questionDatas);
|
||||||
|
StudentQuestionDatas = new ReadOnlyObservableCollection<QuestionData>(studentQuestionDatas);
|
||||||
MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars);
|
MenuBars = new ReadOnlyObservableCollection<MenuBar>(menuBars);
|
||||||
|
CQDatas = new ReadOnlyObservableCollection<CursonQuestionsData>(cQDatas);
|
||||||
|
StudentCQDatas = new ReadOnlyObservableCollection<QuestionData>(studentCQDatas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +139,12 @@ namespace StudentManager.Model
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RegionToDCV()
|
||||||
|
{
|
||||||
|
Debug.Assert(SelectedCQData != null);
|
||||||
|
GetQuestions(SelectedCQData.ProblemIDS);
|
||||||
|
}
|
||||||
|
|
||||||
private void RegionToStudents()
|
private void RegionToStudents()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -91,7 +153,11 @@ namespace StudentManager.Model
|
|||||||
void CreateMenuBar()
|
void CreateMenuBar()
|
||||||
{
|
{
|
||||||
menuBars.Add(new MenuBar() { Icon = "ForumPlusOutline", Title = "学生", NameSpace = "StudentsView" });
|
menuBars.Add(new MenuBar() { Icon = "ForumPlusOutline", Title = "学生", NameSpace = "StudentsView" });
|
||||||
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "详情", NameSpace = "DetailView" });
|
||||||
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "题库", NameSpace = "QuestionsView" });
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "题库", NameSpace = "QuestionsView" });
|
||||||
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "审批", NameSpace = "CheckView" });
|
||||||
|
//menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "QuestionsView" });
|
||||||
|
menuBars.Add(new MenuBar() { Icon = "CodeGreaterThanOrEqual", Title = "出题", NameSpace = "DetailCheckView" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,9 +165,38 @@ namespace StudentManager.Model
|
|||||||
{
|
{
|
||||||
studentDatas.Clear();
|
studentDatas.Clear();
|
||||||
questionDatas.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<StudentData>(Tables.UserTable).ForEach(x => studentDatas.Add(x));
|
||||||
//SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => questionDatas.Add(x));
|
SQLHelper.Query<QuestionData>(Tables.QuesTable).ForEach(x => questionDatas.Add(x));
|
||||||
SQLHelper.UnionQuery<QuestionData>(1).ForEach(x => questionDatas.Add(x));
|
|
||||||
|
|
||||||
|
|
||||||
|
ComputeData();
|
||||||
|
//SQLHelper.UnionQuery<QuestionData>().ForEach(x => questionDatas.Add(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComputeData()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Editor\CheckView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Editor\DetailCheckView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Editor\DetailView.xaml.cs">
|
<Compile Update="Editor\DetailView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -21,6 +27,12 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Update="Editor\CheckView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Editor\DetailCheckView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Editor\DetailView.xaml">
|
<Page Update="Editor\DetailView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
Loading…
Reference in New Issue
Block a user