Добавьте файлы проекта.
This commit is contained in:
76
musicschoolapp/Pages/QuickEnroll.xaml.cs
Normal file
76
musicschoolapp/Pages/QuickEnroll.xaml.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
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 musicschoolapp.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для QuickEnroll.xaml
|
||||
/// </summary>
|
||||
public partial class QuickEnroll : Page
|
||||
{
|
||||
musicschoolEntities1 mse = new musicschoolEntities1();
|
||||
public QuickEnroll()
|
||||
{
|
||||
InitializeComponent();
|
||||
comboboxCourse.ItemsSource = mse.Course.ToList();
|
||||
comboboxCourse.DisplayMemberPath = "Name";
|
||||
dGridStudent.ItemsSource = mse.Student.ToList();
|
||||
}
|
||||
|
||||
private void dGridStudent_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
if (dGridStudent.SelectedCells[3] != null)
|
||||
{
|
||||
|
||||
}
|
||||
foreach (var student in dGridStudent.ItemsSource)
|
||||
{
|
||||
var student_ = student as Student;
|
||||
if (true)
|
||||
{
|
||||
|
||||
if (student_.toEnroll)
|
||||
{
|
||||
Enrollment enrollment = new Enrollment();
|
||||
enrollment.StudentID = student_.StudentID;
|
||||
enrollment.CourseID = (comboboxCourse.SelectedItem as Course).CourseID;
|
||||
enrollment.EnrollmentDate = DateTime.Now;
|
||||
enrollment.Grade = student_.grade;
|
||||
mse.Enrollment.Add(enrollment);
|
||||
student_.toEnroll = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Добавлено: " + mse.SaveChanges());
|
||||
}
|
||||
|
||||
private void comboboxCourse_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
dGridStudent.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user