diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/AcademicProgressBusinessLogic.csproj b/DepartmentPortal/AcademicProgressBusinessLogic/AcademicProgressBusinessLogic.csproj
index 89056d5..dd6e700 100644
--- a/DepartmentPortal/AcademicProgressBusinessLogic/AcademicProgressBusinessLogic.csproj
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/AcademicProgressBusinessLogic.csproj
@@ -4,6 +4,10 @@
net5.0
+
+
+
+
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs
index 6292e7d..4df6b36 100644
--- a/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/BindingModels/ReportBindingModel.cs
@@ -15,5 +15,11 @@ namespace AcademicProgressBusinessLogic.BindingModels
/// Путь до папки, куда выгружать отчет
///
public string FolderName { get; set; }
+
+ ///
+ /// Id студента, для которого формируется отчет
+ ///
+
+ public Guid? StudentId { get; set; }
}
}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs
deleted file mode 100644
index 27d9f83..0000000
--- a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportBusinessLogic.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using AcademicProgressBusinessLogic.BindingModels;
-using AcademicProgressBusinessLogic.Interfaces;
-using DepartmentBusinessLogic.Interfaces;
-using ModuleTools.BusinessLogics;
-using ModuleTools.Enums;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcademicProgressBusinessLogic.BusinessLogics
-{
- ///
- /// Логика работы с отчетами
- ///
- public class ReportBusinessLogic : CoreBusinessLogic
- {
- ///
- /// Серивс для работы с отчетами
- ///
- private readonly IReportService _service;
-
- private readonly IStudentService _studentService;
-
-
- ///
- /// Логика работы с отчетом
- ///
- ///
- public ReportBusinessLogic(IReportService service, IStudentService _studentService)
- {
- this._studentService = _studentService;
- _service = service;
- _serviceOperation = AccessOperation.Отчет_успеваемость;
- _entity = "Отчеты для успеваемости";
- }
-
- public void SaveReportToWordFile(ReportBindingModel model)
- {
- /* SaveToWord.CreateDoc(new WordInfo
- {
- FileName = model.FolderName,
- Title = "Список заявок",
- RequestFlowers = GetRequestPlaces()
- });*/
- }
-
- }
-}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportLogic.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportLogic.cs
new file mode 100644
index 0000000..9eae2dd
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/ReportLogic.cs
@@ -0,0 +1,334 @@
+using AcademicProgressBusinessLogic.BindingModels;
+using AcademicProgressBusinessLogic.BusinessLogic;
+using AcademicProgressBusinessLogic.Enums;
+using AcademicProgressBusinessLogic.HelperModels;
+using AcademicProgressBusinessLogic.Interfaces;
+using AcademicProgressBusinessLogic.ViewModels;
+using DepartmentBusinessLogic.BindingModels;
+using DepartmentBusinessLogic.BusinessLogics;
+using DepartmentBusinessLogic.Interfaces;
+using ModuleTools.BusinessLogics;
+using ModuleTools.Enums;
+using ModuleTools.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.BusinessLogics
+{
+ ///
+ /// Логика работы с отчетами
+ ///
+ public class ReportLogic : CoreBusinessLogic
+ {
+ ///
+ /// Логика для работы со студентами
+ ///
+
+ private readonly StudentBusinessLogic _studentlogic;
+
+ ///
+ /// Логика для работы с успеваемостью студента
+ ///
+
+ private readonly StudentAcademicProgressBusinessLogic _studentAcademicProgresslogic;
+
+ ///
+ /// Логика для работы с дисциплинами
+ ///
+
+ private readonly DisciplineBusinessLogic _disciplinelogic;
+
+ private readonly AcademicPlanRecordBusinessLogic _academicPlanRecordlogic;
+ private readonly StudentGroupBusinessLogic _studentGrouplogic;
+ private readonly EducationDirectionBusinessLogic _educationDirectionlogic;
+ private readonly AcademicPlanBusinessLogic _academicPlanlogic;
+
+
+
+ ///
+ /// Логика работы с отчетом
+ ///
+ ///
+ public ReportLogic(AcademicPlanRecordBusinessLogic _academicPlanRecordlogic, EducationDirectionBusinessLogic _educationDirectionlogic, AcademicPlanBusinessLogic _academicPlanlogic,
+ StudentGroupBusinessLogic _studentGrouplogic, StudentBusinessLogic _studentlogic, StudentAcademicProgressBusinessLogic _studentAcademicProgressService, DisciplineBusinessLogic _disciplinelogic)
+ {
+ this._studentGrouplogic = _studentGrouplogic;
+ this._educationDirectionlogic = _educationDirectionlogic;
+ this._academicPlanlogic = _academicPlanlogic;
+ this._academicPlanRecordlogic = _academicPlanRecordlogic;
+ this._studentAcademicProgresslogic = _studentAcademicProgressService;
+ this._disciplinelogic = _disciplinelogic;
+ this._studentlogic = _studentlogic;
+ _serviceOperation = AccessOperation.Отчет_успеваемость;
+ _entity = "Отчеты для успеваемости";
+ }
+
+ public void SaveReportToWordFile(ReportBindingModel model)
+ {
+ SaveToWord.CreateDoc(new WordInfo
+ {
+ FileName = model.FolderName,
+ Title = "Приложение к диплому",
+ StudentScores = GetStudentScores(model.StudentId)
+ });
+ }
+
+ public void SaveReportToExcelFile(ReportBindingModel model)
+ {
+ SaveToExcel.CreateDoc(new ExcelInfo
+ {
+ FileName = model.FolderName,
+ Title = "Успеваемость",
+ StudentScores = GetStudentScoresForProgress(model.StudentId)
+ });
+
+ }
+ public List GetStudentScoresForProgress(Guid? studentId)
+ {
+ var academicProgress = _studentAcademicProgresslogic.GetList(new StudentAcademicProgressGetBindingModel());
+ var discipline = _disciplinelogic.GetList(new DisciplineGetBindingModel());
+ var academicPlanRecords = _academicPlanRecordlogic.GetList(new AcademicPlanRecordGetBindingModel());
+ var students = _studentlogic.GetList(new StudentGetBindingModel());
+ var educationDirections = _educationDirectionlogic.GetList(new EducationDirectionGetBindingModel());
+ var studentGroup = _studentGrouplogic.GetList(new StudentGroupGetBindingModel());
+ var academicPlans = _academicPlanlogic.GetList(new AcademicPlanGetBindingModel());
+
+ var list = new List();
+ double average = 0;
+ double count = 0;
+ string score = "";
+ foreach (var student in students.List.Where(rec => rec.Id == studentId))
+ {
+ foreach (var studGroup in studentGroup.List.Where(rec => rec.Id == student.StudentGroupId))
+ {
+ foreach (var educatDirection in educationDirections.List.Where(rec => rec.Id == studGroup.EducationDirectionId))
+ {
+ foreach (var academicPlan in academicPlans.List.Where(rec => rec.EducationDirectionId == educatDirection.Id))
+ {
+ foreach (var academicPlanRecord in academicPlanRecords.List.Where(rec => rec.AcademicPlanId == academicPlan.Id))
+ {
+
+ //является ли родителем
+ if (academicPlanRecord.IsParent)
+ {
+ bool hasScore = false;
+ //ищем всех детей
+ foreach (var academicPlanRecordChild in academicPlanRecords.List.Where(rec => rec.AcademicPlanRecordParentId == academicPlanRecord.Id))
+ {
+ //если есть оценки то заполняем
+ foreach (var studProgress in academicProgress.List.Where(rec => rec.StudentId == studentId && rec.DisciplineId == academicPlanRecordChild.DisciplineId && rec.Semester == academicPlanRecordChild.Semester))
+ {
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecordChild.DisciplineName,
+ Scores = studProgress.ExamScoresTitle,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Semester = (int)academicPlanRecordChild.Semester,
+ Zet = academicPlanRecordChild.Zet
+ };
+ list.Add(record);
+ hasScore = true;
+ }
+ }
+ //если оценок нет, то вставляем имя родителя
+ if (!hasScore)
+ {
+
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecord.DisciplineName,
+ Scores = " ",
+ Semester = (int)academicPlanRecord.Semester,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Zet = academicPlanRecord.Zet
+ };
+ list.Add(record);
+ }
+ }//если не имеет детей то записываем имя без оценки
+ else if (academicPlanRecord.IsChildValue == "Нет")
+ {
+
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecord.DisciplineName,
+ Scores = " ",
+ Semester = (int)academicPlanRecord.Semester,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Zet = academicPlanRecord.Zet
+ };
+ list.Add(record);
+ }
+ }
+ }
+ }
+ }
+ }
+ //поставили оценки из успеваемости студента в лист
+ foreach (var l in list)
+ {
+ foreach (var studProgress in academicProgress.List.Where(rec => rec.StudentId == studentId && l.DisciplineName == rec.DisciplineName && l.Semester == (int)rec.Semester))
+ {
+
+ switch (studProgress.Score)
+ {
+ case ExamScores.Отлично:
+ average += 5;
+ score = "5";
+ count++;
+
+ break;
+ case ExamScores.Хорошо:
+ average += 4;
+ score = "4";
+ count++;
+
+ break;
+ case ExamScores.Удовлетворительно:
+ average += 3;
+ score = "3";
+ count++;
+
+ break;
+ case ExamScores.Зачет:
+ score = "+";
+ break;
+ }
+
+ l.Scores = score;
+ }
+
+ l.Average = Math.Round(((average) / count) , 2);
+ }
+ return list;
+ }
+
+
+
+ public List GetStudentScores(Guid? studentId)
+ {
+ var academicProgress = _studentAcademicProgresslogic.GetList(new StudentAcademicProgressGetBindingModel());
+ var discipline = _disciplinelogic.GetList(new DisciplineGetBindingModel());
+ var academicPlanRecords = _academicPlanRecordlogic.GetList(new AcademicPlanRecordGetBindingModel());
+ var students = _studentlogic.GetList(new StudentGetBindingModel());
+ var educationDirections = _educationDirectionlogic.GetList(new EducationDirectionGetBindingModel());
+ var studentGroup = _studentGrouplogic.GetList(new StudentGroupGetBindingModel());
+ var academicPlans = _academicPlanlogic.GetList(new AcademicPlanGetBindingModel());
+ var list = new List();
+ //записываем имена дисциплин в лист
+ foreach (var student in students.List.Where(rec => rec.Id == studentId))
+ {
+ foreach (var studGroup in studentGroup.List.Where(rec => rec.Id == student.StudentGroupId))
+ {
+ foreach (var educatDirection in educationDirections.List.Where(rec => rec.Id == studGroup.EducationDirectionId))
+ {
+ foreach (var academicPlan in academicPlans.List.Where(rec => rec.EducationDirectionId == educatDirection.Id))
+ {
+ foreach (var academicPlanRecord in academicPlanRecords.List.Where(rec => rec.AcademicPlanId == academicPlan.Id).OrderBy(rec => rec.DisciplineName).ThenByDescending(rec => rec.SemesterTitle))
+ {
+
+ //является ли родителем
+ if (academicPlanRecord.IsParent)
+ {
+ bool hasScore = false;
+ //ищем всех детей
+ foreach (var academicPlanRecordChild in academicPlanRecords.List.Where(rec => rec.AcademicPlanRecordParentId == academicPlanRecord.Id))
+ {
+ //если есть оценки то заполняем
+ foreach (var studProgress in academicProgress.List.Where(rec => rec.StudentId == studentId && rec.DisciplineId == academicPlanRecordChild.DisciplineId && rec.Semester == academicPlanRecordChild.Semester))
+ {
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecordChild.DisciplineName,
+ Scores = studProgress.ExamScoresTitle,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Semester = (int)academicPlanRecordChild.Semester,
+ Zet = academicPlanRecordChild.Zet
+ };
+ list.Add(record);
+ hasScore = true;
+ }
+ }
+ //если оценок нет, то вставляем имя родителя
+ if (!hasScore)
+ {
+
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecord.DisciplineName,
+ Scores = " ",
+ Semester = (int)academicPlanRecord.Semester,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Zet = academicPlanRecord.Zet
+ };
+ list.Add(record);
+ }
+ }//если не имеет детей то записываем имя без оценки
+ else if (academicPlanRecord.IsChildValue == "Нет")
+ {
+
+ var record = new StudentScoresViewModel
+ {
+ DisciplineName = academicPlanRecord.DisciplineName,
+ Scores = " ",
+ Semester = (int)academicPlanRecord.Semester,
+ StudentLastName = student.LastName,
+ StudentFirstName = student.FirstName,
+ Zet = academicPlanRecord.Zet
+ };
+ list.Add(record);
+ }
+ }
+ }
+ }
+ }
+ }
+ var list2 = new List();
+ list2.Add(list[0]);
+ int z = 0;
+ //в новый лист заносим только по одной дисциплине и складываем з.ешки у одинаковых дисциплин
+ foreach (var l in list)
+ {
+ if (l.DisciplineName != list2[list2.Count - 1].DisciplineName)
+ {
+ list2.Add(l);
+ z += l.Zet;
+ }
+ else
+ {
+ list2[list2.Count - 1].Zet += l.Zet;
+ z += l.Zet;
+ }
+ }
+ //записываем оценки в лист из успевамости
+ foreach (var l in list2)
+ {
+ foreach (var studProgress in academicProgress.List.Where(rec => rec.StudentId == studentId))
+ {
+ if (l.DisciplineName == studProgress.DisciplineName && l.Semester == (int)studProgress.Semester && l.Scores != null)
+ {
+ l.Scores = studProgress.Score.ToString();
+ }
+ }
+ }
+ list.Clear();
+
+ foreach (var l in list2.OrderBy(rec => rec.Semester))
+ {
+ list.Add(l);
+ }
+
+ list[list.Count - 1].Average = z;
+
+ return list;
+
+ }
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToExcel.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToExcel.cs
new file mode 100644
index 0000000..7d6743b
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToExcel.cs
@@ -0,0 +1,425 @@
+using AcademicProgressBusinessLogic.HelperModels;
+using DocumentFormat.OpenXml;
+using DocumentFormat.OpenXml.Office2010.Excel;
+using DocumentFormat.OpenXml.Office2013.Excel;
+using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Spreadsheet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace AcademicProgressBusinessLogic.BusinessLogic
+{
+ public class SaveToExcel
+ {
+ public static void CreateDoc(ExcelInfo info)
+ {
+ using (SpreadsheetDocument spreadsheetDocument =
+ SpreadsheetDocument.Create(info.FileName+ "//" + info.Title + "5.xlsx", SpreadsheetDocumentType.Workbook))
+ {
+ // Создаем книгу (в ней хранятся листы)
+ WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
+ workbookpart.Workbook = new Workbook();
+ CreateStyles(workbookpart);
+ // Получаем/создаем хранилище текстов для книги
+ SharedStringTablePart shareStringPart =
+ spreadsheetDocument.WorkbookPart.GetPartsOfType().Count() > 0
+ ?
+ spreadsheetDocument.WorkbookPart.GetPartsOfType().First() : spreadsheetDocument.WorkbookPart.AddNewPart();
+ // Создаем SharedStringTable, если его нет
+ if (shareStringPart.SharedStringTable == null)
+ {
+ shareStringPart.SharedStringTable = new SharedStringTable();
+ }
+ // Создаем лист в книгу
+ WorksheetPart worksheetPart = workbookpart.AddNewPart();
+ worksheetPart.Worksheet = new Worksheet(new SheetData());
+ // Добавляем лист в книгу
+ Sheets sheets =
+ spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
+ Sheet sheet = new Sheet()
+ {
+ Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
+ SheetId = 1,
+ Name = "Лист"
+ };
+ sheets.Append(sheet);
+
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ Worksheet = worksheetPart.Worksheet,
+ ShareStringPart = shareStringPart,
+ ColumnName = "A",
+ RowIndex = 1,
+ Text = info.Title,
+ StyleIndex = 2U
+ });
+ uint rowIndex = 4;
+
+ if (info.StudentScores != null)
+ {
+ int indexList = 3;
+ foreach (var pc in info.StudentScores)
+ {
+
+ rowIndex = 4;
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ Worksheet = worksheetPart.Worksheet,
+ ShareStringPart = shareStringPart,
+ ColumnName = GetExcelColumnName(indexList),
+ RowIndex = rowIndex,
+ Text = pc.DisciplineName,
+ StyleIndex = 1U
+ });
+ rowIndex++;
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ Worksheet = worksheetPart.Worksheet,
+ ShareStringPart = shareStringPart,
+ ColumnName = GetExcelColumnName(indexList),
+ RowIndex = rowIndex,
+ Text = pc.Scores,
+ StyleIndex = 1U
+ });
+ indexList++;
+
+
+ }
+ indexList = 2;
+ rowIndex = 1;
+ /* InsertCellInWorksheet(new ExcelCellParameters
+ {
+ Worksheet = worksheetPart.Worksheet,
+ ShareStringPart = shareStringPart,
+ ColumnName = list[indexList],
+ RowIndex = rowIndex,
+ Text = "Cредний балл:",
+ StyleIndex = 0U
+ });
+ rowIndex++;
+ InsertCellInWorksheet(new ExcelCellParameters
+ {
+ Worksheet = worksheetPart.Worksheet,
+ ShareStringPart = shareStringPart,
+ ColumnName = list[indexList],
+ RowIndex = rowIndex,
+ Text = Convert.ToString((info.StudentScores[info.StudentScores.Count - 1].Average)),
+ StyleIndex = 0U
+ });*/
+ }
+
+ }
+ }
+ ///
+ /// Настройка стилей для файла
+ ///
+ ///
+ private static void CreateStyles(WorkbookPart workbookpart)
+ {
+ WorkbookStylesPart sp = workbookpart.AddNewPart();
+ sp.Stylesheet = new Stylesheet();
+ Fonts fonts = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true };
+ Font fontUsual = new Font();
+ fontUsual.Append(new FontSize() { Val = 12D });
+ fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Theme
+ = (UInt32Value)1U
+ });
+ fontUsual.Append(new FontName() { Val = "Times New Roman" });
+ fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
+ fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
+ Font fontTitle = new Font();
+ fontTitle.Append(new Bold());
+ fontTitle.Append(new FontSize() { Val = 14D });
+ fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Theme
+ = (UInt32Value)1U
+ });
+ fontTitle.Append(new FontName() { Val = "Times New Roman" });
+ fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
+ fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
+ fonts.Append(fontUsual);
+ fonts.Append(fontTitle);
+ Fills fills = new Fills() { Count = (UInt32Value)2U };
+ Fill fill1 = new Fill();
+ fill1.Append(new PatternFill() { PatternType = PatternValues.None });
+ Fill fill2 = new Fill();
+ fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
+ fills.Append(fill1);
+ fills.Append(fill2);
+ Borders borders = new Borders() { Count = (UInt32Value)2U };
+ Border borderNoBorder = new Border();
+ borderNoBorder.Append(new LeftBorder());
+ borderNoBorder.Append(new RightBorder());
+ borderNoBorder.Append(new TopBorder());
+ borderNoBorder.Append(new BottomBorder());
+ borderNoBorder.Append(new DiagonalBorder());
+ Border borderThin = new Border();
+ LeftBorder leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
+ leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Indexed = (UInt32Value)64U
+ });
+ RightBorder rightBorder = new RightBorder()
+ {
+ Style = BorderStyleValues.Thin
+ };
+ rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Indexed = (UInt32Value)64U
+ });
+ TopBorder topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
+ topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Indexed = (UInt32Value)64U
+ });
+ BottomBorder bottomBorder = new BottomBorder()
+ {
+ Style =
+ BorderStyleValues.Thin
+ };
+ bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
+ {
+ Indexed = (UInt32Value)64U
+ });
+ borderThin.Append(leftBorder);
+ borderThin.Append(rightBorder);
+ borderThin.Append(topBorder);
+ borderThin.Append(bottomBorder);
+ borderThin.Append(new DiagonalBorder());
+ borders.Append(borderNoBorder);
+ borders.Append(borderThin);
+ CellStyleFormats cellStyleFormats = new CellStyleFormats()
+ {
+ Count =
+ (UInt32Value)1U
+ };
+ CellFormat cellFormatStyle = new CellFormat()
+ {
+ NumberFormatId =
+ (UInt32Value)0U,
+ FontId = (UInt32Value)0U,
+ FillId = (UInt32Value)0U,
+ BorderId =
+ (UInt32Value)0U
+ };
+ cellStyleFormats.Append(cellFormatStyle);
+ CellFormats cellFormats = new CellFormats() { Count = (UInt32Value)3U };
+ CellFormat cellFormatFont = new CellFormat()
+ {
+ NumberFormatId =
+ (UInt32Value)0U,
+ FontId = (UInt32Value)0U,
+ FillId = (UInt32Value)0U,
+ BorderId =
+ (UInt32Value)0U,
+ FormatId = (UInt32Value)0U,
+ ApplyFont = true
+ };
+ CellFormat cellFormatFontAndBorder = new CellFormat()
+ {
+ NumberFormatId =
+ (UInt32Value)0U,
+ FontId = (UInt32Value)0U,
+ FillId = (UInt32Value)0U,
+ BorderId =
+ (UInt32Value)1U,
+ FormatId = (UInt32Value)0U,
+ ApplyFont = true,
+ ApplyBorder = true
+ };
+ CellFormat cellFormatTitle = new CellFormat()
+ {
+ NumberFormatId =
+ (UInt32Value)0U,
+ FontId = (UInt32Value)1U,
+ FillId = (UInt32Value)0U,
+ BorderId =
+ (UInt32Value)0U,
+ FormatId = (UInt32Value)0U,
+ Alignment = new Alignment()
+ {
+ Vertical =
+ VerticalAlignmentValues.Center,
+ WrapText = true,
+ Horizontal =
+ HorizontalAlignmentValues.Center
+ },
+ ApplyFont = true
+ };
+ cellFormats.Append(cellFormatFont);
+ cellFormats.Append(cellFormatFontAndBorder);
+ cellFormats.Append(cellFormatTitle);
+ CellStyles cellStyles = new CellStyles() { Count = (UInt32Value)1U };
+ cellStyles.Append(new CellStyle()
+ {
+ Name = "Normal",
+ FormatId =
+ (UInt32Value)0U,
+ BuiltinId = (UInt32Value)0U
+ });
+ DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats
+ differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
+ {
+ Count = (UInt32Value)0U
+ };
+
+ TableStyles tableStyles = new TableStyles()
+ {
+ Count = (UInt32Value)0U,
+ DefaultTableStyle = "TableStyleMedium2",
+ DefaultPivotStyle = "PivotStyleLight16"
+ };
+ StylesheetExtensionList stylesheetExtensionList = new
+ StylesheetExtensionList();
+ StylesheetExtension stylesheetExtension1 = new StylesheetExtension()
+ {
+ Uri =
+ "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
+ };
+ stylesheetExtension1.AddNamespaceDeclaration("x14",
+ "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
+ stylesheetExtension1.Append(new SlicerStyles()
+ {
+ DefaultSlicerStyle =
+ "SlicerStyleLight1"
+ });
+ StylesheetExtension stylesheetExtension2 = new StylesheetExtension()
+ {
+ Uri =
+ "{9260A510-F301-46a8-8635-F512D64BE5F5}"
+ };
+ stylesheetExtension2.AddNamespaceDeclaration("x15",
+ "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
+ stylesheetExtension2.Append(new TimelineStyles()
+ {
+ DefaultTimelineStyle =
+ "TimeSlicerStyleLight1"
+ });
+ stylesheetExtensionList.Append(stylesheetExtension1);
+ stylesheetExtensionList.Append(stylesheetExtension2);
+ sp.Stylesheet.Append(fonts);
+ sp.Stylesheet.Append(fills);
+ sp.Stylesheet.Append(borders);
+ sp.Stylesheet.Append(cellStyleFormats);
+ sp.Stylesheet.Append(cellFormats);
+ sp.Stylesheet.Append(cellStyles);
+ sp.Stylesheet.Append(differentialFormats);
+ sp.Stylesheet.Append(tableStyles);
+ sp.Stylesheet.Append(stylesheetExtensionList);
+ }
+
+ private static string GetExcelColumnName(int columnNumber)
+ {
+ string columnName = "";
+
+ while (columnNumber > 0)
+ {
+ int modulo = (columnNumber - 1) % 26;
+ columnName = Convert.ToChar('A' + modulo) + columnName;
+ columnNumber = (columnNumber - modulo) / 26;
+ }
+
+ return columnName;
+ }
+ ///
+ /// Добааляем новую ячейку в лист
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static void InsertCellInWorksheet(ExcelCellParameters cellParameters)
+ {
+ SheetData sheetData = cellParameters.Worksheet.GetFirstChild();
+ // Ищем строку, либо добавляем ее
+ Row row;
+ if (sheetData.Elements().Where(r => r.RowIndex ==
+ cellParameters.RowIndex).Count() != 0)
+ {
+ row = sheetData.Elements().Where(r => r.RowIndex ==
+ cellParameters.RowIndex).First();
+ }
+ else
+ {
+ row = new Row() { RowIndex = cellParameters.RowIndex };
+ sheetData.Append(row);
+ }
+ // Ищем нужную ячейку
+ Cell cell;
+ if (row.Elements().Where(c => c.CellReference.Value ==
+ cellParameters.CellReference).Count() > 0)
+ {
+ cell = row.Elements().Where(c => c.CellReference.Value ==
+ cellParameters.CellReference).First();
+ }
+ else
+ {
+ // Все ячейки должны быть последовательно друг за другом расположены
+ // нужно определить, после какой вставлять
+ Cell refCell = null;
+ foreach (Cell rowCell in row.Elements())
+ {
+ if (string.Compare(rowCell.CellReference.Value,
+ cellParameters.CellReference, true) > 0)
+ {
+ refCell = rowCell;
+ break;
+ }
+ }
+ Cell newCell = new Cell()
+ {
+ CellReference = cellParameters.CellReference
+ };
+ row.InsertBefore(newCell, refCell);
+ cell = newCell;
+ }
+ // вставляем новый текст
+ cellParameters.ShareStringPart.SharedStringTable.AppendChild(new
+ SharedStringItem(new Text(cellParameters.Text)));
+ cellParameters.ShareStringPart.SharedStringTable.Save();
+ cell.CellValue = new
+ CellValue((cellParameters.ShareStringPart.SharedStringTable.Elements().
+ Count() - 1).ToString());
+ cell.DataType = new EnumValue(CellValues.SharedString);
+ cell.StyleIndex = cellParameters.StyleIndex;
+ }
+ ///
+ /// Объединение ячеек
+ ///
+ ///
+ ///
+ ///
+ private static void MergeCells(ExcelMergeParameters mergeParameters)
+ {
+ MergeCells mergeCells;
+ if (mergeParameters.Worksheet.Elements().Count() > 0)
+ {
+ mergeCells = mergeParameters.Worksheet.Elements().First();
+ }
+ else
+ {
+ mergeCells = new MergeCells();
+ if (mergeParameters.Worksheet.Elements().Count() > 0)
+ {
+ mergeParameters.Worksheet.InsertAfter(mergeCells,
+ mergeParameters.Worksheet.Elements().First());
+ }
+ else
+ {
+ mergeParameters.Worksheet.InsertAfter(mergeCells,
+ mergeParameters.Worksheet.Elements().First());
+ }
+ }
+ MergeCell mergeCell = new MergeCell()
+ {
+ Reference = new StringValue(mergeParameters.Merge)
+ };
+ mergeCells.Append(mergeCell);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToWord.cs b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToWord.cs
new file mode 100644
index 0000000..a1ea252
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/BusinessLogic/SaveToWord.cs
@@ -0,0 +1,265 @@
+using AcademicProgressBusinessLogic.HelperModels;
+using DocumentFormat.OpenXml;
+using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Wordprocessing;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace AcademicProgressBusinessLogic.BusinessLogic
+{
+ public class SaveToWord
+ {
+ public static void CreateDoc(WordInfo info)
+ {
+ using (WordprocessingDocument wordDocument = WordprocessingDocument.Create(info.FileName + "//" + info.Title + ".docx", WordprocessingDocumentType.Document))
+ {
+ MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();
+ mainPart.Document = new Document();
+ Body docBody = mainPart.Document.AppendChild(new Body());
+
+ docBody.AppendChild(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { info.Title },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = true,
+ Size = "24",
+ JustificationValues = JustificationValues.Center
+ }
+ }));
+
+ if (info.StudentScores != null)
+ {
+ foreach (var rp in info.StudentScores)
+ {
+
+ docBody.AppendChild(CreateParagraph(new WordParagraph
+ {
+
+ Texts = new List { "Приложение к диплому студента - " + rp.StudentLastName + rp.StudentFirstName },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+
+ }));
+ break;
+
+ }
+ Table table = new Table();
+
+ TableProperties props = new TableProperties(
+ new TableBorders(
+ new TopBorder { Val = new EnumValue(BorderValues.Single), Size = 2 },
+ new BottomBorder { Val = new EnumValue(BorderValues.Single), Size = 2 },
+ new LeftBorder { Val = new EnumValue(BorderValues.Single), Size = 2 },
+ new RightBorder { Val = new EnumValue(BorderValues.Single), Size = 2 },
+ new InsideHorizontalBorder { Val = new EnumValue(BorderValues.Single), Size = 2 },
+ new InsideVerticalBorder { Val = new EnumValue(BorderValues.Single), Size = 2 }
+ ));
+
+ table.AppendChild(props);
+
+ var tr = new TableRow();
+ var tc_dis = new TableCell();
+ var tc_zet = new TableCell();
+ var tc_scor = new TableCell();
+
+ tc_dis.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { "Наименование дисциплин" },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+
+ tc_zet.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { "Количество з.е." },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+
+ tc_scor.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { "Итоговая оценка" },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+
+ tr.AppendChild(tc_dis);
+ tr.AppendChild(tc_zet);
+ tr.AppendChild(tc_scor);
+ table.AppendChild(tr);
+
+
+
+ foreach (var studScore in info.StudentScores)
+ {
+ tr = new TableRow();
+ tc_dis = new TableCell();
+ tc_zet = new TableCell();
+ tc_scor = new TableCell();
+
+ tc_dis.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { studScore.DisciplineName },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+ tc_zet.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { Convert.ToString(studScore.Zet) + " з.е." },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+ tc_scor.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { studScore.Scores },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+ tr.AppendChild(tc_dis);
+ tr.AppendChild(tc_zet);
+ tr.AppendChild(tc_scor);
+ table.AppendChild(tr);
+ }
+
+ var tr2 = new TableRow();
+ var tc_sr = new TableCell();
+ var tc_ss = new TableCell();
+ tc_sr.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { "Всего" },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+
+
+ tc_ss.Append(CreateParagraph(new WordParagraph
+ {
+ Texts = new List { Convert.ToString(info.StudentScores[info.StudentScores.Count - 1].Average) + " з.е." },
+ TextProperties = new WordParagraphProperties
+ {
+ Bold = false,
+ Size = "24",
+ JustificationValues = JustificationValues.Both
+ }
+ }));
+
+ tr2.AppendChild(tc_sr);
+ tr2.AppendChild(tc_ss);
+ table.AppendChild(tr2);
+
+ docBody.AppendChild(table);
+
+ }
+
+
+
+ docBody.AppendChild(CreateSectionProperties());
+ wordDocument.MainDocumentPart.Document.Save();
+ }
+ }
+
+ private static SectionProperties CreateSectionProperties()
+ {
+ SectionProperties properties = new SectionProperties();
+ PageSize pageSize = new PageSize { Orient = PageOrientationValues.Portrait };
+
+ properties.AppendChild(pageSize);
+
+ return properties;
+ }
+
+ private static Paragraph CreateParagraph(WordParagraph paragraph)
+ {
+ if (paragraph != null)
+ {
+ Paragraph docParagraph = new Paragraph();
+
+ docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
+
+ foreach (var run in paragraph.Texts)
+ {
+ Run docRun = new Run();
+ RunProperties properties = new RunProperties();
+ properties.AppendChild(new FontSize { Val = paragraph.TextProperties.Size });
+
+ if (!run.StartsWith(" - ") && paragraph.TextProperties.Bold)
+ {
+ properties.AppendChild(new Bold());
+ }
+
+ docRun.AppendChild(properties);
+ docRun.AppendChild(new Text { Text = run, Space = SpaceProcessingModeValues.Preserve });
+ docParagraph.AppendChild(docRun);
+ }
+
+ return docParagraph;
+ }
+
+ return null;
+ }
+
+ private static ParagraphProperties CreateParagraphProperties(WordParagraphProperties paragraphProperties)
+ {
+ if (paragraphProperties != null)
+ {
+ ParagraphProperties properties = new ParagraphProperties();
+
+ properties.AppendChild(new Justification() { Val = paragraphProperties.JustificationValues });
+ properties.AppendChild(new SpacingBetweenLines { LineRule = LineSpacingRuleValues.Auto });
+ properties.AppendChild(new Indentation());
+
+ ParagraphMarkRunProperties paragraphMarkRunProperties = new ParagraphMarkRunProperties();
+
+ if (!string.IsNullOrEmpty(paragraphProperties.Size))
+ {
+ paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size });
+ }
+
+ if (paragraphProperties.Bold)
+ {
+ paragraphMarkRunProperties.AppendChild(new Bold());
+ }
+
+ properties.AppendChild(paragraphMarkRunProperties);
+
+ return properties;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelCellParameters.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelCellParameters.cs
new file mode 100644
index 0000000..5476c9c
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelCellParameters.cs
@@ -0,0 +1,24 @@
+using DocumentFormat.OpenXml;
+using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Spreadsheet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ public class ExcelCellParameters
+ {
+ public Worksheet Worksheet { get; set; }
+ public string ColumnName { get; set; }
+ public uint RowIndex { get; set; }
+ public UInt32Value StyleIndex { get; set; }
+ public string Text { get; set; }
+ public SharedStringTablePart ShareStringPart { get; set; }
+ public string CellReference => $"{ColumnName}{RowIndex}";
+ public ExcelStyleInfoType StyleInfo { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelInfo.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelInfo.cs
new file mode 100644
index 0000000..3e66bc4
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelInfo.cs
@@ -0,0 +1,17 @@
+using AcademicProgressBusinessLogic.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ public class ExcelInfo
+ {
+ public string FileName { get; set; }
+
+ public string Title { get; set; }
+ public List StudentScores { get; set; }
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelMergeParameters.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelMergeParameters.cs
new file mode 100644
index 0000000..ce35136
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelMergeParameters.cs
@@ -0,0 +1,17 @@
+using DocumentFormat.OpenXml.Spreadsheet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ public class ExcelMergeParameters
+ {
+ public Worksheet Worksheet { get; set; }
+ public string CellFromName { get; set; }
+ public string CellToName { get; set; }
+ public string Merge => $"{CellFromName}:{CellToName}";
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelStyleInfoType.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelStyleInfoType.cs
new file mode 100644
index 0000000..c106921
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/ExcelStyleInfoType.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ public enum ExcelStyleInfoType
+ {
+ Title,
+ Text,
+ TextWithBroder
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordInfo.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordInfo.cs
new file mode 100644
index 0000000..97660f3
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordInfo.cs
@@ -0,0 +1,16 @@
+using AcademicProgressBusinessLogic.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ public class WordInfo
+ {
+ public string FileName { get; set; }
+ public string Title { get; set; }
+ public List StudentScores { get; set; }
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraph.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraph.cs
new file mode 100644
index 0000000..62e5b77
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraph.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ class WordParagraph
+ {
+ public List Texts { get; set; }
+ public WordParagraphProperties TextProperties { get; set; }
+
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraphProperties.cs b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraphProperties.cs
new file mode 100644
index 0000000..7b67a76
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/HelperModels/WordParagraphProperties.cs
@@ -0,0 +1,17 @@
+using DocumentFormat.OpenXml.Wordprocessing;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace AcademicProgressBusinessLogic.HelperModels
+{
+ class WordParagraphProperties
+ {
+ public string Size { get; set; }
+
+ public bool Bold { get; set; }
+
+ public JustificationValues JustificationValues { get; set; }
+
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentAcademicProgressViewModels.cs b/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentAcademicProgressViewModels.cs
index fc4c3f9..5379b86 100644
--- a/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentAcademicProgressViewModels.cs
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentAcademicProgressViewModels.cs
@@ -26,15 +26,14 @@ namespace AcademicProgressBusinessLogic.ViewModels
[ViewModelControlElementProperty("Студент", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
-
- [ViewModelControlListProperty("Имя", ColumnWidth = 200)]
- [MapConfiguration("Student.FirstName", IsDifficle = true)]
- public string FirstName { get; set; }
[ViewModelControlListProperty("Фамилия", ColumnWidth = 250)]
[MapConfiguration("Student.LastName", IsDifficle = true)]
public string LastName { get; set; }
-
+
+ [ViewModelControlListProperty("Имя", ColumnWidth = 200)]
+ [MapConfiguration("Student.FirstName", IsDifficle = true)]
+ public string FirstName { get; set; }
[ViewModelControlElementProperty("Дисциплина", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineList, DepartmentWindowsDesktop")]
[MapConfiguration("DisciplineId")]
diff --git a/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentScoresViewModel.cs b/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentScoresViewModel.cs
new file mode 100644
index 0000000..15befce
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressBusinessLogic/ViewModels/StudentScoresViewModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressBusinessLogic.ViewModels
+{
+ public class StudentScoresViewModel
+ {
+ public string StudentLastName { get; set; }
+ public string StudentFirstName { get; set; }
+ public string DisciplineName { get; set; }
+ public string Scores { get; set; }
+ public int Zet { get; set; }
+ public double Average { get; set; }
+ public int Semester { get; set; }
+
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs b/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs
index eb30b2e..df5c9f8 100644
--- a/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs
+++ b/DepartmentPortal/AcademicProgressDatabaseImplementation/AcademicProgressImplementationExtensions.cs
@@ -1,4 +1,6 @@
-using AcademicProgressBusinessLogic.Interfaces;
+using AcademicProgressBusinessLogic.BusinessLogic;
+using AcademicProgressBusinessLogic.BusinessLogics;
+using AcademicProgressBusinessLogic.Interfaces;
using AcademicProgressDatabaseImplementation.Implementations;
using ModuleTools.BusinessLogics;
using ModuleTools.Interfaces;
@@ -11,6 +13,8 @@ namespace AcademicProgressDatabaseImplementation
public void RegisterServices()
{
DependencyManager.Instance.RegisterType();
+ DependencyManager.Instance.RegisterType();
+
}
}
diff --git a/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/ReportService.cs b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/ReportService.cs
new file mode 100644
index 0000000..1bd1c8e
--- /dev/null
+++ b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/ReportService.cs
@@ -0,0 +1,19 @@
+using AcademicProgressBusinessLogic.BindingModels;
+using AcademicProgressBusinessLogic.Interfaces;
+using ModuleTools.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AcademicProgressDatabaseImplementation.Implementations
+{
+ public class ReportService : IReportService
+ {
+ public OperationResultModel SaveReportToWordFile(ReportBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs
index c8da872..cf76310 100644
--- a/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs
+++ b/DepartmentPortal/AcademicProgressDatabaseImplementation/Implementations/StudentAcademicProgressService.cs
@@ -41,11 +41,12 @@ namespace AcademicProgressDatabaseImplementation.Implementations
protected override void AdditionalDeleting(DbContext context, StudentAcademicProgress entity, StudentAcademicProgressGetBindingModel model) { }
- protected override StudentAcademicProgress GetUniqueEntity(StudentAcademicProgressSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.StudentId == model.StudentId && x.Id != model.Id);
+ protected override StudentAcademicProgress GetUniqueEntity(StudentAcademicProgressSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.StudentId == model.StudentId && x.DisciplineId == model.DisciplineId && x.Semester == (int)model.Semester && x.Id != model.Id);
protected override IQueryable IncludingWhenReading(IQueryable query) => query.Include(x => x.Student).Include(x => x.Discipline);
protected override IQueryable OrderingWhenReading(IQueryable query) => query.OrderBy(x => x.Student.LastName).ThenBy(x => x.Student.FirstName);
+
}
}
diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/AcademicProgressWindowsDesktop.csproj b/DepartmentPortal/AcademicProgressWindowsDesktop/AcademicProgressWindowsDesktop.csproj
index 4cc48ec..adf8265 100644
--- a/DepartmentPortal/AcademicProgressWindowsDesktop/AcademicProgressWindowsDesktop.csproj
+++ b/DepartmentPortal/AcademicProgressWindowsDesktop/AcademicProgressWindowsDesktop.csproj
@@ -5,6 +5,10 @@
true
+
+
+
+
diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/EntityControls/StudentAcademicProgress/ControlStudentAcademicProgressList.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/EntityControls/StudentAcademicProgress/ControlStudentAcademicProgressList.cs
index 24e0011..3691c3b 100644
--- a/DepartmentPortal/AcademicProgressWindowsDesktop/EntityControls/StudentAcademicProgress/ControlStudentAcademicProgressList.cs
+++ b/DepartmentPortal/AcademicProgressWindowsDesktop/EntityControls/StudentAcademicProgress/ControlStudentAcademicProgressList.cs
@@ -8,6 +8,7 @@ using DesktopTools.Models;
using System;
using System.Collections.Generic;
using DesktopTools.Enums;
+using System.Windows.Forms;
namespace AcademicProgressWindowsDesktop.EntityControls.StudentAcademicProgress
{
@@ -44,7 +45,7 @@ namespace AcademicProgressWindowsDesktop.EntityControls.StudentAcademicProgress
private void LoadScore()
{
- //загрузка оценок
+ MessageBox.Show("Оценки успешно выгружены!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.Designer.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.Designer.cs
index e849c9b..5ead159 100644
--- a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.Designer.cs
+++ b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.Designer.cs
@@ -117,6 +117,7 @@ namespace AcademicProgressWindowsDesktop.SpecialControls
this.buttonSaveSelectFolder.TabIndex = 16;
this.buttonSaveSelectFolder.Text = "Выбрать папку";
this.buttonSaveSelectFolder.UseVisualStyleBackColor = true;
+ this.buttonSaveSelectFolder.Click += new System.EventHandler(this.buttonSaveSelectFolder_Click_1);
//
// ControlReportAcademicProgress
//
diff --git a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs
index ceda2f5..6c7fd11 100644
--- a/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs
+++ b/DepartmentPortal/AcademicProgressWindowsDesktop/SpecialControls/ControlReportAcademicProgress.cs
@@ -1,26 +1,17 @@
-using AcademicProgressBusinessLogic.BusinessLogics;
-using DepartmentBusinessLogic.BindingModels;
-using DepartmentBusinessLogic.BusinessLogics;
-using DepartmentBusinessLogic.Interfaces;
+using AcademicProgressBusinessLogic.BindingModels;
+using AcademicProgressBusinessLogic.BusinessLogics;
using DepartmentWindowsDesktop.EntityControls;
using DesktopTools.BaseControls;
+using DesktopTools.Helpers;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
-using SecurityBusinessLogic.BindingModels;
-using SecurityBusinessLogic.BusinessLogics;
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;
+
namespace AcademicProgressWindowsDesktop.SpecialControls
{
///
@@ -31,7 +22,7 @@ namespace AcademicProgressWindowsDesktop.SpecialControls
///
/// Класс с бизнес-логикой работы с отчетом
///
- private readonly ReportBusinessLogic _reportLogic;
+ private readonly ReportLogic _reportLogic;
///
@@ -40,13 +31,19 @@ namespace AcademicProgressWindowsDesktop.SpecialControls
///
private event Action CloseEvent;
+ ///
+ /// Событие получения значения из контрола
+ ///
+ private event Action | | |