Compare commits

..

21 Commits
myprov ... main

Author SHA1 Message Date
00ac607d43 Изменил(а) на 'README.md' 2023-04-09 03:12:38 +04:00
2ecbb0471b Merge pull request 'provider' (#6) from provider into main
Reviewed-on: http://student.git.athene.tech/ker73rus/PIbd-21_Pyatakov_KM_Markov_DP_University/pulls/6
2023-04-09 03:11:26 +04:00
0d808aa2be fix 2023-04-09 03:08:30 +04:00
bc79eaad4c Report 2023-04-09 03:05:40 +04:00
f71b37f7e4 merge 2023-04-09 00:50:37 +04:00
9f23e79186 в процессе 2023-04-09 00:48:03 +04:00
4e40807313 fix 2023-04-09 00:00:42 +04:00
c56480c354 fix 2023-04-08 23:59:00 +04:00
99b3c179e7 fix + пару страничек (нужно добавить объединение моделей) 2023-04-08 23:37:54 +04:00
12beca7bf0 fix + _Layout 2023-04-08 22:40:05 +04:00
f855a03cba need report 2023-04-08 22:25:55 +04:00
c9df0ceb82 ReportLogic - Поставщик 2023-04-08 20:16:42 +04:00
e5b2dcdab6 fix 2023-04-08 14:02:34 +04:00
8caeebb8d3 Merge pull request 'entity customer added' (#4) from custom into provider
Reviewed-on: http://student.git.athene.tech/ker73rus/PIbd-21_Pyatakov_KM_Markov_DP_University/pulls/4
2023-04-08 14:00:57 +04:00
01d2821a87 entity added 2023-04-08 13:59:34 +04:00
9bf66b97c4 fix 2023-04-07 19:38:26 +04:00
2bd66c7925 Роль и Юзер вроде есть 2023-04-07 19:35:39 +04:00
3d3a8a17bb Merge pull request 'useradd' (#3) from myprov into provider
Reviewed-on: http://student.git.athene.tech/ker73rus/PIbd-21_Pyatakov_KM_Markov_DP_University/pulls/3
2023-04-07 19:32:18 +04:00
7d9eedb01b Добавил роль 2023-04-07 19:09:06 +04:00
a4f4da657e Merge branch 'main' of http://student.git.athene.tech/ker73rus/PIbd-21_Pyatakov_KM_Markov_DP_University 2023-03-31 16:28:15 +04:00
799aa3c52a vs change 2023-03-31 16:28:11 +04:00
144 changed files with 76370 additions and 69 deletions

View File

@ -1,2 +1 @@
# PIbd-21_Pyatakov_Km_Markov_DP_University
Курсовая работа по дисциплине "Разработка профессиональных приложений". Группа: ПИбд-21. Студенты: Пятаков К.М. и Марков Д.П.

View File

@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityCustomer", "UniversityCustomer\UniversityCustomer.csproj", "{1360F158-7807-49AD-94A2-4E2ACB2A941E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{78686252-0C90-4D1C-ADC6-8CFCCB84C393}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityModels", "UniversityModels\UniversityModels.csproj", "{597412F7-884C-49CB-AC41-36308551D330}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityDataBaseImplemet", "UniversityDataBaseImplemet\UniversityDataBaseImplemet.csproj", "{F8532F5E-942B-428E-8A10-280E905B8185}"
@ -15,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityContracts", "Univ
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityBusinessLogic", "UniversityBusinessLogic\UniversityBusinessLogic.csproj", "{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{3EC7CE2C-9D59-4570-B66B-746076D00A03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -25,10 +25,6 @@ Global
{1360F158-7807-49AD-94A2-4E2ACB2A941E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1360F158-7807-49AD-94A2-4E2ACB2A941E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1360F158-7807-49AD-94A2-4E2ACB2A941E}.Release|Any CPU.Build.0 = Release|Any CPU
{78686252-0C90-4D1C-ADC6-8CFCCB84C393}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78686252-0C90-4D1C-ADC6-8CFCCB84C393}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78686252-0C90-4D1C-ADC6-8CFCCB84C393}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78686252-0C90-4D1C-ADC6-8CFCCB84C393}.Release|Any CPU.Build.0 = Release|Any CPU
{597412F7-884C-49CB-AC41-36308551D330}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{597412F7-884C-49CB-AC41-36308551D330}.Debug|Any CPU.Build.0 = Debug|Any CPU
{597412F7-884C-49CB-AC41-36308551D330}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -45,6 +41,10 @@ Global
{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}.Release|Any CPU.Build.0 = Release|Any CPU
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
namespace UniversityBusinessLogic.BusinessLogics
{
public class DisciplineLogic : IDisciplineLogic
{
private readonly IDisciplineStorage _disciplineStorage;
public DisciplineLogic(IDisciplineStorage disciplineStorage)
{
_disciplineStorage = disciplineStorage;
}
public bool Create(DisciplineBindingModel model)
{
CheckModel(model);
if (_disciplineStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Delete(DisciplineBindingModel model)
{
CheckModel(model, false);
if (_disciplineStorage.Delete(model) == null)
{
return false;
}
return true;
}
public DisciplineViewModel? ReadElement(DisciplineSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var discipline = _disciplineStorage.GetElement(model);
if (discipline == null)
{
return null;
}
return discipline;
}
public List<DisciplineViewModel>? ReadList(DisciplineSearchModel? model)
{
var list = model == null ? _disciplineStorage.GetFullList() : _disciplineStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
public bool Update(DisciplineBindingModel model)
{
CheckModel(model, false);
if (_disciplineStorage.Update(model) == null)
{
return false;
}
return true;
}
private void CheckModel(DisciplineBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет Имени", nameof(model.Name));
}
var discipline = _disciplineStorage.GetElement(new DisciplineSearchModel { Name = model.Name });
if (discipline != null)
{
throw new InvalidOperationException("Дисциплина с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
namespace UniversityBusinessLogic.BusinessLogics
{
public class EducationGroupLogic
{
private readonly IEducationGroupStorage _egStorage;
public EducationGroupLogic(IEducationGroupStorage cardStorage)
{
_egStorage = cardStorage;
}
public bool Create(EducationGroupBindingModel model)
{
CheckModel(model);
if (_egStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Update(EducationGroupBindingModel model)
{
CheckModel(model);
if (_egStorage.Update(model) == null)
{
return false;
}
return true;
}
public bool Delete(EducationGroupBindingModel model)
{
CheckModel(model, false);
if (_egStorage.Delete(model) == null)
{
return false;
}
return true;
}
public EducationGroupViewModel? ReadElement(EducationGroupSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var es = _egStorage.GetElement(model);
if (es == null)
{
return null;
}
return es;
}
public List<EducationGroupViewModel>? ReadList(EducationGroupSearchModel? model)
{
var list = model == null ? _egStorage.GetFullList() : _egStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
private void CheckModel(EducationGroupBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия статуса обучения", nameof(model.Name));
}
var es = _egStorage.GetElement(new EducationGroupSearchModel
{
Name = model.Name,
});
if (es != null && es.Id != model.Id)
{
throw new InvalidOperationException("Статус с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.ViewModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityBusinessLogic.OfficePackage;
using System.Reflection;
using System.Net;
using System.Reflection.Metadata;
namespace UniversityBusinessLogic.BusinessLogics
{
public class ReportCustomerLogic : IReportCustomerLogic
{
private readonly IDocumentStorage _documentStorage;
private readonly IStudentStorage _studentStorage;
private readonly IEducationStatusStorage _educationStatusStorage;
private readonly IEducationGroupStorage _educationGroupStorage;
private readonly IDisciplineStorage _disciplineStorage;
private readonly IStreamStorage _streamStorage;
private readonly AbstractSaveToExcelProvider _saveToExcel;
private readonly AbstractSaveToWordProvider _saveToWord;
private readonly AbstractSaveToPdfProvider _saveToPdf;
public ReportCustomerLogic(IDocumentStorage documentStorage,
IStudentStorage studentStorage,
IEducationStatusStorage educationStatusStorage,
IEducationGroupStorage educationGroupStorage,
IDisciplineStorage disciplineStorage,
IStreamStorage streamStorage,
AbstractSaveToExcelProvider saveToExcel,
AbstractSaveToWordProvider saveToWord,
AbstractSaveToPdfProvider saveToPdf)
{
_documentStorage = documentStorage;
_studentStorage = studentStorage;
_educationStatusStorage = educationStatusStorage;
_educationGroupStorage = educationGroupStorage;
_disciplineStorage = disciplineStorage;
_streamStorage = streamStorage;
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
}
public List<ReportDisciplineViewModel> GetDiscipline(ReportBindingModel model)
{
var result = _streamStorage.GetFilteredList(new StreamSearchModel { Id = _disciplineStorage.GetElement(new DisciplineSearchModel { Name = model.DisciplineName })?.StreamId })
.Select(stream => new ReportDisciplineViewModel
{
DisciplineName = model.DisciplineName,
StudentEdStatus = stream.StudentStream
.Where(student => _documentStorage.GetFilteredList(new DocumentSearchModel
{
UserId = model.UserId,
DateFrom = model.DateFrom,
DateTo = model.DateTo,
})
.Any(document => document.StudentDocument.ContainsKey(student.Value.Id)))//Выбираем студентов, которые есть в приказах за выбранный промежуток времени
.Join(_documentStorage.GetFullList(),
t1 => t1.Value.Id,
t2 => t2.UserId,
(t1, t2) => new { student = t1, document = t2 })
.Select(res => (
StudentFIO: $"{res.student.Value.Name} {res.student.Value.Surname}",
Document: $"{res.document.Date}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = res.student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList()
})
.ToList();
return result;
}
public List<ReportStreamEducationStatusViewModel> StreamEducationStatus(List<StreamViewModel> streams)
{
var result = streams
.Select(stream => new ReportStreamEducationStatusViewModel
{
StreamName = stream.Name,
StudentEdStatus = stream.StudentStream
.Select(student => (
StudentFIO: $"{student.Value.Name} {student.Value.Surname}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList()
})
.ToList();
return result;
}
public void SaveBlanksToWordFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
public void SaveDocumentBlankToExcelFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -8,35 +8,101 @@ using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.ViewModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityBusinessLogic.OfficePackage;
namespace UniversityBusinessLogic.BusinessLogics
{
public class ReportProviderLogic : IReportProviderLogic
{
private readonly IDocumentStorage _documentStorage;
private readonly IStudentStorage _studentStorage;
private readonly IEducationStatusStorage _educationStatusStorage;
private readonly IEducationGroupStorage _educationGroupStorage;
private readonly IDisciplineStorage _disciplineStorage;
private readonly IStreamStorage _streamStorage;
private readonly AbstractSaveToExcelProvider _saveToExcel;
private readonly AbstractSaveToWordProvider _saveToWord;
private readonly AbstractSaveToPdfProvider _saveToPdf;
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline()
public ReportProviderLogic(IDocumentStorage documentStorage,
IStudentStorage studentStorage,
IEducationStatusStorage educationStatusStorage,
IEducationGroupStorage educationGroupStorage,
IDisciplineStorage disciplineStorage,
IStreamStorage streamStorage,
AbstractSaveToExcelProvider saveToExcel,
AbstractSaveToWordProvider saveToWord,
AbstractSaveToPdfProvider saveToPdf)
{
throw new NotImplementedException();
_documentStorage = documentStorage;
_studentStorage = studentStorage;
_educationStatusStorage = educationStatusStorage;
_educationGroupStorage = educationGroupStorage;
_disciplineStorage = disciplineStorage;
_streamStorage = streamStorage;
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
}
public List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(List<StudentViewModel> students)
{
var result = students
.Select(student => new ReportStudentsDisciplineViewModel
{
StudentFIO = $"{student.Name} {student.Surname}",
Disciplines = _streamStorage.GetFullList()
.Where(stream => stream.StudentStream.ContainsKey(student.Id))
.Join(_disciplineStorage.GetFullList(),
stream => stream.Id,
discipline => discipline.StreamId,
(stream, discipline) => discipline.Name)
.ToList()
})
.ToList();
return result;
}
public List<ReportStreamStudentEdStatPeriodViewModel> StreamStudentEdStatPeriod(ReportBindingModel model)
{
var result = _streamStorage
.GetFilteredList(new StreamSearchModel { UserId = model.UserId })
.Select(stream => new ReportStreamStudentEdStatPeriodViewModel
{
StreamName = stream.Name,
StudentEdStatus = stream.StudentStream
.Where(student => _documentStorage.GetFilteredList(new DocumentSearchModel
{
UserId = model.UserId,
DateFrom = model.DateFrom,
DateTo = model.DateTo,
})
.Any(document => document.StudentDocument.ContainsKey(student.Value.Id)))//Выбираем студентов, которые есть в приказах за выбранный промежуток времени
.Select(student => (
StudentFIO: $"{student.Value.Name} {student.Value.Surname}",
EdStatus: _educationStatusStorage.GetElement(new EducationStatusSearchModel { Id = student.Value.EducationStatusId })?.Name ?? "не удалось получить"))
.ToList()
})
.ToList();
return result;
}
public void SaveBlanksToWordFile(ReportBindingModel model)
{
throw new NotImplementedException();
//TODO
}
public void SaveDocumentBlankToExcelFile(ReportBindingModel model)
{
throw new NotImplementedException();
//TODO
}
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
throw new NotImplementedException();
//TODO
}
}
}

View File

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
namespace UniversityBusinessLogic.BusinessLogics
{
public class RoleLogic : IRoleLogic
{
private readonly IRoleStorage _roleStorage;
public RoleLogic(IRoleStorage roleStorage)
{
_roleStorage = roleStorage;
}
public bool Create(RoleBindingModel model)
{
CheckModel(model);
if (_roleStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Delete(RoleBindingModel model)
{
CheckModel(model, false);
if (_roleStorage.Delete(model) == null)
{
return false;
}
return true;
}
public RoleViewModel? ReadElement(RoleSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var element = _roleStorage.GetElement(model);
if (element == null)
{
return null;
}
return element;
}
public List<RoleViewModel>? ReadList(RoleSearchModel? model)
{
var list = model == null ? _roleStorage.GetFullList() : _roleStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
public bool Update(RoleBindingModel model)
{
CheckModel(model);
if (_roleStorage.Update(model) == null)
{
return false;
}
return true;
}
private void CheckModel(RoleBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия роли", nameof(model.Name));
}
var element = _roleStorage.GetElement(new RoleSearchModel
{
Name = model.Name
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Роль с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
namespace UniversityBusinessLogic.BusinessLogics
{
public class StreamLogic : IStreamLogic
{
private readonly IStreamStorage _streamStorage;
public StreamLogic(IStreamStorage streamStorage)
{
_streamStorage = streamStorage;
}
public bool Create(StreamBindingModel model)
{
CheckModel(model);
if (_streamStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Update(StreamBindingModel model)
{
CheckModel(model, false);
if (_streamStorage.Update(model) == null)
{
return false;
}
return true;
}
public bool Delete(StreamBindingModel model)
{
CheckModel(model, false);
if (_streamStorage.Delete(model) == null)
{
return false;
}
return true;
}
public StreamViewModel? ReadElement(StreamSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var stream = _streamStorage.GetElement(model);
if (stream == null)
{
return null;
}
return stream;
}
public List<StreamViewModel>? ReadList(StreamSearchModel? model)
{
var list = model == null ? _streamStorage.GetFullList() : _streamStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
private void CheckModel(StreamBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия потока", nameof(model.Name));
}
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.BindingModels
{
public class DisciplineBindingModel: IDisciplineModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public int Hours { get; set; }
public bool MarkType { get; set; }
public int StreamId { get; set; }
public int UserId { get; set; }
}
}

View File

@ -13,5 +13,6 @@ namespace UniversityContracts.BindingModels
public string Name { get; set; } = string.Empty;
public DateTime Date { get; set; } = DateTime.Now;
public int UserId { get; set; }
public Dictionary<int, IStudentModel> StudentDocument { get; set; } = new();
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.BindingModels
{
public class EducationGroupBindingModel : IEducationGroupModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public int UserId { get; set; }
public int NumberOfStudent { get; set; }
}
}

View File

@ -9,7 +9,9 @@ namespace UniversityContracts.BindingModels
public class ReportBindingModel
{
public string FileName { get; set; } = string.Empty;
public string DisciplineName { get; set; } = string.Empty;
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int? UserId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.BindingModels
{
public class RoleBindingModel : IRoleModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.BindingModels
{
public class StreamBindingModel : IStreamModel
{
public string Name { get; set; } = string.Empty;
public int Course { get; set; }
public int UserId { get; set; }
public int Id { get; set; }
public Dictionary<int, IStudentModel> StudentStream { get; set; } = new();
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IDisciplineLogic
{
bool Create(DisciplineBindingModel model);
bool Update(DisciplineBindingModel model);
bool Delete(DisciplineBindingModel model);
List<DisciplineViewModel>? ReadList(DisciplineSearchModel? model);
DisciplineViewModel? ReadElement(DisciplineSearchModel model);
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IEducationGroupLogic
{
bool Create(EducationGroupBindingModel model);
bool Update(EducationGroupBindingModel model);
bool Delete(EducationGroupBindingModel model);
List<EducationGroupViewModel>? ReadList(EducationGroupSearchModel? model);
EducationGroupViewModel? ReadElement(EducationGroupSearchModel model);
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IReportCustomerLogic
{
List<ReportDisciplineViewModel> GetDiscipline(ReportBindingModel model);
List<ReportStreamEducationStatusViewModel> StreamEducationStatus(List<StreamViewModel> streams);
void SaveBlanksToWordFile(ReportBindingModel model);
void SaveDocumentBlankToExcelFile(ReportBindingModel model);
void SaveOrdersToPdfFile(ReportBindingModel model);
}
}

View File

@ -10,7 +10,7 @@ namespace UniversityContracts.BusinessLogicContracts
{
public interface IReportProviderLogic
{
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline();
List<ReportStudentsDisciplineViewModel> GetStudentsDiscipline(List<StudentViewModel> students);
List<ReportStreamStudentEdStatPeriodViewModel> StreamStudentEdStatPeriod(ReportBindingModel model);

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IRoleLogic
{
List<RoleViewModel>? ReadList(RoleSearchModel? model);
RoleViewModel? ReadElement(RoleSearchModel model);
bool Create(RoleBindingModel model);
bool Update(RoleBindingModel model);
bool Delete(RoleBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.BusinessLogicContracts
{
public interface IStreamLogic
{
bool Create(StreamBindingModel model);
bool Update(StreamBindingModel model);
bool Delete(StreamBindingModel model);
List<StreamViewModel>? ReadList(StreamSearchModel? model);
StreamViewModel? ReadElement(StreamSearchModel model);
}
}

View File

@ -0,0 +1,12 @@
{
"profiles": {
"UniversityContracts": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:49347;http://localhost:49350"
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.SearchModels
{
public class DisciplineSearchModel
{
public int? Id { get; set; }
public string Name { get; set; } = string.Empty;
public int? StreamId { get; set; }
public int? UserId { get; set; }
}
}

View File

@ -11,5 +11,7 @@ namespace UniversityContracts.SearchModels
public int? Id { get; set; }
public string? Name { get; set; }
public int? UserId { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.SearchModels
{
public class EducationGroupSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? UserId { get; set; }
public int? NumberOfStudents { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.SearchModels
{
public class RoleSearchModel
{
public string? Name { get; set; }
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.SearchModels
{
public class StreamSearchModel
{
public int? Id { get; set; }
public int? UserId { get; set; }
public string? Name { get; set; }
public int? Course { get; set; }
}
}

View File

@ -13,5 +13,6 @@ namespace UniversityContracts.SearchModels
public int? UserId { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public bool? Disciplines { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.StoragesContracts
{
public interface IDisciplineStorage
{
List<DisciplineViewModel> GetFullList();
List<DisciplineViewModel> GetFilteredList(DisciplineSearchModel model);
DisciplineViewModel? GetElement(DisciplineSearchModel model);
DisciplineViewModel? Insert(DisciplineBindingModel model);
DisciplineViewModel? Update(DisciplineBindingModel model);
DisciplineViewModel? Delete(DisciplineBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.StoragesContracts
{
public interface IEducationGroupStorage
{
List<EducationGroupViewModel> GetFullList();
List<EducationGroupViewModel> GetFilteredList(EducationGroupSearchModel model);
EducationGroupViewModel? GetElement(EducationGroupSearchModel model);
EducationGroupViewModel? Insert(EducationGroupBindingModel model);
EducationGroupViewModel? Update(EducationGroupBindingModel model);
EducationGroupViewModel? Delete(EducationGroupBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.StoragesContracts
{
public interface IRoleStorage
{
List<RoleViewModel> GetFullList();
List<RoleViewModel> GetFilteredList(RoleSearchModel model);
RoleViewModel? GetElement(RoleSearchModel model);
RoleViewModel? Insert(RoleBindingModel model);
RoleViewModel? Update(RoleBindingModel model);
RoleViewModel? Delete(RoleBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
namespace UniversityContracts.StoragesContracts
{
public interface IStreamStorage
{
List<StreamViewModel> GetFullList();
List<StreamViewModel> GetFilteredList(StreamSearchModel model);
StreamViewModel? GetElement(StreamSearchModel model);
StreamViewModel? Insert(StreamBindingModel model);
StreamViewModel? Update(StreamBindingModel model);
StreamViewModel? Delete(StreamBindingModel model);
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.ViewModels
{
public class DisciplineViewModel
{
public int Id { get; set; }
public int UserId { get; set; }
public int StreamId { get; set; }
[DisplayName("Название дисциплины")]
public string Name { get; set; } = string.Empty;
[DisplayName("Количество часов")]
public int Hours { get; set; } = 0;
[DisplayName("Тип оценки")]
public bool MarkType { get; set; }
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
@ -16,5 +17,6 @@ namespace UniversityContracts.ViewModels
public string Name { get; set; } = string.Empty;
[DisplayName("Дата создания документа")]
public DateTime Date { get; set; } = DateTime.Now;
public Dictionary<int, IStudentModel> StudentDocument { get; set; } = new();
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.ViewModels
{
public class EducationGroupViewModel
{
public int Id { get; set; }
[DisplayName("Название группы")]
public string Name { get; set; } = string.Empty;
[DisplayName("Количество студентов в группе")]
public int NumberOfStudents { get; set; }
public int UserId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.ViewModels
{
public class ReportDisciplineViewModel
{
public string DisciplineName { get; set; } = string.Empty;
public List<(string StudentFIO, string DocumentDate, string EdStatus)> StudentEdStatus { get; set; } = new();
//выбираем дисциплину, выбираем период, отображаются студенты зачисленные через приказ в этот период со статусами обучения
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityContracts.ViewModels
{
public class ReportStreamEducationStatusViewModel
{
public string StreamName { get; set; } = string.Empty;
public List<(string StudentFIO, string EdStatus)> StudentEdStatus { get; set; } = new();
// при выборе потока показывается список студентов на потоке и их статус обучения
}
}

View File

@ -8,6 +8,7 @@ namespace UniversityContracts.ViewModels
{
public class ReportStreamStudentEdStatPeriodViewModel
{
public int Id { get; set; }
public string StreamName { get; set; } = string.Empty;
public List<(string StudentFIO, string EdStatus)> StudentEdStatus { get; set; } = new();
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.ViewModels
{
public class RoleViewModel : IRoleModel
{
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityModels.Models;
namespace UniversityContracts.ViewModels
{
public class StreamViewModel
{
public int Id { get; set; }
public int UserId { get; set; }
[DisplayName("Название потока")]
public string Name { get; set; } = string.Empty;
[DisplayName("Номер курса")]
public int Course { get; set; }
public Dictionary<int, IStudentModel> StudentStream { get; set; } = new();
}
}

View File

@ -1,10 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityDataBaseImplemet.Models;
using Stream = UniversityDataBaseImplemet.Models.Stream;
namespace UniversityDataBaseImplemet
{
@ -20,8 +16,15 @@ namespace UniversityDataBaseImplemet
}
public virtual DbSet<User> User { get; set; }
public virtual DbSet<Document> Documents { get; set; }
public virtual DbSet<Discipline> Discipline { get; set; }
public virtual DbSet<EducationStatus> EducationStatuses { get; set; }
public virtual DbSet<EducationGroup> EducationGroups { get; set; }
public virtual DbSet<EducationGroupDocument> EducationGroupsDocuments { get; set; }
public virtual DbSet<EducationGroupStream> EducationGroupsStreams { get; set; }
public virtual DbSet<Stream> Streams { get; set; }
public virtual DbSet<Student> Students { get; set; }
public virtual DbSet<StudentDocument> StudentDocuments { get; set; }
public virtual DbSet<StudentStream> StudentStreams { get; set; }
public virtual DbSet<Role> Roles { get; set; }
}
}

View File

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
using UniversityDataBaseImplemet.Models;
namespace UniversityDataBaseImplemet.Implements
{
public class DisciplineStorage:IDisciplineStorage
{
public DisciplineViewModel? GetElement(DisciplineSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new Database();
return context.Discipline
.FirstOrDefault(record => record.Id == model.Id
|| record.Name.Equals(model.Name))
?.GetViewModel;
}
public List<DisciplineViewModel> GetFilteredList(DisciplineSearchModel model)
{
using var context = new Database();
if (model.Id.HasValue)
{
return context.Discipline
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
}
else if (model.UserId.HasValue)
{
return context.Discipline
.Where(record => record.UserId == model.UserId)
.Select(record => record.GetViewModel)
.ToList();
}
else
{
return new();
}
}
public List<DisciplineViewModel> GetFullList()
{
using var context = new Database();
return context.Discipline
.Select(record => record.GetViewModel)
.ToList();
}
public DisciplineViewModel? Insert(DisciplineBindingModel model)
{
var newDiscipline = Discipline.Create(model);
if (newDiscipline == null)
{
return null;
}
using var context = new Database();
context.Discipline.Add(newDiscipline);
context.SaveChanges();
return newDiscipline.GetViewModel;
}
public DisciplineViewModel? Update(DisciplineBindingModel model)
{
using var context = new Database();
using var transaction = context.Database.BeginTransaction();
try
{
var stream = context.Discipline
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (stream == null)
{
return null;
}
stream.Update(model);
context.SaveChanges();
transaction.Commit();
return stream.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public DisciplineViewModel? Delete(DisciplineBindingModel model)
{
using var context = new Database();
var stream = context.Discipline
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (stream == null)
{
return null;
}
context.Discipline.Remove(stream);
context.SaveChanges();
return stream.GetViewModel;
}
}
}

View File

@ -1,8 +1,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
@ -24,6 +26,8 @@ namespace UniversityDataBaseImplemet.Implements
using var context = new Database();
return context.Documents
.Include(record => record.User)
.Include(record => record.Students)
.ThenInclude(record => record.Student)
.FirstOrDefault(record => record.Id == model.Id
|| record.Name.Equals(model.Name))
?.GetViewModel;
@ -35,14 +39,32 @@ namespace UniversityDataBaseImplemet.Implements
{
return context.Documents
.Include(record => record.User)
.Include(record => record.Students)
.ThenInclude(record => record.Student)
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
}
else if (model.DateFrom != null && model.DateTo != null && model.UserId.HasValue)
{
return context.Documents
.Where(d => d.Date >= model.DateFrom && d.Date <= model.DateTo && d.UserId == model.UserId)
.Include(d => d.Students)
.ThenInclude(sd => sd.Student)
.ThenInclude(s => s.StudentStream)
.ThenInclude(ss => ss.Stream)
.Include(d => d.Students)
.ThenInclude(sd => sd.Student)
.ThenInclude(s => s.EducationStatus)
.Select(result => result.GetViewModel)
.ToList();
}
else if (model.UserId.HasValue)
{
return context.Documents
.Include(record => record.User)
.Include(record => record.Students)
.ThenInclude(record => record.Student)
.Where(record => record.UserId == model.UserId)
.Select(record => record.GetViewModel)
.ToList();
@ -57,6 +79,8 @@ namespace UniversityDataBaseImplemet.Implements
using var context = new Database();
return context.Documents
.Include(record => record.User)
.Include(record => record.Students)
.ThenInclude(record => record.Student)
.Select(record => record.GetViewModel)
.ToList();
}
@ -87,6 +111,7 @@ namespace UniversityDataBaseImplemet.Implements
}
document.Update(model);
context.SaveChanges();
document.UpdateStudents(context, model);
transaction.Commit();
return document.GetViewModel;
}

View File

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.ViewModels;
using UniversityDataBaseImplemet.Models;
namespace UniversityDataBaseImplemet.Implements
{
public class EducationGroupStorage
{
public EducationGroupViewModel? GetElement(EducationGroupSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new Database();
return context.EducationGroups
.FirstOrDefault(record => record.Id == model.Id
|| record.Name.Equals(model.Name))
?.GetViewModel;
}
public List<EducationGroupViewModel> GetFilteredList(EducationGroupSearchModel model)
{
using var context = new Database();
if (model.Id.HasValue)
{
return context.EducationGroups
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
}
else if (model.UserId.HasValue)
{
return context.EducationGroups
.Where(record => record.UserId == model.UserId)
.Select(record => record.GetViewModel)
.ToList();
}
else
{
return new();
}
}
public List<EducationGroupViewModel> GetFullList()
{
using var context = new Database();
return context.EducationGroups
.Select(record => record.GetViewModel)
.ToList();
}
public EducationGroupViewModel? Insert(EducationGroupBindingModel model)
{
var newEducationGroup = EducationGroup.Create(model);
if (newEducationGroup == null)
{
return null;
}
using var context = new Database();
context.EducationGroups.Add(newEducationGroup);
context.SaveChanges();
return newEducationGroup.GetViewModel;
}
public EducationGroupViewModel? Update(EducationGroupBindingModel model)
{
using var context = new Database();
using var transaction = context.Database.BeginTransaction();
try
{
var educationgroup = context.EducationGroups
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (educationgroup == null)
{
return null;
}
educationgroup.Update(model);
context.SaveChanges();
transaction.Commit();
return educationgroup.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public EducationGroupViewModel? Delete(EducationGroupBindingModel model)
{
using var context = new Database();
var educationgroup = context.EducationGroups
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (educationgroup == null)
{
return null;
}
context.EducationGroups.Remove(educationgroup);
context.SaveChanges();
return educationgroup.GetViewModel;
}
}
}

View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
using UniversityDataBaseImplemet.Models;
namespace UniversityDataBaseImplemet.Implements
{
public class RoleStorage : IRoleStorage
{
public RoleViewModel? Delete(RoleBindingModel model)
{
using var context = new Database();
var element = context.Roles
.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
context.Roles.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
return null;
}
public RoleViewModel? GetElement(RoleSearchModel model)
{
using var context = new Database();
if (model.Id.HasValue)
return context.Roles
.FirstOrDefault(record => record.Id == model.Id)
?.GetViewModel;
if (!string.IsNullOrEmpty(model.Name))
return context.Roles
.FirstOrDefault(record => record.Name.Equals(model.Name))
?.GetViewModel;
return null;
}
public List<RoleViewModel> GetFilteredList(RoleSearchModel model)
{
if (string.IsNullOrEmpty(model.Name))
{
return new();
}
using var context = new Database();
return context.Roles
.Where(record => record.Name.Contains(model.Name))
.Select(record => record.GetViewModel)
.ToList();
}
public List<RoleViewModel> GetFullList()
{
using var context = new Database();
return context.Roles.Select(record => record.GetViewModel).ToList();
}
public RoleViewModel? Insert(RoleBindingModel model)
{
var newRole = Role.Create(model);
if (newRole == null)
{
return null;
}
using var context = new Database();
context.Roles.Add(newRole);
context.SaveChanges();
return newRole.GetViewModel;
}
public RoleViewModel? Update(RoleBindingModel model)
{
using var context = new Database();
var client = context.Roles.FirstOrDefault(record => record.Id == model.Id);
if (client == null)
{
return null;
}
client.Update(model);
context.SaveChanges();
return client.GetViewModel;
}
}
}

View File

@ -0,0 +1,116 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
using UniversityContracts.ViewModels;
using Stream = UniversityDataBaseImplemet.Models.Stream;
namespace UniversityDataBaseImplemet.Implements
{
public class StreamStorage:IStreamStorage
{
public StreamViewModel? GetElement(StreamSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new Database();
return context.Streams
.Include(record => record.StreamStudents)
.ThenInclude(record => record.Student)
.FirstOrDefault(record => record.Id == model.Id
|| record.Name.Equals(model.Name))
?.GetViewModel;
}
public List<StreamViewModel> GetFilteredList(StreamSearchModel model)
{
using var context = new Database();
if (model.Id.HasValue)
{
return context.Streams
.Include(record => record.StreamStudents)
.ThenInclude(record => record.Student)
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
}
else if (model.UserId.HasValue)
{
return context.Streams
.Include(record => record.StreamStudents)
.ThenInclude(record => record.Student)
.Where(record => record.UserId == model.UserId)
.Select(record => record.GetViewModel)
.ToList();
}
else
{
return new();
}
}
public List<StreamViewModel> GetFullList()
{
using var context = new Database();
return context.Streams
.Include(record => record.StreamStudents)
.ThenInclude(record => record.Student)
.Select(record => record.GetViewModel)
.ToList();
}
public StreamViewModel? Insert(StreamBindingModel model)
{
var newStream = Stream.Create(model);
if (newStream == null)
{
return null;
}
using var context = new Database();
context.Streams.Add(newStream);
context.SaveChanges();
return newStream.GetViewModel;
}
public StreamViewModel? Update(StreamBindingModel model)
{
using var context = new Database();
using var transaction = context.Database.BeginTransaction();
try
{
var stream = context.Streams
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (stream == null)
{
return null;
}
stream.Update(model);
context.SaveChanges();
stream.UpdateStreamStudents(context, model);
transaction.Commit();
return stream.GetViewModel;
}
catch
{
transaction.Rollback();
throw;
}
}
public StreamViewModel? Delete(StreamBindingModel model)
{
using var context = new Database();
var stream = context.Streams
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (stream == null)
{
return null;
}
context.Streams.Remove(stream);
context.SaveChanges();
return stream.GetViewModel;
}
}
}

View File

@ -36,8 +36,8 @@ namespace UniversityDataBaseImplemet.Implements
if (model.Id.HasValue)
{
return context.Students
.Include(record => record.EducationStatus)
.Include(record => record.User)
.Include(record => record.EducationStatus)
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
@ -45,35 +45,12 @@ namespace UniversityDataBaseImplemet.Implements
else if (model.UserId.HasValue)
{
return context.Students
.Include(record => record.EducationStatus)
.Include(record => record.User)
.Include(record => record.EducationStatus)
.Where(record => record.UserId == model.UserId)
.Select(record => record.GetViewModel)
.ToList();
}
/*else if (model.DateFrom != null && model.DateTo != null) // для отчета#2 Поставщик
{
return context.Students
.Include(record => record.User)
.Include(record => record.EducationStatus)
.Join(context.StudentStreams, student => student.Id, studentStream => studentStream.StudentId, (student, studentStream) => new { Student = student, StreamId = studentStream.StreamId })
.Join(context.Streams, studentStream => studentStream.StreamId, stream => stream.Id, (studentStream, stream) => new { Student = studentStream.Student, Stream = stream })
.GroupBy(record => record.Stream)
.Select(result => new
{
Stream = result.Key,
Students = result.Select(record => (record.Student, record.EducationStatus)).ToList()
})
.ToList();
var result = context.Students
.Include(student => student.User)
.Include(student => student.StudentStreams)
.ThenInclude(studentStream => studentStream.Stream)
.ThenInclude(stream => stream.Disciplines)
.SelectMany(student => student.StudentStreams, (student, studentStream) => new { Student = student, Stream = studentStream.Stream })
.Select(record => new { StudentName = record.Student.User.Name + " " + record.Student.User.Surname, Discipline = record.Stream.Disciplines })
.ToList();
}*/
else
{
return new();

View File

@ -1,11 +1,4 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.SearchModels;
using UniversityContracts.StoragesContracts;
@ -20,8 +13,7 @@ namespace UniversityDataBaseImplemet.Implements
{
using var context = new Database();
var user = context.User
.Include(record => record.Login)
.Include(record => record.RoleId)
.Include(record => record.Role)
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (user == null)
{
@ -40,8 +32,7 @@ namespace UniversityDataBaseImplemet.Implements
}
using var context = new Database();
return context.User
.Include(record => record.Login)
.Include(record => record.Id)
.Include(record => record.Role)
.FirstOrDefault(record => record.Id.Equals(model.Id))
?.GetViewModel;
}
@ -52,8 +43,7 @@ namespace UniversityDataBaseImplemet.Implements
if (model.Id.HasValue)
{
return context.User
.Include(record => record.Login)
.Include(record => record.RoleId)
.Include(record => record.Role)
.Where(record => record.Id.Equals(model.Id))
.Select(record => record.GetViewModel)
.ToList();
@ -65,8 +55,7 @@ namespace UniversityDataBaseImplemet.Implements
{
using var context = new Database();
return context.User
.Include(record => record.Login)
.Include(record => record.RoleId)
.Include(record => record.Role)
.Select(record => record.GetViewModel)
.ToList();
}
@ -91,8 +80,7 @@ namespace UniversityDataBaseImplemet.Implements
try
{
var user = context.User
.Include(record => record.Login)
.Include(record => record.RoleId)
.Include(record => record.Role)
.FirstOrDefault(record => record.Id.Equals(model.Id));
if (user == null)
{

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
using UniversityModels.Models;
namespace UniversityDataBaseImplemet.Models
{
public class Discipline : IDisciplineModel
{
public int Id { get; private set; }
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public int UserId { get; set; }
[Required]
public int StreamId { get; set; }
[Required]
public int Hours { get; set; }
[Required]
public bool MarkType { get; set; }
public virtual Stream Stream { get; set; }
public virtual User User { get; set; }
public static Discipline? Create(DisciplineBindingModel model)
{
return new Discipline()
{
Id = model.Id,
Name = model.Name,
UserId = model.UserId,
StreamId = model.StreamId,
Hours= model.Hours,
MarkType = model.MarkType
};
}
public void Update(DisciplineBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
UserId = model.UserId;
StreamId = model.StreamId;
Hours = model.Hours;
MarkType = model.MarkType;
}
public DisciplineViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
UserId = UserId,
StreamId = StreamId,
Hours = Hours,
MarkType = MarkType
};
}
}

View File

@ -22,8 +22,22 @@ namespace UniversityDataBaseImplemet.Models
public int UserId { get; set; }
[ForeignKey("DocumentId")]
public virtual List<StudentDocument> Students { get; set; } = new();
public virtual EducationStatus User { get; set; }
[ForeignKey("DocumentId")]
public virtual List<EducationGroupDocument> EducationGroupDocument { get; set; } = new();
public virtual User User { get; set; }
private Dictionary<int, IStudentModel>? _studentDocument = null;
[NotMapped]
public Dictionary<int, IStudentModel> StudentDocument
{
get
{
if (_studentDocument == null)
{
_studentDocument = Students.ToDictionary(rec => rec.StudentId, rec => rec.Student as IStudentModel);
}
return _studentDocument;
}
}
public static Document? Create(DocumentBindingModel model)
{
return new Document()
@ -44,12 +58,44 @@ namespace UniversityDataBaseImplemet.Models
Date = model.Date;
UserId = model.UserId;
}
public void UpdateStudents(Database context, DocumentBindingModel model)
{
var studentDocument = context.StudentDocuments
.Where(rec => rec.DocumentId == model.Id)
.ToList();
if (studentDocument != null)
{
context.StudentDocuments
.RemoveRange(studentDocument
.Where(rec => !model.StudentDocument
.ContainsKey(rec.StudentId))
);
context.SaveChanges();
var document = context.Documents
.First(x => x.Id == Id);
foreach (var sd in studentDocument)
{
model.StudentDocument.Remove(sd.StudentId);
}
foreach (var sd in model.StudentDocument)
{
context.StudentDocuments.Add(new StudentDocument
{
Document = document,
Student = context.Students.First(x => x.Id == sd.Key),
});
context.SaveChanges();
}
_studentDocument = null;
}
}
public DocumentViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Date = Date,
UserId = UserId,
UserId = UserId,
StudentDocument = StudentDocument
};
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
using UniversityModels.Models;
namespace UniversityDataBaseImplemet.Models
{
public class EducationGroup : IEducationGroupModel
{
public int Id { get; private set; }
[Required]
public int NumberOfStudent { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public int UserId { get; set; }
[ForeignKey("EducationGroupId")]
public virtual List<EducationGroupDocument> EducationGroupDocument { get; set; } = new();
[ForeignKey("EducationGroupId")]
public virtual List<EducationGroupStream> EducationGroupStream { get; set; } = new();
public virtual User User { get; set; }
public static EducationGroup? Create(EducationGroupBindingModel model)
{
return new EducationGroup()
{
Id = model.Id,
Name = model.Name,
UserId = model.UserId,
NumberOfStudent= model.NumberOfStudent
};
}
public void Update(EducationGroupBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
UserId = model.UserId;
}
public EducationGroupViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
UserId = UserId,
NumberOfStudents= NumberOfStudent
};
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityDataBaseImplemet.Models
{
public class EducationGroupDocument
{
public int Id { get; set; }
[Required]
public int EducationGroupId { get; set; }
[Required]
public int DocumentId { get; set; }
public virtual Document Document { get; set; } = new();
public virtual EducationGroup EducationGroup { get; set; } = new();
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityDataBaseImplemet.Models
{
public class EducationGroupStream
{
public int Id { get; set; }
[Required]
public int EducationGroupId { get; set; }
[Required]
public int StreamId { get; set; }
public virtual Stream Stream { get; set; } = new();
public virtual EducationGroup EducationGroup { get; set; } = new();
}
}

View File

@ -20,7 +20,7 @@ namespace UniversityDataBaseImplemet.Models
public int UserId { get; set; }
[ForeignKey("EducationStatusId")]
public virtual List<Student> Students { get; set; } = new();
public virtual EducationStatus User { get; set; }
public virtual User User { get; set; }
public static EducationStatus? Create(EducationStatusBindingModel model)
{

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
using UniversityModels.Models;
namespace UniversityDataBaseImplemet.Models
{
public class Role : IRoleModel
{
[Required]
public string Name { get; set; } = string.Empty;
public int Id { get; set; }
[ForeignKey("RoleId")]
public virtual List<User> Users { get; set; } = new();
public static Role? Create(RoleBindingModel model)
{
if (model == null)
{
return null;
}
return new Role()
{
Id = model.Id,
Name = model.Name
};
}
public static Role Create(RoleViewModel model)
{
return new Role
{
Id = model.Id,
Name = model.Name
};
}
public void Update(RoleBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
}
public RoleViewModel GetViewModel => new()
{
Id = Id,
Name = Name
};
}
}

View File

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
using UniversityModels.Models;
namespace UniversityDataBaseImplemet.Models
{
public class Stream : IStreamModel
{
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public int Course { get; set; }
[Required]
public int UserId { get; set; }
public int Id { get; private set; }
[ForeignKey("StreamId")]
public virtual List<EducationGroupStream> EducationGroupStream { get; set; } = new();
[ForeignKey("StreamId")]
public virtual List<StudentStream> StreamStudents { get; set; } = new();
public virtual User User { get; set; }
private Dictionary<int, IStudentModel>? _studentStream = null;
[NotMapped]
public Dictionary<int, IStudentModel> StudentStream
{
get
{
if (_studentStream == null)
{
_studentStream = StreamStudents.ToDictionary(rec => rec.StudentId, rec => rec.Student as IStudentModel);
}
return _studentStream;
}
}
public static Stream Create(StreamBindingModel model)
{
return new Stream()
{
Id = model.Id,
Name = model.Name,
Course = model.Course,
UserId = model.UserId
};
}
public void Update(StreamBindingModel model)
{
Name = model.Name;
Course = model.Course;
UserId = model.UserId;
}
public void UpdateStreamStudents(Database context, StreamBindingModel model)
{
var studentStream = context.StudentStreams
.Where(rec => rec.StreamId == model.Id)
.ToList();
if (studentStream != null)
{
context.StudentStreams
.RemoveRange(studentStream
.Where(rec => !model.StudentStream
.ContainsKey(rec.StudentId))
);
context.SaveChanges();
var stream = context.Streams
.First(x => x.Id == Id);
foreach (var sd in studentStream)
{
model.StudentStream.Remove(sd.StudentId);
}
foreach (var sd in model.StudentStream)
{
context.StudentStreams.Add(new StudentStream
{
Stream = stream,
Student = context.Students.First(x => x.Id == sd.Key),
});
context.SaveChanges();
}
_studentStream = null;
}
}
public StreamViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
UserId = UserId,
Course= Course
};
}
}

View File

@ -28,8 +28,10 @@ namespace UniversityDataBaseImplemet.Models
public int UserId { get; set; }
[ForeignKey("StudentId")]
public virtual List<StudentDocument> DocumentStudents { get; set; } = new();
[ForeignKey("StudentId")]
public virtual List<StudentStream> StudentStream { get; set; } = new();
public virtual EducationStatus EducationStatus { get; set; }
public virtual EducationStatus User { get; set; }
public virtual User User { get; set; }
public static Student Create(StudentBindingModel model)
{

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityDataBaseImplemet.Models
{
public class StudentStream
{
public int Id { get; set; }
[Required]
public int StudentId { get; set; }
[Required]
public int StreamId { get; set; }
public virtual Student Student { get; set; } = new();
public virtual Stream Stream { get; set; } = new();
}
}

View File

@ -7,10 +7,11 @@ using System.Text;
using System.Threading.Tasks;
using UniversityContracts.BindingModels;
using UniversityContracts.ViewModels;
using UniversityModels.Models;
namespace UniversityDataBaseImplemet.Models
{
public class User
public class User : IUserModel
{
public int Id { get; private set; }
[Required]
@ -19,7 +20,7 @@ namespace UniversityDataBaseImplemet.Models
public string Password { get; set; } = string.Empty;
[Required]
public int RoleId { get; set; }
public virtual Role Role { get; set; } = new();
public static User Create(UserBindingModel model)
{
return new User()

View File

@ -0,0 +1,12 @@
{
"profiles": {
"UniversityDataBaseImplemet": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:49351;http://localhost:49352"
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityModels.Models
{
public interface IDisciplineModel : IId
{
string Name { get; }
int Hours { get; }
bool MarkType { get; }
int StreamId { get; }
int UserId { get; }
}
}

View File

@ -11,5 +11,6 @@ namespace UniversityModels.Models
string Name { get; }
DateTime Date { get; }
int UserId { get; }
Dictionary <int, IStudentModel> StudentDocument { get; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityModels.Models
{
public interface IEducationGroupModel:IId
{
string Name { get;}
int NumberOfStudent { get;}
int UserId { get;}
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityModels.Models
{
public interface IRoleModel : IId
{
string Name { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UniversityModels.Models
{
public interface IStreamModel:IId
{
string Name { get; }
int Course { get; }
int UserId { get; }
Dictionary<int, IStudentModel> StudentStream { get; }
}
}

View File

@ -0,0 +1,12 @@
{
"profiles": {
"UniversityModels": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:49348;http://localhost:49349"
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using UniversityProvider.Models;
namespace UniversityProvider.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@ -0,0 +1,9 @@
namespace UniversityProvider.Models
{
public class ErrorViewModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

View File

@ -1,6 +1,27 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

View File

@ -3,8 +3,8 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65378",
"sslPort": 44324
"applicationUrl": "http://localhost:22273",
"sslPort": 44392
}
},
"profiles": {
@ -12,7 +12,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7236;http://localhost:5269",
"applicationUrl": "https://localhost:7178;http://localhost:5035",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

View File

@ -6,4 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\UniversityContracts\UniversityContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

@ -0,0 +1,8 @@
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

View File

@ -0,0 +1,21 @@
@{
ViewData["Title"] = "Login";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Войти" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,21 @@
@{
ViewData["Title"] = "Register";
}
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,65 @@
@using UniversityContracts.ViewModels
@model List<StudentViewModel>
@model List<EducationStatusViewModel>
@{
ViewData["Title"] = "Студенты";
}
<div class="text-center">
<h1 class="display-4">Студенты</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Войдите в аккаунт</h3>
return;
}
<div>
<a class="btn btn-secondary" asp-action="Student">Добавить</a>
<a class="btn btn-secondary" asp-action="Student">Изменить</a>
<a class="btn btn-secondary" asp-action="Student">Удалить</a>
<a class="btn btn-secondary" asp-action="Student">Обновить</a>
</div>
<table class="table">
<thead>
<tr>
<th>
Имя Фамилия
</th>
<th>
Дата Рождения
</th>
<th>
Номер Студ.билета
</th>
<th>
Статус обучения
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name + ' ' + item.Surname)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateOfBirth)
</td>
<td>
@Html.DisplayFor(modelItem => item.StudentCard)
</td>
<td>
@Html.DisplayFor(modelItem => item.EducationStatusId)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,25 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - UniversityProvider</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/UniversityProvider.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">UniversityProvider</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Students">Студенты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Documents">Приказы</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="EducationStatuses">Статусы обучения</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetList">Получить список</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetReport">Отчет</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2023 - UniversityProvider - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,48 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View File

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -0,0 +1,3 @@
@using UniversityProvider
@using UniversityProvider.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

View File

@ -0,0 +1,18 @@
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,4 @@
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2011-2021 Twitter, Inc.
Copyright (c) 2011-2021 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,427 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More