Очистка using
This commit is contained in:
parent
d0d8bb35ff
commit
523d823b25
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity.Enums
|
||||
namespace StudentProgressRecord.Entity.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum Direction
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity.Enums
|
||||
namespace StudentProgressRecord.Entity.Enums
|
||||
{
|
||||
public enum Operations
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
public class Marks
|
||||
{
|
||||
|
@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
public class Statement
|
||||
{
|
||||
@ -19,7 +12,7 @@ namespace StudentProgressRecord.Entity
|
||||
|
||||
public IEnumerable<Marks> Marks { get; set; } = [];
|
||||
|
||||
public static Statement CreateOperation(long id, long subjectId, long teacherId,
|
||||
public static Statement CreateOperation(long id, long subjectId, long teacherId,
|
||||
DateTime timeStamp, IEnumerable<Marks> marks)
|
||||
{
|
||||
return new Statement
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
public class Student
|
||||
{
|
||||
@ -18,7 +12,7 @@ namespace StudentProgressRecord.Entity
|
||||
public bool Domitory { get; set; }
|
||||
|
||||
|
||||
public static Student CreateEntity(long id, string name, bool familyPos,
|
||||
public static Student CreateEntity(long id, string name, bool familyPos,
|
||||
bool domitory)
|
||||
{
|
||||
return new Student
|
||||
|
@ -1,9 +1,4 @@
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
|
@ -1,9 +1,4 @@
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
public class Teacher
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Entity
|
||||
namespace StudentProgressRecord.Entity
|
||||
{
|
||||
public class TempStatement
|
||||
{
|
||||
|
@ -1,13 +1,4 @@
|
||||
using StudentProgressRecord.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
|
@ -1,14 +1,5 @@
|
||||
using StudentProgressRecord.Reports;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
|
@ -1,13 +1,4 @@
|
||||
using StudentProgressRecord.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
|
@ -1,14 +1,4 @@
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
|
@ -1,16 +1,4 @@
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
@ -25,7 +13,7 @@ namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_studentTransitionRepository= studentTransitionRepository ?? throw new ArgumentNullException(nameof(studentTransitionRepository));
|
||||
_studentTransitionRepository = studentTransitionRepository ?? throw new ArgumentNullException(nameof(studentTransitionRepository));
|
||||
}
|
||||
|
||||
private void FormViewStudentTransition_Load(object sender, EventArgs e)
|
||||
|
@ -1,14 +1,4 @@
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
|
@ -1,14 +1,4 @@
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
|
@ -1,13 +1,4 @@
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
@ -74,7 +65,8 @@ namespace StudentProgressRecord.Forms.FormViewEntities
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!TryGetIdFromSelectesRow(out var findId)){
|
||||
if (!TryGetIdFromSelectesRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
|
@ -1,14 +1,5 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
{
|
||||
@ -34,10 +25,10 @@ namespace StudentProgressRecord.Forms
|
||||
comboBoxSubject.ValueMember = "Id";
|
||||
|
||||
|
||||
var list = new List<int>() {1,2,3,4,5};
|
||||
var list = new List<int>() { 1, 2, 3, 4, 5 };
|
||||
columnMark.ValueType = typeof(int);
|
||||
columnMark.DataSource = list;
|
||||
|
||||
|
||||
columnStudent.DataSource = studentRepository.ReadStudents();
|
||||
columnStudent.DisplayMember = "Name";
|
||||
columnStudent.ValueMember = "Id";
|
||||
|
@ -1,15 +1,5 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
{
|
||||
|
@ -1,18 +1,7 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
{
|
||||
@ -51,7 +40,7 @@ namespace StudentProgressRecord.Forms
|
||||
Console.Write(comboBoxOperations.SelectedItem);
|
||||
_studentTransitionRepository.CreateStudentTransition(
|
||||
StudentTransition.CreateOperation(
|
||||
0L,
|
||||
0L,
|
||||
(long)comboBoxStudent.SelectedValue!,
|
||||
(Operations)comboBoxOperations.SelectedItem!,
|
||||
dateTimePicker.Value)
|
||||
|
@ -1,16 +1,6 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StudentProgressRecord
|
||||
{
|
||||
@ -62,7 +52,7 @@ namespace StudentProgressRecord
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxSubject.Text) ||
|
||||
if (string.IsNullOrWhiteSpace(textBoxSubject.Text) ||
|
||||
checkedListBoxDir.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имя не может быть пустым");
|
||||
|
@ -1,15 +1,5 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StudentProgressRecord.Forms
|
||||
{
|
||||
|
@ -1,14 +1,5 @@
|
||||
using StudentProgressRecord.Forms;
|
||||
using StudentProgressRecord.Forms.FormViewEntities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace StudentProgressRecord
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.IRepositories
|
||||
namespace StudentProgressRecord.IRepositories
|
||||
{
|
||||
public interface IConnectionString
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ namespace StudentProgressRecord.Repositories
|
||||
{
|
||||
public interface IStatementRepository
|
||||
{
|
||||
IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null, DateTime? dateFrom = null, DateTime? dateTo=null);
|
||||
IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null, DateTime? dateFrom = null, DateTime? dateTo = null);
|
||||
|
||||
void CreateStatement(Statement statement);
|
||||
void DeleteStatement(long id);
|
||||
|
@ -1,15 +1,10 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Repositories
|
||||
{
|
||||
public interface IStudentRepository
|
||||
{
|
||||
IEnumerable<Student> ReadStudents(bool? familyPos=null, bool? domitory=null);
|
||||
IEnumerable<Student> ReadStudents(bool? familyPos = null, bool? domitory = null);
|
||||
Student ReadStudentById(long id);
|
||||
void CreateStudent(Student student);
|
||||
void UpdateStudent(Student student);
|
||||
|
@ -1,9 +1,4 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.IRepositories
|
||||
{
|
||||
|
@ -1,9 +1,4 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Repositories
|
||||
{
|
||||
|
@ -1,9 +1,4 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Repositories
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
|
||||
using StudentProgressRecord.Forms;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
@ -30,7 +28,7 @@ namespace StudentProgressRecord
|
||||
|
||||
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
||||
|
||||
container.RegisterType<IConnectionString,ConnectionString>(new SingletonLifetimeManager());
|
||||
container.RegisterType<IConnectionString, ConnectionString>(new SingletonLifetimeManager());
|
||||
|
||||
container.RegisterType<IStatementRepository, StatementRepository>
|
||||
(new TransientLifetimeManager());
|
||||
@ -40,7 +38,7 @@ namespace StudentProgressRecord
|
||||
|
||||
container.RegisterType<ISubjectRepository, SubjectRepository>
|
||||
(new TransientLifetimeManager());
|
||||
|
||||
|
||||
container.RegisterType<ITeacherRepository, TeacherRepository>
|
||||
(new TransientLifetimeManager());
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using StudentProgressRecord.RepositoryImp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
@ -38,12 +32,13 @@ namespace StudentProgressRecord.Reports
|
||||
}
|
||||
private List<(string Caption, double Value)> GetData(DateTime dateTimeStart, DateTime dateTimeEnd)
|
||||
{
|
||||
|
||||
|
||||
return _statementRepository
|
||||
.ReadStatements()
|
||||
.Where(x => x.Date >= dateTimeStart && x.Date <= dateTimeEnd)
|
||||
.SelectMany(x => x.Marks)
|
||||
.GroupBy(x => x.Mark, (key, group) => new {
|
||||
.GroupBy(x => x.Mark, (key, group) => new
|
||||
{
|
||||
Id = key,
|
||||
Count = group.Count()
|
||||
})
|
||||
|
@ -1,10 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
@ -15,7 +10,7 @@ namespace StudentProgressRecord.Reports
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
|
||||
private readonly ITeacherRepository _teacherRepository;
|
||||
|
||||
|
||||
private readonly ILogger<DockReport> _logger;
|
||||
|
||||
public DockReport(ISubjectRepository subjectRepository, IStudentRepository studentRepository, ITeacherRepository teacherRepository, ILogger<DockReport> logger)
|
||||
|
@ -1,6 +1,6 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
@ -175,17 +175,17 @@ namespace StudentProgressRecord.Reports
|
||||
var borders = new Borders() { Count = 2 };
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder (),
|
||||
RightBorder = new RightBorder (),
|
||||
TopBorder = new TopBorder (),
|
||||
BottomBorder = new BottomBorder (),
|
||||
LeftBorder = new LeftBorder(),
|
||||
RightBorder = new RightBorder(),
|
||||
TopBorder = new TopBorder(),
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder{ Style = BorderStyleValues.Thin },
|
||||
LeftBorder = new LeftBorder { Style = BorderStyleValues.Thin },
|
||||
RightBorder = new RightBorder { Style = BorderStyleValues.Thin },
|
||||
TopBorder = new TopBorder {Style = BorderStyleValues.Thin},
|
||||
TopBorder = new TopBorder { Style = BorderStyleValues.Thin },
|
||||
BottomBorder = new BottomBorder { Style = BorderStyleValues.Thin },
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
|
@ -1,11 +1,6 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
@ -71,7 +66,7 @@ namespace StudentProgressRecord.Reports
|
||||
{
|
||||
var style = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||
style.Font.Bold = true;
|
||||
style.Font.Size = 16;
|
||||
style.Font.Size = 16;
|
||||
style.ParagraphFormat.Alignment = ParagraphAlignment.Center;
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,6 @@
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
@ -16,9 +11,9 @@ namespace StudentProgressRecord.Reports
|
||||
private readonly IStatementRepository _statementRepository;
|
||||
private readonly ILogger<TableReport> _logger;
|
||||
internal static readonly string[] item = ["Дата", "Оценка", "Операция"];
|
||||
public TableReport(IStudentTransitionRepository studentTransitionRepository, IStatementRepository statementRepository, ILogger<TableReport> logger)
|
||||
public TableReport(IStudentTransitionRepository studentTransitionRepository, IStatementRepository statementRepository, ILogger<TableReport> logger)
|
||||
{
|
||||
_statementRepository = statementRepository?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
_studentTransitionRepository = studentTransitionRepository ?? throw new ArgumentNullException(nameof(studentTransitionRepository));
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
@ -46,9 +41,10 @@ namespace StudentProgressRecord.Reports
|
||||
{
|
||||
var data = _statementRepository
|
||||
.ReadStatements()
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate &&
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate &&
|
||||
x.Marks.Any(y => y.StudentId == studentId))
|
||||
.Select(x => new {
|
||||
.Select(x => new
|
||||
{
|
||||
Date = x.Date,
|
||||
Mark = x.Marks.FirstOrDefault(y => y.StudentId == studentId)?.Mark,
|
||||
Operation = (Operations?)null
|
||||
@ -57,7 +53,8 @@ namespace StudentProgressRecord.Reports
|
||||
_studentTransitionRepository
|
||||
.ReadStudentTransitions()
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate && x.StudentId == studentId)
|
||||
.Select(x => new {
|
||||
.Select(x => new
|
||||
{
|
||||
Date = x.Date,
|
||||
Mark = (int?)null,
|
||||
Operation = (Operations?)x.Operation
|
||||
@ -70,7 +67,7 @@ namespace StudentProgressRecord.Reports
|
||||
.Select(x => new string[] {
|
||||
x.Date.ToString(), x.Mark?.ToString() ?? string.Empty, x.Operation.ToString() ?? string.Empty}))
|
||||
.Union(
|
||||
[["Всего",data.Where((x) => x.Mark.HasValue).Average(x => x.Mark).ToString(), data.Count(x => x.Operation.HasValue).ToString()]]).ToList();
|
||||
[["Всего", data.Where((x) => x.Mark.HasValue).Average(x => x.Mark).ToString(), data.Count(x => x.Operation.HasValue).ToString()]]).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,6 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.Reports
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
|
||||
namespace StudentProgressRecord.RepositoryImp
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ using Npgsql;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
|
||||
namespace StudentProgressRecord.RepositoryImp
|
||||
@ -32,18 +31,18 @@ namespace StudentProgressRecord.RepositoryImp
|
||||
connection.Open();
|
||||
|
||||
using var transaction = connection.BeginTransaction();
|
||||
|
||||
|
||||
var queryInsert = @"
|
||||
INSERT INTO Statement (SubjectId, TeacherId, Date)
|
||||
VALUES (@SubjectId, @TeacherId, @Date);
|
||||
SELECT MAX(Id) FROM Statement";
|
||||
|
||||
|
||||
var statementID = connection.QueryFirst<int>(queryInsert, statement, transaction);
|
||||
|
||||
|
||||
var querySubInsert = @"
|
||||
INSERT INTO Marks (StatementId, StudentId, Mark)
|
||||
VALUES (@StatementId, @StudentId,@Mark)";
|
||||
|
||||
|
||||
foreach (var elem in statement.Marks)
|
||||
{
|
||||
connection.Execute(querySubInsert, new
|
||||
@ -82,7 +81,7 @@ namespace StudentProgressRecord.RepositoryImp
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null,
|
||||
public IEnumerable<Statement> ReadStatements(long? subjectId = null, long? teacherId = null,
|
||||
DateTime? dateFrom = null, DateTime? dateTo = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
@ -97,8 +96,8 @@ namespace StudentProgressRecord.RepositoryImp
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(objs));
|
||||
|
||||
return objs.GroupBy(x => x.Id, y => y,
|
||||
(key, value) =>
|
||||
return objs.GroupBy(x => x.Id, y => y,
|
||||
(key, value) =>
|
||||
Statement.CreateOperation(value.First(), value.Select(z => Marks.CreateElement(0, z.StudentId, z.Mark)))).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -2,15 +2,9 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using Serilog.Core;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.RepositoryImp
|
||||
{
|
||||
|
@ -1,10 +1,9 @@
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Dapper;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
namespace StudentProgressRecord.RepositoryImp
|
||||
{
|
||||
public class StudentTransitionRepository : IStudentTransitionRepository
|
||||
|
@ -3,7 +3,6 @@ using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.Entity.Enums;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
|
||||
|
@ -5,12 +5,6 @@ using Npgsql;
|
||||
using StudentProgressRecord.Entity;
|
||||
using StudentProgressRecord.IRepositories;
|
||||
using StudentProgressRecord.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StudentProgressRecord.RepositoryImp
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user