fix in many files, add Forms
This commit is contained in:
parent
4958e973bc
commit
d60d364d16
@ -19,7 +19,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
}
|
||||
public List<CourseViewModel>? ReadList(CourseSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. CourseName:{CourseName}.Id:{ Id}", model?.CourseName, model?.Id);
|
||||
_logger.LogInformation("ReadList. CourseName:{CourseName}.Id:{ Id}", model?.name, model?.course_id);
|
||||
var list = model == null ? _courseStorage.GetFullList() :
|
||||
_courseStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
@ -36,7 +36,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. CourseName:{CourseName}.Id:{ Id}", model.CourseName, model.Id);
|
||||
_logger.LogInformation("ReadElement. CourseName:{CourseName}.Id:{ Id}", model.name, model.course_id);
|
||||
var element = _courseStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -95,7 +95,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
_logger.LogInformation("Course. CourseName:{CourseName}. Id: { Id}", model.CourseName, model.Id);
|
||||
var element = _courseStorage.GetElement(new CourseSearchModel
|
||||
{
|
||||
CourseName = model.CourseName
|
||||
name = model.CourseName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
}
|
||||
public List<ExamPointsViewModel>? ReadList(ExamPointsSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
|
||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.exampoints_id);
|
||||
var list = model == null ? _examPointsStorage.GetFullList() :
|
||||
_examPointsStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
@ -36,7 +36,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement .Id:{ Id}", model.Id);
|
||||
_logger.LogInformation("ReadElement .Id:{ Id}", model.exampoints_id);
|
||||
var element = _examPointsStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
|
@ -12,14 +12,14 @@ namespace StudentEnrollmentBusinessLogic
|
||||
private readonly IFacultyStorage _facultyStorage;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public FacultyLogic(IFacultyStorage facultyStorage, ILogger logger)
|
||||
public FacultyLogic(IFacultyStorage facultyStorage, ILogger<FacultyLogic> logger)
|
||||
{
|
||||
_facultyStorage = facultyStorage;
|
||||
_logger = logger;
|
||||
}
|
||||
public List<FacultyViewModel>? ReadList(FacultySearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. FacultyName:{FacultyName}.Id:{ Id}", model?.FacultyName, model?.Id);
|
||||
_logger.LogInformation("ReadList. FacultyName:{FacultyName}.Id:{ Id}", model?.name, model?.faculty_id);
|
||||
var list = model == null ? _facultyStorage.GetFullList() :
|
||||
_facultyStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
@ -36,7 +36,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. FacultyName:{FacultyName}.Id:{ Id}", model.FacultyName, model.Id);
|
||||
_logger.LogInformation("ReadElement. FacultyName:{FacultyName}.Id:{ Id}", model.name, model.faculty_id);
|
||||
var element = _facultyStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -97,7 +97,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
_logger.LogInformation("Faculty. FacultyName:{FacultyName}. Id: { Id}", model.FacultyName, model.Id);
|
||||
var element = _facultyStorage.GetElement(new FacultySearchModel
|
||||
{
|
||||
FacultyName = model.FacultyName,
|
||||
name = model.FacultyName,
|
||||
}); ;
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
}
|
||||
public List<StudentViewModel>? ReadList(StudentSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.TIN, model?.Id);
|
||||
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.tin, model?.student_id);
|
||||
var list = model == null ? _studentStorage.GetFullList() : _studentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.TIN, model?.Id);
|
||||
_logger.LogInformation("ReadList. TIN: {TIN}. Id:{Id}", model?.tin, model?.student_id);
|
||||
var element = _studentStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
@ -93,7 +93,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени студента!", nameof(model.FirstName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.TIN))
|
||||
if (model.TIN == 0)
|
||||
{
|
||||
throw new ArgumentNullException("Нет ИНН студента!", nameof(model.TIN));
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace StudentEnrollmentBusinessLogic
|
||||
_logger.LogInformation("Student. LastName: {LastName}, FirstName: {FirstName}, MiddleName: {MiddleName}, TIN: {TIN}, Email: {Email}, Id: {Id}", model.LastName, model.FirstName, model.MiddleName, model.TIN, model.Email, model.Id);
|
||||
var element = _studentStorage.GetElement(new StudentSearchModel
|
||||
{
|
||||
TIN = model.TIN
|
||||
tin = model.TIN
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
|
@ -4,8 +4,8 @@ namespace StudentEnrollmentContracts.BindingModels
|
||||
{
|
||||
public class CourseBindingModel : ICourseModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string CourseName { get; set; } = string.Empty;
|
||||
public long FacultyId { get; set; }
|
||||
public int FacultyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace StudentEnrollmentContracts.BindingModels
|
||||
{
|
||||
public class ExamPointsBindingModel : IExamPointsModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
public int FirstExamPoints { get; set; }
|
||||
public int SecondExamPoints { get; set; }
|
||||
public int ThirdExamPoints { get; set; }
|
||||
|
@ -4,7 +4,7 @@ namespace StudentEnrollmentContracts.BindingModels
|
||||
{
|
||||
public class FacultyBindingModel : IFacultyModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string FacultyName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ namespace StudentEnrollmentContracts.BindingModels
|
||||
{
|
||||
public class StudentBindingModel : IStudentModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string MiddleName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string TIN { get; set; } = string.Empty;
|
||||
public long ExamPointsId { get; set; }
|
||||
public Dictionary<long, ICourseModel> StudentCourse
|
||||
public long TIN { get; set; }
|
||||
public int ExamPointsId { get; set; }
|
||||
public Dictionary<int, ICourseModel> StudentCourse
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
public class CourseSearchModel
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string? CourseName { get; set; }
|
||||
public int? course_id { get; set; }
|
||||
public string? name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
{
|
||||
public class ExamPointsSearchModel
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public int? exampoints_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
public class FacultySearchModel
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string? FacultyName { get; set; }
|
||||
public int? faculty_id { get; set; }
|
||||
public string? name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
public class StudentSearchModel
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string? TIN { get; set; }
|
||||
public int? student_id { get; set; }
|
||||
public long? tin { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ namespace StudentEnrollmentContracts.ViewModels
|
||||
{
|
||||
public class CourseViewModel : ICourseModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название направления")]
|
||||
public string CourseName { get; set; } = string.Empty;
|
||||
[DisplayName("Название факультета")]
|
||||
public string FacultyName { get; set; } = string.Empty;
|
||||
public long FacultyId { get; set; }
|
||||
public int FacultyId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace StudentEnrollmentContracts.ViewModels
|
||||
{
|
||||
public class ExamPointsViewModel : IExamPointsModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Баллы за первый экзамен")]
|
||||
public int FirstExamPoints { get; set; }
|
||||
[DisplayName("Баллы за второй экзамен")]
|
||||
|
@ -5,7 +5,7 @@ namespace StudentEnrollmentContracts.ViewModels
|
||||
{
|
||||
public class FacultyViewModel : IFacultyModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название факультета")]
|
||||
public string FacultyName { get; set; } = string.Empty;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace StudentEnrollmentContracts.ViewModels
|
||||
{
|
||||
public class StudentViewModel : IStudentModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Имя")]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
[DisplayName("Фамилия")]
|
||||
@ -15,11 +15,11 @@ namespace StudentEnrollmentContracts.ViewModels
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("ИНН")]
|
||||
public string TIN { get; set; } = string.Empty;
|
||||
public long ExamPointsId { get; set; }
|
||||
public long TIN { get; set; }
|
||||
public int ExamPointsId { get; set; }
|
||||
[DisplayName("Суммарное количество баллов")]
|
||||
public int ExamPoints { get; set; }
|
||||
public Dictionary<long, ICourseModel> StudentCourse
|
||||
public Dictionary<int, ICourseModel> StudentCourse
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -2,6 +2,6 @@
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
long Id { get; }
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
public interface ICourseModel : IId
|
||||
{
|
||||
string CourseName { get; }
|
||||
long FacultyId { get; }
|
||||
int FacultyId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
{
|
||||
int FirstExamPoints { get; }
|
||||
int SecondExamPoints { get; }
|
||||
int ThirdExamPoints { get; }
|
||||
int AddPoints { get; }
|
||||
int Summary { get; }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
string FirstName { get; }
|
||||
string MiddleName { get; }
|
||||
string Email { get; }
|
||||
string TIN { get; }
|
||||
long ExamPointsId { get; }
|
||||
Dictionary<long, ICourseModel> StudentCourse { get; }
|
||||
long TIN { get; }
|
||||
int ExamPointsId { get; }
|
||||
Dictionary<int, ICourseModel> StudentCourse { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,85 @@
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDatabaseImplement.Models;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Implements
|
||||
{
|
||||
public class CourseStorage : ICourseStorage
|
||||
{
|
||||
// TODO: Implement this
|
||||
}
|
||||
public List<CourseViewModel> GetFullList()
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.course
|
||||
.Include(x => x.Faculty)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<CourseViewModel> GetFilteredList(CourseSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.course
|
||||
.Include(x => x.Faculty)
|
||||
.Where(x => (model.course_id.HasValue && x.course_id == model.course_id) || (string.IsNullOrEmpty(model.name) && x.name == model.name))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public CourseViewModel? GetElement(CourseSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.name) && !model.course_id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.course
|
||||
.Include(x => x.Faculty)
|
||||
.FirstOrDefault(x => (model.course_id.HasValue && x.course_id == model.course_id) || (string.IsNullOrEmpty(model.name) && x.name == model.name))?
|
||||
.GetViewModel;
|
||||
}
|
||||
public CourseViewModel? Insert(CourseBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var newCourse = Course.Create(model);
|
||||
if (newCourse == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.course.Add(newCourse);
|
||||
context.SaveChanges();
|
||||
return context.course
|
||||
.Include(x => x.Faculty)
|
||||
.FirstOrDefault(x => x.course_id == newCourse.course_id)?
|
||||
.GetViewModel;
|
||||
}
|
||||
public CourseViewModel? Update(CourseBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var course = context.course.Include(x => x.Faculty).FirstOrDefault(x => x.course_id == model.Id);
|
||||
if (course == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
course.Update(model);
|
||||
context.SaveChanges();
|
||||
return course.GetViewModel;
|
||||
}
|
||||
public CourseViewModel? Delete(CourseBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var element = context.course.Include(x => x.Faculty).FirstOrDefault(rec => rec.course_id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.course.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Implements
|
||||
{
|
||||
public class ExamPoints : IExamPointsStorage
|
||||
{
|
||||
// TODO: Implement this
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDatabaseImplement.Models;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Implements
|
||||
{
|
||||
public class ExamPointsStorage : IExamPointsStorage
|
||||
{
|
||||
public List<ExamPointsViewModel> GetFullList()
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.exampoints
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ExamPointsViewModel> GetFilteredList(ExamPointsSearchModel model)
|
||||
{
|
||||
if (!model.exampoints_id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.exampoints
|
||||
.Where(x => model.exampoints_id.HasValue && x.exampoints_id == model.exampoints_id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public ExamPointsViewModel? GetElement(ExamPointsSearchModel model)
|
||||
{
|
||||
if (!model.exampoints_id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.exampoints
|
||||
.FirstOrDefault(x => model.exampoints_id.HasValue && x.exampoints_id == model.exampoints_id)?
|
||||
.GetViewModel;
|
||||
}
|
||||
public ExamPointsViewModel? Insert(ExamPointsBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var newExamPoints = ExamPoints.Create(model);
|
||||
if (newExamPoints == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.exampoints.Add(newExamPoints);
|
||||
context.SaveChanges();
|
||||
return newExamPoints.GetViewModel;
|
||||
}
|
||||
public ExamPointsViewModel? Update(ExamPointsBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var examPoints = context.exampoints.FirstOrDefault(x => x.exampoints_id == model.Id);
|
||||
if (examPoints == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
examPoints.Update(model);
|
||||
context.SaveChanges();
|
||||
return examPoints.GetViewModel;
|
||||
}
|
||||
public ExamPointsViewModel? Delete(ExamPointsBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var element = context.exampoints.FirstOrDefault(rec => rec.exampoints_id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.exampoints.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,79 @@
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDatabaseImplement.Models;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Implements
|
||||
{
|
||||
public class FacultyStorage : IFacultyStorage
|
||||
{
|
||||
// TODO: Implement this
|
||||
}
|
||||
public List<FacultyViewModel> GetFullList()
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.faculty
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<FacultyViewModel> GetFilteredList(FacultySearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.faculty
|
||||
.Where(x => (model.faculty_id.HasValue && x.faculty_id == model.faculty_id) || (string.IsNullOrEmpty(model.name) && x.name == model.name))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public FacultyViewModel? GetElement(FacultySearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.name) && !model.faculty_id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.faculty
|
||||
.FirstOrDefault(x => (model.faculty_id.HasValue && x.faculty_id == model.faculty_id) || (string.IsNullOrEmpty(model.name) && x.name == model.name))?
|
||||
.GetViewModel;
|
||||
}
|
||||
public FacultyViewModel? Insert(FacultyBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var newFaculty = Faculty.Create(model);
|
||||
if (newFaculty == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.faculty.Add(newFaculty);
|
||||
context.SaveChanges();
|
||||
return newFaculty.GetViewModel;
|
||||
}
|
||||
public FacultyViewModel? Update(FacultyBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var faculty = context.faculty.FirstOrDefault(x => x.faculty_id == model.Id);
|
||||
if (faculty == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
faculty.Update(model);
|
||||
context.SaveChanges();
|
||||
return faculty.GetViewModel;
|
||||
}
|
||||
public FacultyViewModel? Delete(FacultyBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var element = context.faculty.FirstOrDefault(rec => rec.faculty_id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.faculty.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,82 @@
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDatabaseImplement.Models;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Implements
|
||||
{
|
||||
public class StudentStorage : IStudentStorage
|
||||
{
|
||||
// TODO: Implement this
|
||||
}
|
||||
public List<StudentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.student
|
||||
.Include(x => x.ExamPoints)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<StudentViewModel> GetFilteredList(StudentSearchModel model)
|
||||
{
|
||||
if (model.tin == 0)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.student
|
||||
.Include(x => x.ExamPoints)
|
||||
.Where(x => (model.student_id.HasValue && x.student_id == model.student_id) || (model.tin == 0 && x.tin == model.tin))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public StudentViewModel? GetElement(StudentSearchModel model)
|
||||
{
|
||||
if (model.tin == 0 && !model.student_id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
return context.student
|
||||
.Include(x => x.ExamPoints)
|
||||
.FirstOrDefault(x => (model.student_id.HasValue && x.student_id == model.student_id) || (model.tin == 0 && x.tin == model.tin))?
|
||||
.GetViewModel;
|
||||
}
|
||||
public StudentViewModel? Insert(StudentBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var newStudent = Student.Create(context, model);
|
||||
if (newStudent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.student.Add(newStudent);
|
||||
context.SaveChanges();
|
||||
return context.student.Include(x => x.ExamPoints).FirstOrDefault(x => x.student_id == newStudent.student_id)?.GetViewModel;
|
||||
}
|
||||
public StudentViewModel? Update(StudentBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var student = context.student.FirstOrDefault(x => x.student_id == model.Id);
|
||||
if (student == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
student.Update(model);
|
||||
context.SaveChanges();
|
||||
return student.GetViewModel;
|
||||
}
|
||||
public StudentViewModel? Delete(StudentBindingModel model)
|
||||
{
|
||||
using var context = new StudentEnrollmentDatabase();
|
||||
var element = context.student.FirstOrDefault(rec => rec.student_id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.student.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
213
StudentEnrollment/StudentEnrollmentDatabaseImplement/Migrations/20240506162134_InitCreate.Designer.cs
generated
Normal file
213
StudentEnrollment/StudentEnrollmentDatabaseImplement/Migrations/20240506162134_InitCreate.Designer.cs
generated
Normal file
@ -0,0 +1,213 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using StudentEnrollmentDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(StudentEnrollmentDatabase))]
|
||||
[Migration("20240506162134_InitCreate")]
|
||||
partial class InitCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Property<int>("course_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("course_id"));
|
||||
|
||||
b.Property<int>("facultyid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("course_id");
|
||||
|
||||
b.HasIndex("facultyid");
|
||||
|
||||
b.ToTable("course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.ExamPoints", b =>
|
||||
{
|
||||
b.Property<int>("exampoints_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("exampoints_id"));
|
||||
|
||||
b.Property<int>("addpoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("firstexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("secondexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("summary")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("thirdexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("exampoints_id");
|
||||
|
||||
b.ToTable("exampoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("faculty_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("faculty_id"));
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("faculty_id");
|
||||
|
||||
b.ToTable("faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("student_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("student_id"));
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("exampointsid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("firstname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("lastname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("middlename")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("tin")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("student_id");
|
||||
|
||||
b.HasIndex("exampointsid");
|
||||
|
||||
b.ToTable("student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.StudentCourse", b =>
|
||||
{
|
||||
b.Property<int>("student_course_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("student_course_id"));
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("courseid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("studentid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("student_course_id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("student_course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Faculty", "Faculty")
|
||||
.WithMany()
|
||||
.HasForeignKey("facultyid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.ExamPoints", "ExamPoints")
|
||||
.WithMany()
|
||||
.HasForeignKey("exampointsid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ExamPoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.StudentCourse", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("StudentCourses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Student", "Student")
|
||||
.WithMany("Courses")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("StudentCourses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.Navigation("Courses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "exampoints",
|
||||
columns: table => new
|
||||
{
|
||||
exampoints_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
firstexampoints = table.Column<int>(type: "integer", nullable: false),
|
||||
secondexampoints = table.Column<int>(type: "integer", nullable: false),
|
||||
thirdexampoints = table.Column<int>(type: "integer", nullable: false),
|
||||
addpoints = table.Column<int>(type: "integer", nullable: false),
|
||||
summary = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_exampoints", x => x.exampoints_id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "faculty",
|
||||
columns: table => new
|
||||
{
|
||||
faculty_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_faculty", x => x.faculty_id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "student",
|
||||
columns: table => new
|
||||
{
|
||||
student_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
firstname = table.Column<string>(type: "text", nullable: false),
|
||||
lastname = table.Column<string>(type: "text", nullable: false),
|
||||
middlename = table.Column<string>(type: "text", nullable: false),
|
||||
email = table.Column<string>(type: "text", nullable: false),
|
||||
tin = table.Column<long>(type: "bigint", nullable: false),
|
||||
exampointsid = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_student", x => x.student_id);
|
||||
table.ForeignKey(
|
||||
name: "FK_student_exampoints_exampointsid",
|
||||
column: x => x.exampointsid,
|
||||
principalTable: "exampoints",
|
||||
principalColumn: "exampoints_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "course",
|
||||
columns: table => new
|
||||
{
|
||||
course_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
facultyid = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_course", x => x.course_id);
|
||||
table.ForeignKey(
|
||||
name: "FK_course_faculty_facultyid",
|
||||
column: x => x.facultyid,
|
||||
principalTable: "faculty",
|
||||
principalColumn: "faculty_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "student_course",
|
||||
columns: table => new
|
||||
{
|
||||
student_course_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
studentid = table.Column<int>(type: "integer", nullable: false),
|
||||
courseid = table.Column<int>(type: "integer", nullable: false),
|
||||
StudentId = table.Column<int>(type: "integer", nullable: false),
|
||||
CourseId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_student_course", x => x.student_course_id);
|
||||
table.ForeignKey(
|
||||
name: "FK_student_course_course_CourseId",
|
||||
column: x => x.CourseId,
|
||||
principalTable: "course",
|
||||
principalColumn: "course_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_student_course_student_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "student",
|
||||
principalColumn: "student_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_course_facultyid",
|
||||
table: "course",
|
||||
column: "facultyid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_student_exampointsid",
|
||||
table: "student",
|
||||
column: "exampointsid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_student_course_CourseId",
|
||||
table: "student_course",
|
||||
column: "CourseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_student_course_StudentId",
|
||||
table: "student_course",
|
||||
column: "StudentId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "student_course");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "course");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "student");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "faculty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "exampoints");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using StudentEnrollmentDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(StudentEnrollmentDatabase))]
|
||||
partial class StudentEnrollmentDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Property<int>("course_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("course_id"));
|
||||
|
||||
b.Property<int>("facultyid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("course_id");
|
||||
|
||||
b.HasIndex("facultyid");
|
||||
|
||||
b.ToTable("course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.ExamPoints", b =>
|
||||
{
|
||||
b.Property<int>("exampoints_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("exampoints_id"));
|
||||
|
||||
b.Property<int>("addpoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("firstexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("secondexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("summary")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("thirdexampoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("exampoints_id");
|
||||
|
||||
b.ToTable("exampoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("faculty_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("faculty_id"));
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("faculty_id");
|
||||
|
||||
b.ToTable("faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("student_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("student_id"));
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("exampointsid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("firstname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("lastname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("middlename")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("tin")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("student_id");
|
||||
|
||||
b.HasIndex("exampointsid");
|
||||
|
||||
b.ToTable("student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.StudentCourse", b =>
|
||||
{
|
||||
b.Property<int>("student_course_id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("student_course_id"));
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("courseid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("studentid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("student_course_id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("student_course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Faculty", "Faculty")
|
||||
.WithMany()
|
||||
.HasForeignKey("facultyid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.ExamPoints", "ExamPoints")
|
||||
.WithMany()
|
||||
.HasForeignKey("exampointsid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ExamPoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.StudentCourse", b =>
|
||||
{
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("StudentCourses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("StudentEnrollmentDatabaseImplement.Models.Student", "Student")
|
||||
.WithMany("Courses")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("StudentCourses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StudentEnrollmentDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.Navigation("Courses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -6,17 +6,17 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
public class Course : ICourseModel
|
||||
public class Course // : ICourseModel
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
[Key]
|
||||
public int course_id { get; private set; }
|
||||
[Required]
|
||||
public string CourseName { get; private set; } = string.Empty;
|
||||
public string name { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public long FacultyId { get; private set; }
|
||||
|
||||
[ForeignKey("CourseId")]
|
||||
public int facultyid { get; private set; }
|
||||
public virtual Faculty Faculty { get; set; }
|
||||
[ForeignKey("CourseId")]
|
||||
public virtual List<StudentCourse> StudentCourses { get; set; } = new();
|
||||
|
||||
public static Course? Create(CourseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -25,9 +25,9 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
}
|
||||
return new Course()
|
||||
{
|
||||
Id = model.Id,
|
||||
CourseName = model.CourseName,
|
||||
FacultyId = model.FacultyId,
|
||||
course_id = model.Id,
|
||||
name = model.CourseName,
|
||||
facultyid = model.FacultyId,
|
||||
};
|
||||
}
|
||||
public void Update(CourseBindingModel model)
|
||||
@ -36,14 +36,15 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
CourseName = model.CourseName;
|
||||
FacultyId = model.FacultyId;
|
||||
name = model.CourseName;
|
||||
facultyid = model.FacultyId;
|
||||
}
|
||||
public CourseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CourseName = CourseName,
|
||||
FacultyId = FacultyId,
|
||||
Id = course_id,
|
||||
CourseName = name,
|
||||
FacultyId = facultyid,
|
||||
FacultyName = Faculty.name,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,35 @@
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
public class ExamPoints : IExamPointsModel
|
||||
public class ExamPoints //: IExamPointsModel
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
[Key]
|
||||
public int exampoints_id { get; private set; }
|
||||
[Required]
|
||||
public int FirstExamPoints { get; private set; }
|
||||
public int firstexampoints { get; private set; }
|
||||
[Required]
|
||||
public int SecondExamPoints { get; private set; }
|
||||
public int secondexampoints { get; private set; }
|
||||
[Required]
|
||||
public int ThirdExamPoints { get; private set; }
|
||||
public int AddPoints { get; private set; }
|
||||
public int Summary { get; private set; }
|
||||
public int thirdexampoints { get; private set; }
|
||||
public int addpoints { get; private set; }
|
||||
public int summary { get; private set; }
|
||||
public static ExamPoints? Create(ExamPointsBindingModel model)
|
||||
{
|
||||
if (model == null) {
|
||||
return null;
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
return new ExamPoints()
|
||||
{
|
||||
Id = model.Id,
|
||||
FirstExamPoints = model.FirstExamPoints,
|
||||
SecondExamPoints = model.SecondExamPoints,
|
||||
ThirdExamPoints = model.ThirdExamPoints,
|
||||
AddPoints = model.AddPoints,
|
||||
Summary = model.Summary,
|
||||
exampoints_id = model.Id,
|
||||
firstexampoints = model.FirstExamPoints,
|
||||
secondexampoints = model.SecondExamPoints,
|
||||
thirdexampoints = model.ThirdExamPoints,
|
||||
addpoints = model.AddPoints,
|
||||
summary = model.FirstExamPoints + model.SecondExamPoints + model.ThirdExamPoints + model.AddPoints,
|
||||
};
|
||||
}
|
||||
public void Update(ExamPointsBindingModel model)
|
||||
@ -36,8 +38,19 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
AddPoints = model.AddPoints;
|
||||
Summary = model.Summary;
|
||||
}
|
||||
summary -= addpoints;
|
||||
addpoints = model.AddPoints;
|
||||
summary += model.AddPoints;
|
||||
}
|
||||
|
||||
public ExamPointsViewModel GetViewModel => new()
|
||||
{
|
||||
Id = exampoints_id,
|
||||
FirstExamPoints = firstexampoints,
|
||||
SecondExamPoints = secondexampoints,
|
||||
ThirdExamPoints = thirdexampoints,
|
||||
AddPoints = addpoints,
|
||||
Summary = summary,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -5,19 +5,20 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
public class Faculty : IFacultyModel
|
||||
public class Faculty // : IFacultyModel
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
[Key]
|
||||
public int faculty_id { get; private set; }
|
||||
[Required]
|
||||
public string FacultyName { get; private set;} = string.Empty;
|
||||
public string name { get; private set;} = string.Empty;
|
||||
public static Faculty? Create(FacultyBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
return null;
|
||||
return new Faculty()
|
||||
{
|
||||
Id = model.Id,
|
||||
FacultyName = model.FacultyName,
|
||||
faculty_id = model.Id,
|
||||
name = model.FacultyName,
|
||||
};
|
||||
}
|
||||
|
||||
@ -25,13 +26,13 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
if (model == null)
|
||||
return;
|
||||
FacultyName = model.FacultyName;
|
||||
name = model.FacultyName;
|
||||
}
|
||||
|
||||
public FacultyViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
FacultyName = FacultyName,
|
||||
Id = faculty_id,
|
||||
FacultyName = name,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,35 @@
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
public class Student : IStudentModel
|
||||
public class Student //: IStudentModel
|
||||
{
|
||||
public long Id { get; private set; }
|
||||
[Key]
|
||||
public int student_id { get; private set; }
|
||||
[Required]
|
||||
public string FirstName { get; private set; } = string.Empty;
|
||||
public string firstname { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
public string MiddleName { get; private set; } = string.Empty;
|
||||
public string lastname { get; private set; } = string.Empty;
|
||||
public string middlename { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Email { get; private set; } = string.Empty;
|
||||
public string email { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string TIN { get; private set; } = string.Empty;
|
||||
public long tin { get; private set; }
|
||||
[Required]
|
||||
public long ExamPointsId { get; private set; }
|
||||
private Dictionary<long, ICourseModel>? _StudentCourse = null;
|
||||
public Dictionary<long, ICourseModel> StudentCourse
|
||||
public int exampointsid { get; private set; }
|
||||
public virtual ExamPoints ExamPoints { get; private set; }
|
||||
private Dictionary<int, ICourseModel>? _StudentCourse = null;
|
||||
public Dictionary<int, ICourseModel> StudentCourse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_StudentCourse == null)
|
||||
{
|
||||
_StudentCourse = Courses.ToDictionary(SC => SC.CourseId,
|
||||
_StudentCourse = Courses.ToDictionary(SC => SC.courseid,
|
||||
SC => SC.Course as ICourseModel);
|
||||
}
|
||||
return _StudentCourse;
|
||||
@ -34,7 +37,6 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
}
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<StudentCourse> Courses { get; set; } = new();
|
||||
|
||||
public static Student? Create(StudentEnrollmentDatabase context,StudentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -43,18 +45,42 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
}
|
||||
return new Student()
|
||||
{
|
||||
Id = model.Id,
|
||||
FirstName = model.FirstName,
|
||||
LastName = model.LastName,
|
||||
MiddleName = model.MiddleName,
|
||||
Email = model.Email,
|
||||
TIN = model.TIN,
|
||||
student_id = model.Id,
|
||||
firstname = model.FirstName,
|
||||
lastname = model.LastName,
|
||||
middlename = model.MiddleName,
|
||||
email = model.Email,
|
||||
tin = model.TIN,
|
||||
Courses = model.StudentCourse.Select(x => new StudentCourse
|
||||
{
|
||||
Course = context.Courses.First(y => y.Id == x.Key)
|
||||
Course = context.course.First(y => y.course_id == x.Key)
|
||||
}
|
||||
).ToList(),
|
||||
};
|
||||
}
|
||||
public void Update(StudentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
firstname = model.FirstName;
|
||||
lastname = model.LastName;
|
||||
middlename = model.MiddleName;
|
||||
tin = model.TIN;
|
||||
email = model.Email;
|
||||
}
|
||||
|
||||
public StudentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = student_id,
|
||||
FirstName = firstname,
|
||||
LastName = lastname,
|
||||
MiddleName = middlename,
|
||||
TIN = tin,
|
||||
Email = email,
|
||||
ExamPointsId = exampointsid,
|
||||
ExamPoints = ExamPoints.summary,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,12 @@ namespace StudentEnrollmentDatabaseImplement.Models
|
||||
{
|
||||
public class StudentCourse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
[Key]
|
||||
public int student_course_id { get; set; }
|
||||
[Required]
|
||||
public long StudentId { get; set; }
|
||||
public int studentid { get; set; }
|
||||
[Required]
|
||||
public long CourseId { get; set; }
|
||||
public int courseid { get; set; }
|
||||
public virtual Student Student { get; set; } = new();
|
||||
public virtual Course Course { get; set; } = new();
|
||||
}
|
||||
|
@ -9,17 +9,17 @@ namespace StudentEnrollmentDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql(@"Host=localhost;Database=StudentEnrollmentDatabase;Username=postgres;Password=postgres");
|
||||
optionsBuilder.UseNpgsql(@"Host=192.168.56.103;Database=postgres;Username=postgres;Password=postgres");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDataTimeInfinityConversions", true);
|
||||
}
|
||||
public virtual DbSet<Faculty> Faculties { get; set; }
|
||||
public virtual DbSet<Course> Courses { get; set; }
|
||||
public virtual DbSet<Student> Students { get; set; }
|
||||
public virtual DbSet<StudentCourse> StudentCourses { get; set; }
|
||||
public virtual DbSet<ExamPoints> ExamPointes { get; set; }
|
||||
public virtual DbSet<Faculty> faculty { get; set; }
|
||||
public virtual DbSet<Course> course { get; set; }
|
||||
public virtual DbSet<Student> student { get; set; }
|
||||
public virtual DbSet<StudentCourse> student_course { get; set; }
|
||||
public virtual DbSet<ExamPoints> exampoints { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implements\" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql" Version="7.0.6" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
125
StudentEnrollment/StudentEnrollmentView/FormCourse.Designer.cs
generated
Normal file
125
StudentEnrollment/StudentEnrollmentView/FormCourse.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormCourse
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
comboBoxFaculty = new ComboBox();
|
||||
label2 = new Label();
|
||||
textBoxName = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonAdd = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(9, 20);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(81, 20);
|
||||
label1.TabIndex = 4;
|
||||
label1.Text = "Факультет:";
|
||||
//
|
||||
// comboBoxFaculty
|
||||
//
|
||||
comboBoxFaculty.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxFaculty.FormattingEnabled = true;
|
||||
comboBoxFaculty.Location = new Point(101, 16);
|
||||
comboBoxFaculty.Margin = new Padding(3, 4, 3, 4);
|
||||
comboBoxFaculty.Name = "comboBoxFaculty";
|
||||
comboBoxFaculty.Size = new Size(285, 28);
|
||||
comboBoxFaculty.TabIndex = 3;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(9, 64);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(80, 20);
|
||||
label2.TabIndex = 6;
|
||||
label2.Text = "Название:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(102, 60);
|
||||
textBoxName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(285, 27);
|
||||
textBoxName.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(320, 112);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(98, 31);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(215, 112);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(98, 31);
|
||||
buttonAdd.TabIndex = 9;
|
||||
buttonAdd.Text = "Сохранить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonSave_Click;
|
||||
//
|
||||
// FormCourse
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(433, 160);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxFaculty);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormCourse";
|
||||
Text = "Направление";
|
||||
Load += FormCourse_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private ComboBox comboBoxFaculty;
|
||||
private Label label2;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonCancel;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
83
StudentEnrollment/StudentEnrollmentView/FormCourse.cs
Normal file
83
StudentEnrollment/StudentEnrollmentView/FormCourse.cs
Normal file
@ -0,0 +1,83 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormCourse : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFacultyLogic _logicF;
|
||||
private readonly ICourseLogic _logicC;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormCourse(ILogger<FormCourse> logger, IFacultyLogic logicF, ICourseLogic logicC)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicF = logicF;
|
||||
_logicC = logicC;
|
||||
}
|
||||
private void FormCourse_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Загрузка факультетов для направления");
|
||||
try
|
||||
{
|
||||
var _list = _logicF.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
comboBoxFaculty.DisplayMember = "FacultyName";
|
||||
comboBoxFaculty.ValueMember = "Id";
|
||||
comboBoxFaculty.DataSource = _list;
|
||||
comboBoxFaculty.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки факультетов для направления");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxFaculty.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите факультет", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание направления");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicC.Create(new CourseBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
CourseName = textBoxName.Text,
|
||||
FacultyId = Convert.ToInt32(comboBoxFaculty.SelectedValue)
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании направления. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания направления");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormCourse.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormCourse.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
114
StudentEnrollment/StudentEnrollmentView/FormCourses.Designer.cs
generated
Normal file
114
StudentEnrollment/StudentEnrollmentView/FormCourses.Designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormCourses
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonRef = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 12);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(240, 426);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(283, 24);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(103, 28);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(283, 58);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(103, 28);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(283, 92);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(103, 28);
|
||||
buttonDel.TabIndex = 3;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(283, 126);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(103, 28);
|
||||
buttonRef.TabIndex = 4;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// FormCourses
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(438, 450);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonDel);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormCourses";
|
||||
Text = "Направления";
|
||||
Load += FormCourses_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonAdd;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonRef;
|
||||
}
|
||||
}
|
101
StudentEnrollment/StudentEnrollmentView/FormCourses.cs
Normal file
101
StudentEnrollment/StudentEnrollmentView/FormCourses.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormCourses : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICourseLogic _logic;
|
||||
public FormCourses(ILogger<FormCourses> logger, ICourseLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormCourses_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["FacultyId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка направлений");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки направлений");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCourse));
|
||||
if (service is FormCourse form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCourse));
|
||||
if (service is FormCourse form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление направления");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new CourseBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления направления");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormCourses.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormCourses.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
167
StudentEnrollment/StudentEnrollmentView/FormExamPoints.Designer.cs
generated
Normal file
167
StudentEnrollment/StudentEnrollmentView/FormExamPoints.Designer.cs
generated
Normal file
@ -0,0 +1,167 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormExamPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label2 = new Label();
|
||||
textBoxFirstExamPoints = new TextBox();
|
||||
label1 = new Label();
|
||||
textBoxSecondExamPoints = new TextBox();
|
||||
label3 = new Label();
|
||||
textBoxThirdExamPoints = new TextBox();
|
||||
label4 = new Label();
|
||||
textBoxAddPoints = new TextBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 31);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(129, 20);
|
||||
label2.TabIndex = 7;
|
||||
label2.Text = "Первый экзамен:";
|
||||
//
|
||||
// textBoxFirstExamPoints
|
||||
//
|
||||
textBoxFirstExamPoints.Location = new Point(180, 28);
|
||||
textBoxFirstExamPoints.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxFirstExamPoints.Name = "textBoxFirstExamPoints";
|
||||
textBoxFirstExamPoints.Size = new Size(285, 27);
|
||||
textBoxFirstExamPoints.TabIndex = 6;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 79);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(124, 20);
|
||||
label1.TabIndex = 9;
|
||||
label1.Text = "Второй экзамен:";
|
||||
//
|
||||
// textBoxSecondExamPoints
|
||||
//
|
||||
textBoxSecondExamPoints.Location = new Point(180, 76);
|
||||
textBoxSecondExamPoints.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxSecondExamPoints.Name = "textBoxSecondExamPoints";
|
||||
textBoxSecondExamPoints.Size = new Size(285, 27);
|
||||
textBoxSecondExamPoints.TabIndex = 8;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 131);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(122, 20);
|
||||
label3.TabIndex = 11;
|
||||
label3.Text = "Третий экзамен:";
|
||||
//
|
||||
// textBoxThirdExamPoints
|
||||
//
|
||||
textBoxThirdExamPoints.Location = new Point(180, 128);
|
||||
textBoxThirdExamPoints.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxThirdExamPoints.Name = "textBoxThirdExamPoints";
|
||||
textBoxThirdExamPoints.Size = new Size(285, 27);
|
||||
textBoxThirdExamPoints.TabIndex = 10;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 183);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(91, 20);
|
||||
label4.TabIndex = 13;
|
||||
label4.Text = "Доп. баллы:";
|
||||
//
|
||||
// textBoxAddPoints
|
||||
//
|
||||
textBoxAddPoints.Location = new Point(180, 180);
|
||||
textBoxAddPoints.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxAddPoints.Name = "textBoxAddPoints";
|
||||
textBoxAddPoints.Size = new Size(285, 27);
|
||||
textBoxAddPoints.TabIndex = 12;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(352, 258);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(119, 37);
|
||||
buttonCancel.TabIndex = 15;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(226, 258);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(119, 37);
|
||||
buttonSave.TabIndex = 14;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormExamPoints
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(494, 308);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(textBoxAddPoints);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(textBoxThirdExamPoints);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxSecondExamPoints);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(textBoxFirstExamPoints);
|
||||
Name = "FormExamPoints";
|
||||
Text = "Баллы за экзамены";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label2;
|
||||
private TextBox textBoxFirstExamPoints;
|
||||
private Label label1;
|
||||
private TextBox textBoxSecondExamPoints;
|
||||
private Label label3;
|
||||
private TextBox textBoxThirdExamPoints;
|
||||
private Label label4;
|
||||
private TextBox textBoxAddPoints;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
61
StudentEnrollment/StudentEnrollmentView/FormExamPoints.cs
Normal file
61
StudentEnrollment/StudentEnrollmentView/FormExamPoints.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
using StudentEnrollmentDataModels.Models;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormExamPoints : Form
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public IExamPointsModel ExamPoints { get; }
|
||||
private IExamPointsLogic _logic;
|
||||
public FormExamPoints(IExamPointsLogic logic)
|
||||
{
|
||||
_logic = logic;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxFirstExamPoints.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните баллы за первый экзамен", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxSecondExamPoints.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните баллы за второй экзамен", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var model = new ExamPointsBindingModel
|
||||
{
|
||||
Id = Id ?? 0,
|
||||
FirstExamPoints = Convert.ToInt32(textBoxFirstExamPoints.Text),
|
||||
SecondExamPoints = Convert.ToInt32(textBoxSecondExamPoints.Text),
|
||||
ThirdExamPoints = Convert.ToInt32(textBoxThirdExamPoints.Text),
|
||||
AddPoints = Convert.ToInt32(textBoxAddPoints.Text),
|
||||
};
|
||||
var operationResult = _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormExamPoints.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormExamPoints.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
114
StudentEnrollment/StudentEnrollmentView/FormFaculties.Designer.cs
generated
Normal file
114
StudentEnrollment/StudentEnrollmentView/FormFaculties.Designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormFaculties
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
buttonAdd = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonRef = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 12);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(240, 426);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(283, 24);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(103, 28);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(283, 58);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(103, 28);
|
||||
buttonUpd.TabIndex = 2;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(283, 92);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(103, 28);
|
||||
buttonDel.TabIndex = 3;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(283, 126);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(103, 28);
|
||||
buttonRef.TabIndex = 4;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// FormComponents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(438, 450);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonDel);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormFaculties";
|
||||
Text = "Факультеты";
|
||||
Load += FormFaculties_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonAdd;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonRef;
|
||||
}
|
||||
}
|
102
StudentEnrollment/StudentEnrollmentView/FormFaculties.cs
Normal file
102
StudentEnrollment/StudentEnrollmentView/FormFaculties.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormFaculties : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFacultyLogic _logic;
|
||||
public FormFaculties(ILogger<FormFaculties> logger, IFacultyLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormFaculties_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["FacultyName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка факультетов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки факультетов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFaculty));
|
||||
if (service is FormFaculty form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormFaculty));
|
||||
if (service is FormFaculty form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление факультета");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new FacultyBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления факультета");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormFaculties.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormFaculties.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
100
StudentEnrollment/StudentEnrollmentView/FormFaculty.Designer.cs
generated
Normal file
100
StudentEnrollment/StudentEnrollmentView/FormFaculty.Designer.cs
generated
Normal file
@ -0,0 +1,100 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormFaculty
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(31, 20);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(80, 20);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Название:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(129, 17);
|
||||
textBoxName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(243, 27);
|
||||
textBoxName.TabIndex = 2;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(184, 73);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(95, 31);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(286, 73);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormFaculty
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(391, 126);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxName);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormFaculty";
|
||||
Text = "Факультет";
|
||||
Load += FormFaculty_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
79
StudentEnrollment/StudentEnrollmentView/FormFaculty.cs
Normal file
79
StudentEnrollment/StudentEnrollmentView/FormFaculty.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormFaculty : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFacultyLogic _logic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormFaculty(ILogger<FormFaculty> logger, IFacultyLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormFaculty_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение факультета");
|
||||
var view = _logic.ReadElement(new FacultySearchModel
|
||||
{
|
||||
faculty_id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.FacultyName;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения факультета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение факультета");
|
||||
try
|
||||
{
|
||||
var model = new FacultyBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
FacultyName = textBoxName.Text,
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения факультета");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormFaculty.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormFaculty.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
130
StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs
generated
Normal file
130
StudentEnrollment/StudentEnrollmentView/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,130 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
buttonRefresh = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
факультетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
направленияToolStripMenuItem = new ToolStripMenuItem();
|
||||
студентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1088, 28);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { факультетыToolStripMenuItem, направленияToolStripMenuItem, студентыToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(882, 49);
|
||||
buttonRefresh.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(181, 43);
|
||||
buttonRefresh.TabIndex = 10;
|
||||
buttonRefresh.Text = "Обновить список";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 32);
|
||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(845, 548);
|
||||
dataGridView.TabIndex = 7;
|
||||
//
|
||||
// факультетыToolStripMenuItem
|
||||
//
|
||||
факультетыToolStripMenuItem.Name = "факультетыToolStripMenuItem";
|
||||
факультетыToolStripMenuItem.Size = new Size(224, 26);
|
||||
факультетыToolStripMenuItem.Text = "Факультеты";
|
||||
факультетыToolStripMenuItem.Click += факультетыToolStripMenuItem_Click;
|
||||
//
|
||||
// направленияToolStripMenuItem
|
||||
//
|
||||
направленияToolStripMenuItem.Name = "направленияToolStripMenuItem";
|
||||
направленияToolStripMenuItem.Size = new Size(224, 26);
|
||||
направленияToolStripMenuItem.Text = "Направления";
|
||||
направленияToolStripMenuItem.Click += направленияToolStripMenuItem_Click;
|
||||
//
|
||||
// студентыToolStripMenuItem
|
||||
//
|
||||
студентыToolStripMenuItem.Name = "студентыToolStripMenuItem";
|
||||
студентыToolStripMenuItem.Size = new Size(224, 26);
|
||||
студентыToolStripMenuItem.Text = "Студенты";
|
||||
студентыToolStripMenuItem.Click += студентыToolStripMenuItem_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1088, 587);
|
||||
Controls.Add(buttonRefresh);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "FormMain";
|
||||
Text = "Списки студентов на зачисление";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private Button buttonRefresh;
|
||||
private DataGridView dataGridView;
|
||||
private ToolStripMenuItem факультетыToolStripMenuItem;
|
||||
private ToolStripMenuItem направленияToolStripMenuItem;
|
||||
private ToolStripMenuItem студентыToolStripMenuItem;
|
||||
}
|
||||
}
|
40
StudentEnrollment/StudentEnrollmentView/FormMain.cs
Normal file
40
StudentEnrollment/StudentEnrollmentView/FormMain.cs
Normal file
@ -0,0 +1,40 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void факультетыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormFaculties));
|
||||
|
||||
if (Service is FormFaculties Form)
|
||||
{
|
||||
Form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void направленияToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormCourses));
|
||||
|
||||
if (Service is FormCourses Form)
|
||||
{
|
||||
Form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void студентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var Service = Program.ServiceProvider?.GetService(typeof(FormStudents));
|
||||
|
||||
if (Service is FormStudents Form)
|
||||
{
|
||||
Form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
StudentEnrollment/StudentEnrollmentView/FormMain.resx
Normal file
123
StudentEnrollment/StudentEnrollmentView/FormMain.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
314
StudentEnrollment/StudentEnrollmentView/FormStudent.Designer.cs
generated
Normal file
314
StudentEnrollment/StudentEnrollmentView/FormStudent.Designer.cs
generated
Normal file
@ -0,0 +1,314 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormStudent
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label2 = new Label();
|
||||
textBoxLastName = new TextBox();
|
||||
groupBox1 = new GroupBox();
|
||||
buttonRef = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
ColumnId = new DataGridViewTextBoxColumn();
|
||||
ColumnCourseName = new DataGridViewTextBoxColumn();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
label1 = new Label();
|
||||
textBoxFirstName = new TextBox();
|
||||
label3 = new Label();
|
||||
textBoxMiddleName = new TextBox();
|
||||
label4 = new Label();
|
||||
textBoxEmail = new TextBox();
|
||||
label5 = new Label();
|
||||
textBoxTIN = new TextBox();
|
||||
buttonAddPoints = new Button();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(19, 20);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(76, 20);
|
||||
label2.TabIndex = 5;
|
||||
label2.Text = "Фамилия:";
|
||||
//
|
||||
// textBoxLastName
|
||||
//
|
||||
textBoxLastName.Location = new Point(109, 16);
|
||||
textBoxLastName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxLastName.Name = "textBoxLastName";
|
||||
textBoxLastName.Size = new Size(285, 27);
|
||||
textBoxLastName.TabIndex = 4;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(buttonRef);
|
||||
groupBox1.Controls.Add(buttonDel);
|
||||
groupBox1.Controls.Add(buttonUpd);
|
||||
groupBox1.Controls.Add(buttonAdd);
|
||||
groupBox1.Controls.Add(dataGridView);
|
||||
groupBox1.Location = new Point(420, 20);
|
||||
groupBox1.Margin = new Padding(3, 4, 3, 4);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Padding = new Padding(3, 4, 3, 4);
|
||||
groupBox1.Size = new Size(341, 333);
|
||||
groupBox1.TabIndex = 8;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Направление";
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(205, 176);
|
||||
buttonRef.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(118, 37);
|
||||
buttonRef.TabIndex = 8;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += buttonRef_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(205, 131);
|
||||
buttonDel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(118, 37);
|
||||
buttonDel.TabIndex = 7;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(205, 86);
|
||||
buttonUpd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(118, 37);
|
||||
buttonUpd.TabIndex = 6;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += buttonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(205, 40);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(118, 37);
|
||||
buttonAdd.TabIndex = 5;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnId, ColumnCourseName });
|
||||
dataGridView.Location = new Point(7, 29);
|
||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(180, 290);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ColumnId
|
||||
//
|
||||
ColumnId.HeaderText = "ColumnId";
|
||||
ColumnId.MinimumWidth = 6;
|
||||
ColumnId.Name = "ColumnId";
|
||||
ColumnId.Visible = false;
|
||||
ColumnId.Width = 125;
|
||||
//
|
||||
// ColumnCourseName
|
||||
//
|
||||
ColumnCourseName.HeaderText = "Направление";
|
||||
ColumnCourseName.MinimumWidth = 6;
|
||||
ColumnCourseName.Name = "ColumnCourseName";
|
||||
ColumnCourseName.Width = 125;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(642, 368);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(119, 37);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(516, 368);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(119, 37);
|
||||
buttonSave.TabIndex = 9;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(19, 63);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(42, 20);
|
||||
label1.TabIndex = 12;
|
||||
label1.Text = "Имя:";
|
||||
//
|
||||
// textBoxFirstName
|
||||
//
|
||||
textBoxFirstName.Location = new Point(109, 59);
|
||||
textBoxFirstName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxFirstName.Name = "textBoxFirstName";
|
||||
textBoxFirstName.Size = new Size(285, 27);
|
||||
textBoxFirstName.TabIndex = 11;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.Location = new Point(16, 98);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(130, 44);
|
||||
label3.TabIndex = 14;
|
||||
label3.Text = "Отчество (при наличии):";
|
||||
//
|
||||
// textBoxMiddleName
|
||||
//
|
||||
textBoxMiddleName.Location = new Point(155, 106);
|
||||
textBoxMiddleName.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxMiddleName.Name = "textBoxMiddleName";
|
||||
textBoxMiddleName.Size = new Size(239, 27);
|
||||
textBoxMiddleName.TabIndex = 13;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(19, 159);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(54, 20);
|
||||
label4.TabIndex = 16;
|
||||
label4.Text = "Почта:";
|
||||
//
|
||||
// textBoxEmail
|
||||
//
|
||||
textBoxEmail.Location = new Point(109, 155);
|
||||
textBoxEmail.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxEmail.Name = "textBoxEmail";
|
||||
textBoxEmail.Size = new Size(285, 27);
|
||||
textBoxEmail.TabIndex = 15;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(19, 213);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(45, 20);
|
||||
label5.TabIndex = 18;
|
||||
label5.Text = "ИНН:";
|
||||
//
|
||||
// textBoxTIN
|
||||
//
|
||||
textBoxTIN.Location = new Point(109, 209);
|
||||
textBoxTIN.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxTIN.Name = "textBoxTIN";
|
||||
textBoxTIN.Size = new Size(285, 27);
|
||||
textBoxTIN.TabIndex = 17;
|
||||
//
|
||||
// buttonAddPoints
|
||||
//
|
||||
buttonAddPoints.Location = new Point(19, 368);
|
||||
buttonAddPoints.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAddPoints.Name = "buttonAddPoints";
|
||||
buttonAddPoints.Size = new Size(229, 37);
|
||||
buttonAddPoints.TabIndex = 19;
|
||||
buttonAddPoints.Text = "Добавить баллы студента";
|
||||
buttonAddPoints.UseVisualStyleBackColor = true;
|
||||
buttonAddPoints.Click += buttonAddPoints_Click;
|
||||
//
|
||||
// FormStudent
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(773, 418);
|
||||
Controls.Add(buttonAddPoints);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(textBoxTIN);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(textBoxEmail);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(textBoxMiddleName);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxFirstName);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(textBoxLastName);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormStudent";
|
||||
Text = "Студент";
|
||||
Load += FormStudent_Load;
|
||||
groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label2;
|
||||
private TextBox textBoxLastName;
|
||||
private GroupBox groupBox1;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewTextBoxColumn ColumnId;
|
||||
private DataGridViewTextBoxColumn ColumnCourseName;
|
||||
private Label label1;
|
||||
private TextBox textBoxFirstName;
|
||||
private Label label3;
|
||||
private TextBox textBoxMiddleName;
|
||||
private Label label4;
|
||||
private TextBox textBoxEmail;
|
||||
private Label label5;
|
||||
private TextBox textBoxTIN;
|
||||
private Button buttonAddPoints;
|
||||
}
|
||||
}
|
232
StudentEnrollment/StudentEnrollmentView/FormStudent.cs
Normal file
232
StudentEnrollment/StudentEnrollmentView/FormStudent.cs
Normal file
@ -0,0 +1,232 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BindingModels;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
using StudentEnrollmentContracts.SearchModels;
|
||||
using StudentEnrollmentDataModels.Models;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormStudent : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStudentLogic _logic;
|
||||
private int? _id;
|
||||
private Dictionary<int, ICourseModel> _studentCourses;
|
||||
private IExamPointsModel _examPoints;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormStudent(ILogger<FormStudent> logger, IStudentLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_studentCourses = new Dictionary<int, ICourseModel>();
|
||||
}
|
||||
|
||||
private void FormStudent_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка студента");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new StudentSearchModel
|
||||
{
|
||||
student_id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxLastName.Text = view.LastName;
|
||||
textBoxFirstName.Text = view.FirstName;
|
||||
textBoxMiddleName.Text = view.MiddleName;
|
||||
textBoxEmail.Text = view.Email;
|
||||
textBoxTIN.Text = view.TIN.ToString();
|
||||
_studentCourses = view.StudentCourse ?? new Dictionary<int, ICourseModel>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки студента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка направлений студента");
|
||||
try
|
||||
{
|
||||
if (_studentCourses != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var pc in _studentCourses)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { pc.Key, pc.Value });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки направлений студента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStudentCourse));
|
||||
if (service is FormStudentCourse form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.CourseModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Добавление нового направления:{ CourseName}", form.CourseModel.CourseName);
|
||||
if (_studentCourses.ContainsKey(form.Id))
|
||||
{
|
||||
_studentCourses[form.Id] = form.CourseModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
_studentCourses.Add(form.Id, form.CourseModel);
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStudentCourse));
|
||||
if (service is FormStudentCourse form)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.Id = id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.CourseModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Изменение направления:{ CourseName }", form.CourseModel.CourseName);
|
||||
_studentCourses[form.Id] = form.CourseModel;
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Удаление направления:{ CourseName}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||
_studentCourses?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxFirstName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните имя", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxLastName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните фамилию", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxEmail.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните почту", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxTIN.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните ИНН", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_studentCourses.Count == 0 || _studentCourses == null)
|
||||
{
|
||||
MessageBox.Show("Заполните направления", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_examPoints == null
|
||||
|| (_examPoints.FirstExamPoints == 0
|
||||
&& _examPoints.SecondExamPoints == 0
|
||||
&& _examPoints.ThirdExamPoints == 0))
|
||||
{
|
||||
MessageBox.Show("Заполните баллы студента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение студента");
|
||||
try
|
||||
{
|
||||
var model = new StudentBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
FirstName = textBoxFirstName.Text,
|
||||
LastName = textBoxLastName.Text,
|
||||
MiddleName = !string.IsNullOrEmpty(textBoxMiddleName.Text) ? textBoxMiddleName.Text : string.Empty,
|
||||
Email = textBoxEmail.Text,
|
||||
TIN = Convert.ToInt64(textBoxTIN.Text),
|
||||
StudentCourse = _studentCourses,
|
||||
ExamPointsId = _examPoints.Id,
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения цветов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void buttonAddPoints_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormExamPoints));
|
||||
if (service is FormExamPoints form)
|
||||
{
|
||||
form.Id = _id ?? 0;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_examPoints = form.ExamPoints;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
StudentEnrollment/StudentEnrollmentView/FormStudent.resx
Normal file
123
StudentEnrollment/StudentEnrollmentView/FormStudent.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnCourseName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
101
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.Designer.cs
generated
Normal file
101
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.Designer.cs
generated
Normal file
@ -0,0 +1,101 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormStudentCourse
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxCourse = new ComboBox();
|
||||
label1 = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxCourse
|
||||
//
|
||||
comboBoxCourse.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxCourse.FormattingEnabled = true;
|
||||
comboBoxCourse.Location = new Point(154, 13);
|
||||
comboBoxCourse.Margin = new Padding(3, 4, 3, 4);
|
||||
comboBoxCourse.Name = "comboBoxCourse";
|
||||
comboBoxCourse.Size = new Size(285, 28);
|
||||
comboBoxCourse.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(11, 16);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(107, 20);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "Направление:";
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(215, 58);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(98, 31);
|
||||
buttonAdd.TabIndex = 4;
|
||||
buttonAdd.Text = "Сохранить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(320, 58);
|
||||
buttonCancel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(98, 31);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormStudentCourse
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(451, 108);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxCourse);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormStudentCourse";
|
||||
Text = "Направление студента";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxCourse;
|
||||
private Label label1;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
67
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.cs
Normal file
67
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.cs
Normal file
@ -0,0 +1,67 @@
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
using StudentEnrollmentContracts.ViewModels;
|
||||
using StudentEnrollmentDataModels.Models;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormStudentCourse : Form
|
||||
{
|
||||
private readonly List<CourseViewModel>? _list;
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToInt32(comboBoxCourse.SelectedValue);
|
||||
}
|
||||
set
|
||||
{
|
||||
comboBoxCourse.SelectedValue = value;
|
||||
}
|
||||
}
|
||||
public ICourseModel? CourseModel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var elem in _list)
|
||||
{
|
||||
if (elem.Id == Id)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public FormStudentCourse(ICourseLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_list = logic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
comboBoxCourse.DisplayMember = "CourseName";
|
||||
comboBoxCourse.ValueMember = "Id";
|
||||
comboBoxCourse.DataSource = _list;
|
||||
comboBoxCourse.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxCourse.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите направление", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormStudentCourse.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
120
StudentEnrollment/StudentEnrollmentView/FormStudents.Designer.cs
generated
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormStudents.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
partial class FormStudents
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonRef = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(794, 164);
|
||||
buttonRef.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(118, 37);
|
||||
buttonRef.TabIndex = 14;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += buttonRef_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(794, 119);
|
||||
buttonDel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(118, 37);
|
||||
buttonDel.TabIndex = 13;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(794, 73);
|
||||
buttonUpd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(118, 37);
|
||||
buttonUpd.TabIndex = 12;
|
||||
buttonUpd.Text = "Изменить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += buttonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(794, 28);
|
||||
buttonAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(118, 37);
|
||||
buttonAdd.TabIndex = 11;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 13);
|
||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(747, 568);
|
||||
dataGridView.TabIndex = 10;
|
||||
//
|
||||
// FormStudents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(934, 597);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonDel);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormStudents";
|
||||
Text = "Студенты";
|
||||
Load += FormStudents_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
59
StudentEnrollment/StudentEnrollmentView/FormStudents.cs
Normal file
59
StudentEnrollment/StudentEnrollmentView/FormStudents.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
public partial class FormStudents : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStudentLogic _logic;
|
||||
public FormStudents(ILogger<FormStudents> logger, IStudentLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormStudents_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["ExamPoints"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка компонентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||
}
|
||||
}
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void buttonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void buttonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void buttonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
StudentEnrollment/StudentEnrollmentView/FormStudents.resx
Normal file
120
StudentEnrollment/StudentEnrollmentView/FormStudents.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,9 +1,19 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using StudentEnrollmentBusinessLogic;
|
||||
using StudentEnrollmentContracts.BusinessLogicContracts;
|
||||
using StudentEnrollmentContracts.StorageContracts;
|
||||
using StudentEnrollmentDatabaseImplement.Implements;
|
||||
|
||||
namespace StudentEnrollmentView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
@ -11,9 +21,37 @@ namespace StudentEnrollmentView
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
services.AddTransient<IFacultyStorage, FacultyStorage>();
|
||||
services.AddTransient<ICourseStorage, CourseStorage>();
|
||||
services.AddTransient<IStudentStorage, StudentStorage>();
|
||||
services.AddTransient<IExamPointsStorage, ExamPointsStorage>();
|
||||
|
||||
services.AddTransient<IFacultyLogic, FacultyLogic>();
|
||||
services.AddTransient<ICourseLogic, CourseLogic>();
|
||||
services.AddTransient<IStudentLogic, StudentLogic>();
|
||||
services.AddTransient<IExamPointsLogic, ExamPointsLogic>();
|
||||
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormStudent>();
|
||||
services.AddTransient<FormStudents>();
|
||||
services.AddTransient<FormStudentCourse>();
|
||||
services.AddTransient<FormExamPoints>();
|
||||
services.AddTransient<FormFaculties>();
|
||||
services.AddTransient<FormFaculty>();
|
||||
services.AddTransient<FormCourses>();
|
||||
services.AddTransient<FormCourse>();
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,21 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.18">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="NLog" Version="5.3.2" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StudentEnrollmentBusinessLogic\StudentEnrollmentBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\StudentEnrollmentContracts\StudentEnrollmentContracts.csproj" />
|
||||
<ProjectReference Include="..\StudentEnrollmentDatabaseImplement\StudentEnrollmentDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user