withoutComments
This commit is contained in:
parent
c5083481c6
commit
d7abb5ffd6
@ -12,7 +12,6 @@
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock x:Name="SuccessMessage" Foreground="Green" FontSize="14" Height="40" Width="300" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
<TextBox x:Name="DisciplineNameTextBox" Watermark="Имя"/>
|
||||
<!-- <ComboBox x:Name="GroupsComboBox" HorizontalAlignment="Center" Margin="0, 0, 5, 0"/> -->
|
||||
<ListBox x:Name="ListBoxGroups" Margin="0,10,0,0" SelectionMode="Multiple" Height="150"/>
|
||||
<ComboBox x:Name="FormAttestComboBox" HorizontalAlignment="Center" Margin="0, 0, 5, 0"/>
|
||||
<Button Click="ButtonAdd_OnClick" Foreground="Black" Background="LightGray" Content="Добавить"/>
|
||||
|
@ -31,11 +31,6 @@ public partial class AddDiscipline : Window
|
||||
|
||||
private void ButtonAdd_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// if (string.IsNullOrWhiteSpace(ListBoxGroups.SelectedItem.ToString()) || string.IsNullOrWhiteSpace(DisciplineNameTextBox.Text) || string.IsNullOrWhiteSpace(FormAttestComboBox.SelectedItem.ToString()))
|
||||
// {
|
||||
// ErrorMessage.Text = "Поля не должны быть пустыми!";
|
||||
// return;
|
||||
// }
|
||||
if (FormAttestComboBox.SelectedItem == null ||
|
||||
ListBoxGroups.SelectedItems == null ||
|
||||
ListBoxGroups.SelectedItems.Count == 0 ||
|
||||
|
@ -29,11 +29,6 @@ public partial class AddStudent : Window
|
||||
|
||||
private void ButtonAdd_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// if (string.IsNullOrWhiteSpace(GroupsComboBox.SelectedItem.ToString()) || string.IsNullOrWhiteSpace(FioTextBox.Text))
|
||||
// {
|
||||
// ErrorMessage.Text = "Поля не должны быть пустыми!";
|
||||
// return;
|
||||
// }
|
||||
if (GroupsComboBox.SelectedItem == null ||
|
||||
string.IsNullOrWhiteSpace(FioTextBox?.Text))
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ public partial class AddTeacher : Window
|
||||
Discipline = it,
|
||||
}).ToList();
|
||||
|
||||
// ListBoxDisciplineGroup.ItemsSource = _disciplineGroups.Select(it => it.NameComboBox);
|
||||
ListBoxDisciplineGroup.ItemsSource = _disciplinePresenters;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ public partial class StudentWindow : Window
|
||||
|
||||
DisciplineComboBox.ItemsSource = disciplines;
|
||||
FlatAttestationGrid.ItemsSource = Attestations;
|
||||
// ListBoxAttestation.ItemsSource = Attestations;
|
||||
}
|
||||
|
||||
public class AttestationPresenter() : Attestation
|
||||
|
@ -16,12 +16,6 @@ public partial class StudentsFromAdminWindow : Window
|
||||
public StudentsFromAdminWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// var ctx = new DatabaseContext();
|
||||
//
|
||||
// Students = ctx.Students.ToList();
|
||||
// FlatGrid.ItemsSource = Students;
|
||||
|
||||
|
||||
var ctx = new DatabaseContext();
|
||||
|
||||
|
@ -112,31 +112,6 @@ public partial class TeacherWindow : Window
|
||||
{
|
||||
DisplayAttestations();
|
||||
}
|
||||
|
||||
// public string CalculateGrade(int total, int formAttest)
|
||||
// {
|
||||
// string grade = "";
|
||||
// switch (formAttest)
|
||||
// {
|
||||
// case 1:
|
||||
// if (total >= 90) grade = "отлично";
|
||||
// else if (total >= 80) grade = "хорошо";
|
||||
// else if (total >= 70) grade = "удовлетворительно";
|
||||
// else grade = "неудовлетворительно";
|
||||
// break;
|
||||
// case 2:
|
||||
// if (total >= 90) grade = "отлично";
|
||||
// else if (total >= 80) grade = "хорошо";
|
||||
// else if (total >= 70) grade = "удовлетворительно";
|
||||
// else grade = "неудовлетворительно";
|
||||
// break;
|
||||
// case 3:
|
||||
// if (total >= 70) grade = "зачтено";
|
||||
// else grade = "не зачтено";
|
||||
// break;
|
||||
// }
|
||||
// return grade;
|
||||
// }
|
||||
|
||||
private async void FirstAttest_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
@ -155,7 +130,6 @@ public partial class TeacherWindow : Window
|
||||
AttestSecond = attestation.AttestSecond,
|
||||
AttestThird = attestation.AttestThird,
|
||||
Total = newFirstAttest + attestation.AttestSecond + attestation.AttestThird,
|
||||
// Grade = CalculateGrade(newFirstAttest + attestation.AttestSecond + attestation.AttestThird, formAttest),
|
||||
Grade = calculateGrade.CalculateGradeMethod(newFirstAttest + attestation.AttestSecond + attestation.AttestThird, formAttest),
|
||||
};
|
||||
|
||||
@ -195,7 +169,6 @@ public partial class TeacherWindow : Window
|
||||
AttestSecond = newSecondAttest,
|
||||
AttestThird = attestation.AttestThird,
|
||||
Total = attestation.AttestFirst + newSecondAttest + attestation.AttestThird,
|
||||
// Grade = CalculateGrade(attestation.AttestFirst + newSecondAttest + attestation.AttestThird, formAttest),
|
||||
Grade = calculateGrade.CalculateGradeMethod(attestation.AttestFirst + newSecondAttest + attestation.AttestThird, formAttest),
|
||||
|
||||
};
|
||||
@ -236,7 +209,6 @@ public partial class TeacherWindow : Window
|
||||
AttestSecond = attestation.AttestSecond,
|
||||
AttestThird = newThirdAttest,
|
||||
Total = attestation.AttestFirst + attestation.AttestSecond + newThirdAttest,
|
||||
// Grade = CalculateGrade(attestation.AttestFirst + attestation.AttestSecond + newThirdAttest, formAttest),
|
||||
Grade = calculateGrade.CalculateGradeMethod(attestation.AttestFirst + attestation.AttestSecond + newThirdAttest, formAttest),
|
||||
};
|
||||
|
||||
@ -258,259 +230,4 @@ public partial class TeacherWindow : Window
|
||||
DisplayAttestations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Collections.ObjectModel;
|
||||
// using System.Linq;
|
||||
// using Avalonia;
|
||||
// using Avalonia.Controls;
|
||||
// using Avalonia.Interactivity;
|
||||
// using Avalonia.Markup.Xaml;
|
||||
// using kursovaya.Models;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
//
|
||||
// namespace kursovaya;
|
||||
//
|
||||
// public partial class TeacherWindow : Window
|
||||
// {
|
||||
// List<DiscGroup> discGroups = new();
|
||||
// public ObservableCollection<AttestationPresenterTeacher> AttestationsTeachers = new ObservableCollection<AttestationPresenterTeacher>();
|
||||
// List<AttestationPresenterTeacher> dataSourceAttestationsTeachers;
|
||||
// public TeacherWindow()
|
||||
// {
|
||||
// InitializeComponent();
|
||||
// }
|
||||
//
|
||||
// public TeacherWindow(User user) : this()
|
||||
// {
|
||||
// var ctx = new DatabaseContext();
|
||||
//
|
||||
// var groups = ctx.Groups.ToList();
|
||||
// var teacherId = ctx.Teachers.FirstOrDefault(t => t.Login == user.Login).Id;
|
||||
// var disciplinesIds = ctx.Disciplines.Include(d => d.DisciplineTeachers).Where(d => d.DisciplineTeachers.Any(dt => dt.IdTeacher == teacherId)).Select(d => d.Id).ToList();
|
||||
// var disciplines = ctx.Disciplines.Include(d => d.DisciplineTeachers).Where(d => d.DisciplineTeachers.Any(dt => dt.IdTeacher == teacherId)).ToList();
|
||||
// dataSourceAttestationsTeachers = ctx.Attestations.Where(a => disciplinesIds.Contains(a.IdDiscipline)).Select(a => new AttestationPresenterTeacher()
|
||||
// {
|
||||
// IdUser = a.IdUser,
|
||||
// IdDiscipline = a.IdDiscipline,
|
||||
// AttestFirst = a.AttestFirst,
|
||||
// AttestSecond = a.AttestSecond,
|
||||
// AttestThird = a.AttestThird,
|
||||
// Total = a.Total,
|
||||
// Grade = a.Grade,
|
||||
// StudentFIO = ctx.Students.Where(s => s.Id == a.IdUser).Select(s => s.Fio).FirstOrDefault(),
|
||||
// }).ToList();
|
||||
// foreach (var group in groups)
|
||||
// {
|
||||
// foreach (var discipline in disciplines)
|
||||
// {
|
||||
// var attestationsToDiscGroup = dataSourceAttestationsTeachers.Where(a => ctx.Students.Any(s => s.Id == a.IdUser && s.IdGroup == group.Id) && a.IdDiscipline == discipline.Id).ToList();
|
||||
// discGroups.Add(new DiscGroup(){discipline = discipline, group = group, attestations = attestationsToDiscGroup});
|
||||
// }
|
||||
// }
|
||||
// discGroups.RemoveAll(d => d.attestations.Count == 0);
|
||||
//
|
||||
// foreach (var discGroup in discGroups)
|
||||
// {
|
||||
// Console.WriteLine($"{discGroup.discipline.Name} - {discGroup.group.Id} - {discGroup.attestations.Count}");
|
||||
// }
|
||||
//
|
||||
// GroupComboBox.ItemsSource = discGroups.Select(dg => dg.group.Id).Distinct().ToList();
|
||||
// DisciplineComboBox.ItemsSource = discGroups.Select(dg => dg.discipline.Name).Distinct().ToList();
|
||||
// FlatAttestationGrid.ItemsSource = AttestationsTeachers;
|
||||
// }
|
||||
//
|
||||
// public class AttestationPresenterTeacher() : Attestation
|
||||
// {
|
||||
// public string StudentFIO { get; set; }
|
||||
// }
|
||||
//
|
||||
// public class DiscGroup
|
||||
// {
|
||||
// public Discipline discipline;
|
||||
// public Group group;
|
||||
// public List<AttestationPresenterTeacher> attestations = new();
|
||||
// }
|
||||
//
|
||||
// public void DisplayAttestations()
|
||||
// {
|
||||
// var ctx = new DatabaseContext();
|
||||
// var temp = dataSourceAttestationsTeachers;
|
||||
// AttestationsTeachers.Clear();
|
||||
//
|
||||
// if (GroupComboBox.SelectionBoxItem != null)
|
||||
// {
|
||||
// var selectedGroupId = Convert.ToInt32(GroupComboBox.SelectedItem);
|
||||
// temp = temp.Where(ap => ctx.Students.Any(s => s.Id == ap.IdUser && s.IdGroup == selectedGroupId)).ToList();
|
||||
// }
|
||||
//
|
||||
// if (DisciplineComboBox.SelectionBoxItem != null)
|
||||
// {
|
||||
// var idDiscipline = ctx.Disciplines.Where(d => d.Name == DisciplineComboBox.SelectionBoxItem)
|
||||
// .Select(d => d.Id).FirstOrDefault();
|
||||
// temp = temp.Where(ap => ap.IdDiscipline == idDiscipline).ToList();
|
||||
// }
|
||||
//
|
||||
// Console.WriteLine("Добавлено элементов: " + temp.Count);
|
||||
//
|
||||
// foreach (var item in temp)
|
||||
// {
|
||||
// AttestationsTeachers.Add(item);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void ButtonBack_OnClick(object? sender, RoutedEventArgs e)
|
||||
// {
|
||||
// Close();
|
||||
// }
|
||||
//
|
||||
// private void CheckAttest_OnClick(object? sender, RoutedEventArgs e)
|
||||
// {
|
||||
// DisplayAttestations();
|
||||
// }
|
||||
//
|
||||
// private string CalculateGrade(int total, int formAttest)
|
||||
// {
|
||||
// string grade = "";
|
||||
// switch (formAttest)
|
||||
// {
|
||||
// case 1:
|
||||
// if (total >= 90) grade = "отлично";
|
||||
// else if (total >= 80) grade = "хорошо";
|
||||
// else if (total >= 70) grade = "удовлетворительно";
|
||||
// else grade = "неудовлетворительно";
|
||||
// break;
|
||||
// case 2:
|
||||
// if (total >= 90) grade = "отлично";
|
||||
// else if (total >= 80) grade = "хорошо";
|
||||
// else if (total >= 70) grade = "удовлетворительно";
|
||||
// else grade = "неудовлетворительно";
|
||||
// break;
|
||||
// case 3:
|
||||
// if (total >= 70) grade = "зачтено";
|
||||
// else grade = "не зачтено";
|
||||
// break;
|
||||
// }
|
||||
// return grade;
|
||||
// }
|
||||
//
|
||||
// private async void FirstAttest_OnClick(object? sender, RoutedEventArgs e)
|
||||
// {
|
||||
// if (sender is Button button && button.Tag is AttestationPresenterTeacher attestation)
|
||||
// {
|
||||
// EditAttestWindow editAttestWindow = new EditAttestWindow(1);
|
||||
// var newFirstAttest = await editAttestWindow.ShowDialog<int>(this);
|
||||
// var ctx = new DatabaseContext();
|
||||
// var formAttest = ctx.Disciplines.FirstOrDefault(d => d.Id == attestation.IdDiscipline).IdFormAttest;
|
||||
//
|
||||
// Attestation newAttestation = new Attestation()
|
||||
// {
|
||||
// IdUser = attestation.IdUser,
|
||||
// IdDiscipline = attestation.IdDiscipline,
|
||||
// AttestFirst = newFirstAttest,
|
||||
// AttestSecond = attestation.AttestSecond,
|
||||
// AttestThird = attestation.AttestThird,
|
||||
// Total = newFirstAttest + attestation.AttestSecond + attestation.AttestThird,
|
||||
// Grade = CalculateGrade(newFirstAttest + attestation.AttestSecond + attestation.AttestThird, formAttest),
|
||||
// };
|
||||
//
|
||||
// ctx.Attestations.Update(newAttestation);
|
||||
// await ctx.SaveChangesAsync();
|
||||
//
|
||||
// dataSourceAttestationsTeachers.Remove(attestation);
|
||||
// dataSourceAttestationsTeachers.Add(new AttestationPresenterTeacher()
|
||||
// {
|
||||
// IdUser = newAttestation.IdUser,
|
||||
// IdDiscipline = newAttestation.IdDiscipline,
|
||||
// AttestFirst = newAttestation.AttestFirst,
|
||||
// AttestSecond = newAttestation.AttestSecond,
|
||||
// AttestThird = newAttestation.AttestThird,
|
||||
// Total = newAttestation.Total,
|
||||
// Grade = newAttestation.Grade,
|
||||
// StudentFIO = ctx.Students.Where(s => s.Id == newAttestation.IdUser).Select(s => s.Fio).FirstOrDefault()
|
||||
// });
|
||||
// DisplayAttestations();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private async void SecondAttest_OnClick(object? sender, RoutedEventArgs e)
|
||||
// {
|
||||
// if (sender is Button button && button.Tag is AttestationPresenterTeacher attestation)
|
||||
// {
|
||||
// EditAttestWindow editAttestWindow = new EditAttestWindow(2);
|
||||
// var newSecondAttest = await editAttestWindow.ShowDialog<int>(this);
|
||||
// var ctx = new DatabaseContext();
|
||||
// var formAttest = ctx.Disciplines.FirstOrDefault(d => d.Id == attestation.IdDiscipline).IdFormAttest;
|
||||
//
|
||||
// Attestation newAttestation = new Attestation()
|
||||
// {
|
||||
// IdUser = attestation.IdUser,
|
||||
// IdDiscipline = attestation.IdDiscipline,
|
||||
// AttestFirst = attestation.AttestFirst,
|
||||
// AttestSecond = newSecondAttest,
|
||||
// AttestThird = attestation.AttestThird,
|
||||
// Total = attestation.AttestFirst + newSecondAttest + attestation.AttestThird,
|
||||
// Grade = CalculateGrade(attestation.AttestFirst + newSecondAttest + attestation.AttestThird, formAttest),
|
||||
// };
|
||||
//
|
||||
// ctx.Attestations.Update(newAttestation);
|
||||
// await ctx.SaveChangesAsync();
|
||||
//
|
||||
// dataSourceAttestationsTeachers.Remove(attestation);
|
||||
// dataSourceAttestationsTeachers.Add(new AttestationPresenterTeacher()
|
||||
// {
|
||||
// IdUser = newAttestation.IdUser,
|
||||
// IdDiscipline = newAttestation.IdDiscipline,
|
||||
// AttestFirst = newAttestation.AttestFirst,
|
||||
// AttestSecond = newAttestation.AttestSecond,
|
||||
// AttestThird = newAttestation.AttestThird,
|
||||
// Total = newAttestation.Total,
|
||||
// Grade = newAttestation.Grade,
|
||||
// StudentFIO = ctx.Students.Where(s => s.Id == newAttestation.IdUser).Select(s => s.Fio).FirstOrDefault()
|
||||
// });
|
||||
// DisplayAttestations();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private async void ThirdAttest_OnClick(object? sender, RoutedEventArgs e)
|
||||
// {
|
||||
// if (sender is Button button && button.Tag is AttestationPresenterTeacher attestation)
|
||||
// {
|
||||
// EditAttestWindow editAttestWindow = new EditAttestWindow(3);
|
||||
// var newThirdAttest = await editAttestWindow.ShowDialog<int>(this);
|
||||
// var ctx = new DatabaseContext();
|
||||
// var formAttest = ctx.Disciplines.FirstOrDefault(d => d.Id == attestation.IdDiscipline).IdFormAttest;
|
||||
//
|
||||
// Attestation newAttestation = new Attestation()
|
||||
// {
|
||||
// IdUser = attestation.IdUser,
|
||||
// IdDiscipline = attestation.IdDiscipline,
|
||||
// AttestFirst = attestation.AttestFirst,
|
||||
// AttestSecond = attestation.AttestSecond,
|
||||
// AttestThird = newThirdAttest,
|
||||
// Total = attestation.AttestFirst + attestation.AttestSecond + newThirdAttest,
|
||||
// Grade = CalculateGrade(attestation.AttestFirst + attestation.AttestSecond + newThirdAttest, formAttest),
|
||||
// };
|
||||
//
|
||||
// ctx.Attestations.Update(newAttestation);
|
||||
// await ctx.SaveChangesAsync();
|
||||
//
|
||||
// dataSourceAttestationsTeachers.Remove(attestation);
|
||||
// dataSourceAttestationsTeachers.Add(new AttestationPresenterTeacher()
|
||||
// {
|
||||
// IdUser = newAttestation.IdUser,
|
||||
// IdDiscipline = newAttestation.IdDiscipline,
|
||||
// AttestFirst = newAttestation.AttestFirst,
|
||||
// AttestSecond = newAttestation.AttestSecond,
|
||||
// AttestThird = newAttestation.AttestThird,
|
||||
// Total = newAttestation.Total,
|
||||
// Grade = newAttestation.Grade,
|
||||
// StudentFIO = ctx.Students.Where(s => s.Id == newAttestation.IdUser).Select(s => s.Fio).FirstOrDefault()
|
||||
// });
|
||||
// DisplayAttestations();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("kursovaya")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+248d3e25d22041172a479699a6cb9d4df419c579")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c5083481c68ef5cc39a2cfcc445063f2773e3a9f")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("kursovaya")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("kursovaya")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
0fff8ebb88ae28dae7ded2aed1d582540b141e9a69d66b9f7cbf35239228691d
|
||||
63629f52d026f6c617a2e1d2be3f8b814551f6d1d0a2981d0c3782f8ad0ba5ad
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user