diff --git a/src/SchoolManagementSystem.API/ClientApp/src/pages/SalaryPayment.js b/src/SchoolManagementSystem.API/ClientApp/src/pages/SalaryPayment.js index d60401a..32170de 100644 --- a/src/SchoolManagementSystem.API/ClientApp/src/pages/SalaryPayment.js +++ b/src/SchoolManagementSystem.API/ClientApp/src/pages/SalaryPayment.js @@ -28,6 +28,8 @@ const SalaryPayment = () => { const [courseSelected, setCourseSelected] = useState(); + const [dateSelected, setDateSelected] = useState(); + console.log(`selected ${courseSelected}`); const fixedSalaryPaymentColumns = [ @@ -123,7 +125,8 @@ const SalaryPayment = () => { { { c.Id == id); if (worker == null) diff --git a/src/SchoolManagementSystem.API/Controllers/PaymentControllers/WorkerPaymentGetSalaryPerCourse.cs b/src/SchoolManagementSystem.API/Controllers/PaymentControllers/WorkerPaymentGetSalaryPerCourse.cs index c8e8302..4c451d3 100644 --- a/src/SchoolManagementSystem.API/Controllers/PaymentControllers/WorkerPaymentGetSalaryPerCourse.cs +++ b/src/SchoolManagementSystem.API/Controllers/PaymentControllers/WorkerPaymentGetSalaryPerCourse.cs @@ -21,22 +21,23 @@ public WorkerPaymentGetSalaryPerCourseController(IDoWorkersPaymentService servic _service = service; } - [HttpGet("{id}/{date}")] - public IActionResult Get(string id,string date) + [HttpGet("{workerid}/{courseid}/{date}")] + public IActionResult Get(string workerid, string courseid, string date) { - var Date = DateTime.Parse(date); - if(date == "now") - Date = DateTime.Now; - else + System.Console.WriteLine(date); + + var Date = new DateTime(2020,03,01); + + try{ + Date = DateTime.Parse(date); + } + catch {}; - string[] ids = id.Split("$$"); - var workerid = ids[0];var courseid = ids[1]; var worker = _service.Query().SingleOrDefault(c => c.Id == workerid); if (worker == null) NotFound(); - return Ok(_service.GetWorkerPaymentInfo(workerid, Date).InfoByDate[0] .InfoByCourse .Single(c => c.CourseId == courseid) diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IBasicMeanRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IBasicMeanRepository.cs index bdbf449..c96a9ef 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IBasicMeanRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IBasicMeanRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IBasicMeanRepository : IRepository +public interface IBasicMeanRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IClassroomRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IClassroomRepository.cs index a09e943..afdb669 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IClassroomRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IClassroomRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IClassroomRepository : IRepository +public interface IClassroomRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseGroupRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseGroupRepository.cs index fd47df0..05be430 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseGroupRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseGroupRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface ICourseGroupRepository : IRepository +public interface ICourseGroupRepository : IActiveRepository { CourseGroup GetById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseRepository.cs index ffc7a28..a828235 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ICourseRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface ICourseRepository : IRepository +public interface ICourseRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IExpenseRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IExpenseRepository.cs index 61f91ca..081c93a 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IExpenseRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IExpenseRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IExpenseRepository : IRepository +public interface IExpenseRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IPositionRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IPositionRepository.cs index 26dcc48..03610a7 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IPositionRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IPositionRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IPositionRepository : IRepository +public interface IPositionRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IResourceRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IResourceRepository.cs index 58d521c..0d58257 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IResourceRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IResourceRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IResourceRepository : IRepository +public interface IResourceRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IStudentRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IStudentRepository.cs index 5849536..7db7dc1 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IStudentRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IStudentRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IStudentRepository : IRepository +public interface IStudentRepository : IActiveRepository { /// Devuelve el estudiante con ese id /// En caso de no existir devuelve null diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITeacherRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITeacherRepository.cs index fcf8e1d..3c68856 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITeacherRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITeacherRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface ITeacherRepository : IRepository +public interface ITeacherRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITuitorRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITuitorRepository.cs index 63ba09e..6a5c4c1 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITuitorRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/ITuitorRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface ITuitorRepository : IRepository +public interface ITuitorRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IWorkerRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IWorkerRepository.cs index 3710d11..596f520 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IWorkerRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IWorkerRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface IWorkerRepository : IRepository +public interface IWorkerRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IschoolMemberRepository.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IschoolMemberRepository.cs index 8cd6969..3243834 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IschoolMemberRepository.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Repositories_Interfaces/Entities/IschoolMemberRepository.cs @@ -4,7 +4,7 @@ namespace SchoolManagementSystem.Application.Repositories_Interfaces; -public interface ISchoolMemberRepository : IRepository +public interface ISchoolMemberRepository : IActiveRepository { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ActiveServices.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ActiveServices.cs new file mode 100644 index 0000000..0d23408 --- /dev/null +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ActiveServices.cs @@ -0,0 +1,30 @@ + +using SchoolManagementSystem.Domain.Interfaces; +using SchoolManagementSystem.Domain.Services; +using SchoolManagementSystem.Domain.Entities; + + +namespace SchoolManagementSystem.Application.Services_Implementations; + + + +public class ActiveService : BaseService, IActiveService where TEntity : Entity +{ + new IActiveRepository BaseRepository; + public ActiveService(IActiveRepository repository) : base(repository) + { + BaseRepository = repository; + } + + public IQueryable QueryAll() + { + var inac = BaseRepository.QueryInactives(); + var act = BaseRepository.Query(); + + + return inac.Union(act); + } + + public IQueryable QueryInactives() => BaseRepository.QueryInactives(); + +} diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/BasicMeanService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/BasicMeanService.cs index 544839c..4a928b2 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/BasicMeanService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/BasicMeanService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class BasicMeanService : BaseService, IBasicMeanService +public class BasicMeanService : ActiveService, IBasicMeanService { public BasicMeanService(IBasicMeanRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ClassroomService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ClassroomService.cs index 43ceded..0adfa59 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ClassroomService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ClassroomService.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class ClassroomService : BaseService, IClassroomService +public class ClassroomService : ActiveService, IClassroomService { public ClassroomService(IClassroomRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseGroupService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseGroupService.cs index 2eecf9f..851278e 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseGroupService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseGroupService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class CourseGroupService : BaseService, ICourseGroupService +public class CourseGroupService : ActiveService, ICourseGroupService { public CourseGroupService(ICourseGroupRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseService.cs index c9e5a2e..e6612f3 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/CourseService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class CourseService : BaseService, ICourseService +public class CourseService : ActiveService, ICourseService { public CourseService(ICourseRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ExpenseService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ExpenseService.cs index 318a9b2..2ca2ac9 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ExpenseService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ExpenseService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class ExpenseService : BaseService, IExpenseService +public class ExpenseService : ActiveService, IExpenseService { public ExpenseService(IExpenseRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/PositionService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/PositionService.cs index 91b8bdf..9597cde 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/PositionService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/PositionService.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class PositionService : BaseService, IPositionService +public class PositionService : ActiveService, IPositionService { public PositionService(IPositionRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ResourceService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ResourceService.cs index b11b7b6..cbe3d88 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ResourceService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/ResourceService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class ResourceService : BaseService, IResourceService +public class ResourceService : ActiveService, IResourceService { public ResourceService(IResourceRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/StudentService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/StudentService.cs index 4a3bb66..ee95c8e 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/StudentService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/StudentService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class StudentService : BaseService, IStudentService +public class StudentService : ActiveService, IStudentService { public StudentService(IStudentRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TeacherService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TeacherService.cs index aa2ff5c..db0ab75 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TeacherService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TeacherService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class TeacherService : BaseService, ITeacherService +public class TeacherService : ActiveService, ITeacherService { ISchoolMemberRepository schl_member_repo; public TeacherService(ISchoolMemberRepository schl_member_repo, ITeacherRepository repository) : base(repository) diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TuitorService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TuitorService.cs index b60b84d..d3d6edd 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TuitorService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/TuitorService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class TuitorService : BaseService, ITuitorService +public class TuitorService : ActiveService, ITuitorService { public TuitorService(ITuitorRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/WorkerService.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/WorkerService.cs index dc5d668..d5a10f2 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/WorkerService.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Entities/WorkerService.cs @@ -6,7 +6,7 @@ namespace SchoolManagementSystem.Application.Services_Implementations; -public class WorkerService : BaseService, IWorkerService +public class WorkerService : ActiveService, IWorkerService { public WorkerService(IWorkerRepository repository) : base(repository) { diff --git a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Payments/DoWorkersPaymentServices.cs b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Payments/DoWorkersPaymentServices.cs index 87d2571..2e07080 100644 --- a/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Payments/DoWorkersPaymentServices.cs +++ b/src/SchoolManagementSystem.Application/BusinessLogic/Services_Implementations/Payments/DoWorkersPaymentServices.cs @@ -47,7 +47,8 @@ public IRepository GetTeacherCourseRelationRepo() } public void DoPositionPayment(DateTime Date, string WorkerId) { - var _query = repoWorkerPositionR.Query().Where(c => c.WorkerId == WorkerId); + var _query = repoWorkerPositionR.Query().Where(c => c.WorkerId == WorkerId && c.StartDate < Date + && c.EndDate >= Date); foreach (var row in _query) { repoPositionPayments.Add(new WorkerPayRecordByPosition() @@ -76,7 +77,7 @@ public void DoCoursePayment(DateTime Date, string WorkerId) repoTeacherPayments.CommitAsync(); } - public WorkerPaymentInfo GetWorkerPaymentInfo(string id) + public WorkerPaymentInfo GetWorkerPaymentInfo(string id, DateTime Date) { var worker = this.Query().SingleOrDefault(c => c.Id == id); var workerPaymentInfo = new WorkerPaymentInfo @@ -85,11 +86,13 @@ public WorkerPaymentInfo GetWorkerPaymentInfo(string id) WorkerName = worker.Name, InfoByDate = new List(){new InfoByDate{ InfoByPosition = new List(), - InfoByCourse = new List() + InfoByCourse = new List(), + Date = Date }}, }; - var _query = from wPR in repoWorkerPositionR.Query().Include(c => c.Position).Where(c => c.WorkerId == id) + var _query = from wPR in repoWorkerPositionR.Query().Include(c => c.Position).Where(c => c.WorkerId == id && c.StartDate < workerPaymentInfo.InfoByDate[0].Date + && c.EndDate >= workerPaymentInfo.InfoByDate[0].Date) select new { wPR.PositionId, salary = wPR.FixedSalary, Name = wPR.Position.Name }; foreach (var row in _query) @@ -116,11 +119,14 @@ public WorkerPaymentInfo GetWorkerPaymentInfo(string id) InfoByCourseGroup = new List() }; var _querytcgr = repoTeacherCGREl.Query().Where(c => c.TeacherId == id - && c.CourseGroupCourseId == course.CourseId) + && c.CourseGroupCourseId == course.CourseId + && c.StartDate <= Date + && c.EndDate >= Date + ) .Include(c => c.CourseGroup.StudentCourseGroupRelations); foreach (var group in _querytcgr) { - var income = group.CourseGroup.StudentCourseGroupRelations.Count() * row.Course.Price; + var income = group.CourseGroup.StudentCourseGroupRelations.Where(c => c.StartDate <= info.Date && c.EndDate >= info.Date).Count() * row.Course.Price; course.InfoByCourseGroup.Add(new InfoByCourseGroup() { CourseGroupId = group.CourseGroup.Id diff --git a/src/SchoolManagementSystem.Domain/Entities/CourseGroup.cs b/src/SchoolManagementSystem.Domain/Entities/CourseGroup.cs index 9a0ac59..badb5d9 100755 --- a/src/SchoolManagementSystem.Domain/Entities/CourseGroup.cs +++ b/src/SchoolManagementSystem.Domain/Entities/CourseGroup.cs @@ -13,7 +13,7 @@ public class CourseGroup : Entity public Teacher Teacher{ get; set; } public int Capacity { get; set; } public DateTime StartDate { get; set; } //= DateTime.Now(); - public DateTime EndDate { get; set; } + public DateTime EndDate { get; set; } = DateTime.MaxValue; public IList StudentCourseGroupRelations { get; set; } // public IList Teachers { get; set; } public IList TeacherCourseGroupRelations { get; set; } diff --git a/src/SchoolManagementSystem.Domain/Entities/Entity.cs b/src/SchoolManagementSystem.Domain/Entities/Entity.cs index 1af5319..0a89c25 100644 --- a/src/SchoolManagementSystem.Domain/Entities/Entity.cs +++ b/src/SchoolManagementSystem.Domain/Entities/Entity.cs @@ -6,4 +6,6 @@ namespace SchoolManagementSystem.Domain.Entities; public class Entity : Identifiable { public virtual string Id { get; set; } = Guid.NewGuid().ToString(); + public bool Active {get; set;} = true; + } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Entities/Position.cs b/src/SchoolManagementSystem.Domain/Entities/Position.cs index 8f6f7ff..3d939c2 100644 --- a/src/SchoolManagementSystem.Domain/Entities/Position.cs +++ b/src/SchoolManagementSystem.Domain/Entities/Position.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations; +using SchoolManagementSystem.Domain.Entities; +using SchoolManagementSystem.Domain.Relations; namespace SchoolManagementSystem.Domain.Entities; @@ -11,6 +13,7 @@ public class Position : Entity // [Required] public IList Workers { get; set; } + public IList WorkerPositionRelations { get; set; } public override string ToString() { diff --git a/src/SchoolManagementSystem.Domain/Entities/Worker.cs b/src/SchoolManagementSystem.Domain/Entities/Worker.cs index c2289a7..846b8e5 100755 --- a/src/SchoolManagementSystem.Domain/Entities/Worker.cs +++ b/src/SchoolManagementSystem.Domain/Entities/Worker.cs @@ -1,5 +1,7 @@  using System.ComponentModel.DataAnnotations; +using SchoolManagementSystem.Domain.Entities; +using SchoolManagementSystem.Domain.Relations; namespace SchoolManagementSystem.Domain.Entities; @@ -9,6 +11,7 @@ public class Worker : SchoolMember public IList Services { get; set; } public IList Positions { get; set; } + public IList WorkerPositionRelations { get; set; } public IList AdditionalServices { get; set; } } diff --git a/src/SchoolManagementSystem.Domain/Interfaces/IActiveRepository.cs b/src/SchoolManagementSystem.Domain/Interfaces/IActiveRepository.cs new file mode 100644 index 0000000..e876625 --- /dev/null +++ b/src/SchoolManagementSystem.Domain/Interfaces/IActiveRepository.cs @@ -0,0 +1,9 @@ + +using SchoolManagementSystem.Domain.Entities; + +namespace SchoolManagementSystem.Domain.Interfaces; + +public interface IActiveRepository : IRepository where TEntity : Entity +{ + IQueryable QueryInactives(); +} diff --git a/src/SchoolManagementSystem.Domain/Relations/StudentCourseGroupRelation.cs b/src/SchoolManagementSystem.Domain/Relations/StudentCourseGroupRelation.cs index 738b146..2d59d4b 100755 --- a/src/SchoolManagementSystem.Domain/Relations/StudentCourseGroupRelation.cs +++ b/src/SchoolManagementSystem.Domain/Relations/StudentCourseGroupRelation.cs @@ -20,6 +20,6 @@ public class StudentCourseGroupRelation public DateTime StartDate{ get; set; } - public DateTime EndDate{ get; set; } + public DateTime EndDate{ get; set; } = DateTime.MaxValue; } } diff --git a/src/SchoolManagementSystem.Domain/Relations/TeacherCourseGroupRelation.cs b/src/SchoolManagementSystem.Domain/Relations/TeacherCourseGroupRelation.cs index c61b2eb..9f81488 100755 --- a/src/SchoolManagementSystem.Domain/Relations/TeacherCourseGroupRelation.cs +++ b/src/SchoolManagementSystem.Domain/Relations/TeacherCourseGroupRelation.cs @@ -11,6 +11,6 @@ public class TeacherCourseGroupRelation public string CourseGroupCourseId { get; set; } public CourseGroup CourseGroup { get; set; } public DateTime StartDate{ get; set; } - public DateTime EndDate{ get; set; } + public DateTime EndDate{ get; set; } = DateTime.MaxValue; } } diff --git a/src/SchoolManagementSystem.Domain/Relations/WorkerPositionRelation.cs b/src/SchoolManagementSystem.Domain/Relations/WorkerPositionRelation.cs index 1297ed7..32a6576 100644 --- a/src/SchoolManagementSystem.Domain/Relations/WorkerPositionRelation.cs +++ b/src/SchoolManagementSystem.Domain/Relations/WorkerPositionRelation.cs @@ -11,5 +11,7 @@ public class WorkerPositionRelation public Worker Worker { get; set; } public string PositionId { get; set; } public Position Position { get; set; } + public DateTime StartDate{get; set;} + public DateTime EndDate{get; set;} = DateTime.MaxValue; public int FixedSalary { get; set; } } diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IActiveService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IActiveService.cs new file mode 100644 index 0000000..7c18961 --- /dev/null +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IActiveService.cs @@ -0,0 +1,9 @@ +using SchoolManagementSystem.Domain.Entities; +using SchoolManagementSystem.Domain.Interfaces; + +namespace SchoolManagementSystem.Domain.Services; + +public interface IActiveService : IService where TEntity : Entity +{ + IQueryable QueryInactives(); +} diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IBasicMeanService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IBasicMeanService.cs index dbc4a44..2d3f7b8 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IBasicMeanService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IBasicMeanService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IBasicMeanService : IService +public interface IBasicMeanService : IActiveService { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IClassroomService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IClassroomService.cs index 95d02b2..310794c 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IClassroomService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IClassroomService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IClassroomService : IService +public interface IClassroomService : IActiveService { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/ICourseGroupService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/ICourseGroupService.cs index db121b7..3265b43 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/ICourseGroupService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/ICourseGroupService.cs @@ -3,9 +3,9 @@ namespace SchoolManagementSystem.Domain.Services; -public interface ICourseGroupService : IService +public interface ICourseGroupService : IActiveService { // Selecciona un CourseGroup con cierto id - // y toma toda su información + // y toma toda su informaci�n CourseGroup GetCourseGroupById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/ICourseService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/ICourseService.cs index 276ce90..3594e93 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/ICourseService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/ICourseService.cs @@ -3,9 +3,9 @@ namespace SchoolManagementSystem.Domain.Services; -public interface ICourseService : IService +public interface ICourseService : IActiveService { // Selecciona un curso con cierto id - // y toma toda su información + // y toma toda su informaci�n Course GetCourseById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IExpenseService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IExpenseService.cs index 37fb0f5..3a6e5ab 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IExpenseService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IExpenseService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IExpenseService : IService +public interface IExpenseService : IActiveService { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IPositionService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IPositionService.cs index ebb2d97..c3f4865 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IPositionService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IPositionService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IPositionService : IService +public interface IPositionService : IActiveService { } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IResourseService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IResourseService.cs index e11f7a2..e55a92d 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IResourseService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IResourseService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IResourceService : IService +public interface IResourceService : IActiveService { // Selecciona un recurso con cierto id // y toma toda su informaci�n diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IStudentService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IStudentService.cs index caeb9fc..035c807 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IStudentService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IStudentService.cs @@ -3,9 +3,9 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IStudentService : IService +public interface IStudentService : IActiveService { // Selecciona a un estudiante con cierto id - // y toma toda su información + // y toma toda su informaci�n Student GetStudentById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/ITeacherService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/ITeacherService.cs index 6b0a8bb..592248e 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/ITeacherService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/ITeacherService.cs @@ -3,7 +3,7 @@ namespace SchoolManagementSystem.Domain.Services; -public interface ITeacherService : IService +public interface ITeacherService : IActiveService { // Selecciona a un profesor con cierto id // y toma toda su informaci�n diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/ITuitorService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/ITuitorService.cs index 4c9fa4e..218bebc 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/ITuitorService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/ITuitorService.cs @@ -3,9 +3,9 @@ namespace SchoolManagementSystem.Domain.Services; -public interface ITuitorService : IService +public interface ITuitorService : IActiveService { // Selecciona a un tutor con cierto id - // y toma toda su información + // y toma toda su informaci�n Tuitor GetTuitorById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Entities/IWorkerService.cs b/src/SchoolManagementSystem.Domain/Services/Entities/IWorkerService.cs index bfbbe01..7b710fb 100644 --- a/src/SchoolManagementSystem.Domain/Services/Entities/IWorkerService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Entities/IWorkerService.cs @@ -3,9 +3,9 @@ namespace SchoolManagementSystem.Domain.Services; -public interface IWorkerService : IService +public interface IWorkerService : IActiveService { // Selecciona al trabajador con cierto id - // y toma toda su información + // y toma toda su informaci�n Worker GetWorkerById(string id); } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Domain/Services/Payments/IDoWorkersPaymentService.cs b/src/SchoolManagementSystem.Domain/Services/Payments/IDoWorkersPaymentService.cs index 44dbec8..f76d9bc 100644 --- a/src/SchoolManagementSystem.Domain/Services/Payments/IDoWorkersPaymentService.cs +++ b/src/SchoolManagementSystem.Domain/Services/Payments/IDoWorkersPaymentService.cs @@ -17,7 +17,7 @@ public interface IDoWorkersPaymentService : IRecordService public IRepository GetWorkerPositionRelationRepo(); public void DoPositionPayment(DateTime Date, string WorkerId); public void DoCoursePayment(DateTime Date, string WorkerId); - public WorkerPaymentInfo GetWorkerPaymentInfo(string id); + public WorkerPaymentInfo GetWorkerPaymentInfo(string id, DateTime Date); // public IRepository GetStudentCourseGroupRelationRepo(string id); // public IQueryable GetWorkerCoursePorcentualSalaries(string id); // public IQueryable GetWorkerFixSalaries(string id); diff --git a/src/SchoolManagementSystem.Infrastructure/Configurations/Entities/WorkerConfiguration.cs b/src/SchoolManagementSystem.Infrastructure/Configurations/Entities/WorkerConfiguration.cs index 2e7b07c..9cfbc7d 100644 --- a/src/SchoolManagementSystem.Infrastructure/Configurations/Entities/WorkerConfiguration.cs +++ b/src/SchoolManagementSystem.Infrastructure/Configurations/Entities/WorkerConfiguration.cs @@ -25,7 +25,7 @@ public void Configure(EntityTypeBuilder builder) j => { j.Property(pt => pt.FixedSalary); - j.HasKey(t => new { t.WorkerId, t.PositionId }); + j.HasKey(t => new { t.WorkerId, t.PositionId, t.StartDate}); }); } } \ No newline at end of file diff --git a/src/SchoolManagementSystem.Infrastructure/Data/IdentityContext.cs b/src/SchoolManagementSystem.Infrastructure/Data/IdentityContext.cs index ba93ca1..862cd74 100644 --- a/src/SchoolManagementSystem.Infrastructure/Data/IdentityContext.cs +++ b/src/SchoolManagementSystem.Infrastructure/Data/IdentityContext.cs @@ -20,7 +20,9 @@ protected override void OnModelCreating(ModelBuilder builder) } private void SeedUsers(ModelBuilder builder) - { + { + PasswordHasher passwordHasher = new PasswordHasher(); + IdentityUser user = new IdentityUser() { Id = "8ae7e3b7-0e7a-46c0-957b-394f5a92d858", diff --git a/src/SchoolManagementSystem.Infrastructure/Data/IdentityInitializer.cs b/src/SchoolManagementSystem.Infrastructure/Data/IdentityInitializer.cs new file mode 100644 index 0000000..e69de29 diff --git a/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs b/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs index 8bb8570..98e690d 100644 --- a/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs +++ b/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs @@ -11,6 +11,7 @@ public static class SchoolInitializer { #region Entities for add to other entities + static Teacher carmen = new Teacher{ Name = "Carmen", LastName = "Gonzalez", @@ -31,6 +32,8 @@ public static class SchoolInitializer Name = "Frank", PhoneNumber = 57881239, }; + + #region Students static Student sasha = new Student{ Name = "Sasha", LastName = "hernand", @@ -86,7 +89,10 @@ public static class SchoolInitializer ScholarityLevel = Domain.Enums.Education.Preuniversitario, Tuitor = frank }; + + #endregion + #region Positions static Position director = new Position{ Name = "director" }; @@ -96,7 +102,9 @@ public static class SchoolInitializer static Position asistente = new Position{ Name = "asistente" }; + #endregion + #region Courses static Course algebra = new Course{ Name = "Algebra", Price = 200, @@ -117,14 +125,16 @@ public static class SchoolInitializer Price = 200, Type = "Letras" }; + #endregion + #region CourseGroups static CourseGroup algebralineal = new CourseGroup{ Name = "AlgebraLineal", Course = algebra, Teacher = juan, CourseId = algebra.Id, Capacity = 30, - StartDate = new DateTime(2020,07,01), + StartDate = new DateTime(2020,01,01), EndDate = new DateTime(2020,09,20), }; static CourseGroup algebra2 = new CourseGroup{ @@ -133,7 +143,7 @@ public static class SchoolInitializer CourseId = algebra.Id, Teacher = juan, Capacity = 30, - StartDate = new DateTime(2020,10,02), + StartDate = new DateTime(2020,01,02), EndDate = new DateTime(2020,12,02), }; static CourseGroup geometriaespacial = new CourseGroup{ @@ -141,8 +151,8 @@ public static class SchoolInitializer Course = geometria, CourseId = geometria.Id, Capacity = 20, - StartDate = new DateTime(2021,03,01), - EndDate = new DateTime(2021,05,20), + StartDate = new DateTime(2020,01,01), + EndDate = new DateTime(2020,05,20), }; static CourseGroup historiaDelArte = new CourseGroup{ Name = "historiaDA", @@ -150,9 +160,11 @@ public static class SchoolInitializer Teacher = carmen, CourseId = historia.Id, Capacity = 30, - StartDate = new DateTime(2022,01,01), - EndDate = new DateTime(2020,04,09), + StartDate = new DateTime(2020,01,01), + EndDate = new DateTime(2020,11,09), }; + + #endregion #endregion public static void Initialize(SchoolContext context) @@ -326,6 +338,8 @@ public static void Initialize(SchoolContext context) } #region Seed Database + + #region Entitites private static AdditionalService[] GetAdditionalServices() { return new AdditionalService[] @@ -552,6 +566,10 @@ private static Worker[] GetWorkers() }; } + #endregion + + #region Records + private static ExpenseRecord[] GetExpenseRecords() { return new ExpenseRecord[]{ @@ -701,6 +719,10 @@ private static TeacherPayRecordPerCourse[] GetTeacherPayRecordPerCourses() }; } + #endregion + + #region Relations + private static StudentCourseGroupRelation[] GetStudentCourseGroupRelations() { var courseGroup = new CourseGroup @@ -938,26 +960,31 @@ private static WorkerPositionRelation[] GetWorkerPositionRelations() PhoneNumber = 52813412, Address = "Espada No.404 e/ San Benito y Esperanza", DateBecomedMember = new DateTime(2015, 9, 5) }, - FixedSalary = 2000 + FixedSalary = 2000, + StartDate = new DateTime(2015, 9, 5), }, new WorkerPositionRelation{ Position = director, Worker = carmen, - FixedSalary = 5000 + FixedSalary = 5000, + StartDate = carmen.DateBecomedMember }, new WorkerPositionRelation{ Position = asistente, Worker = juan, - FixedSalary = 3000 + FixedSalary = 3000, + StartDate = juan.DateBecomedMember }, new WorkerPositionRelation{ Position = secretaria, Worker = carmen, - FixedSalary = 2000 + FixedSalary = 2000, + StartDate = carmen.DateBecomedMember }, }; } + #endregion #endregion } diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ActiveRepositorys.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ActiveRepositorys.cs new file mode 100644 index 0000000..660dcdb --- /dev/null +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ActiveRepositorys.cs @@ -0,0 +1,23 @@ +using SchoolManagementSystem.Domain.Entities; +using SchoolManagementSystem.Domain.Interfaces; +using SchoolManagementSystem.Infrastructure.Data; +using SchoolManagementSystem.Application.Repositories_Interfaces; + +namespace SchoolManagementSystem.Infrastructure.Repositories; + +public class ActiveRepository : CrudRepository where TEntity : Entity +{ + public ActiveRepository(IObjectContext context) : base(context) + { + + } + public override IQueryable Query() + { + return base.Query().Where(c => c.Active == true); + } + public IQueryable QueryInactives() + { + return base.Query().Where(c => c.Active == false); + } + +} \ No newline at end of file diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/BasicMeanRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/BasicMeanRepository.cs index a55140c..cf78d43 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/BasicMeanRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/BasicMeanRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class BasicMeanRepository : CrudRepository, IBasicMeanRepository +public class BasicMeanRepository : ActiveRepository, IBasicMeanRepository { public BasicMeanRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ClassroomRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ClassroomRepository.cs index 24ff215..1fad24a 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ClassroomRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ClassroomRepository.cs @@ -7,7 +7,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class ClassroomRepository : CrudRepository, IClassroomRepository +public class ClassroomRepository : ActiveRepository, IClassroomRepository { public ClassroomRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseGroupRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseGroupRepository.cs index e968706..0d77719 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseGroupRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseGroupRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class CourseGroupRepository : CrudRepository, ICourseGroupRepository +public class CourseGroupRepository : ActiveRepository, ICourseGroupRepository { public CourseGroupRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseRepository.cs index 4712d5b..5840f03 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CourseRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class CourseRepository : CrudRepository, ICourseRepository +public class CourseRepository : ActiveRepository, ICourseRepository { public CourseRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CrudRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CrudRepository.cs index 85ecf0f..4dc9f05 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CrudRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/CrudRepository.cs @@ -11,7 +11,7 @@ public CrudRepository(IObjectContext context) public IObjectContext Context { get; } - public IQueryable Query() => Context.Query(); + public virtual IQueryable Query() => Context.Query(); public void Add(TEntity entity) => Context.Add(entity); diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ExpenseRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ExpenseRepository.cs index 96a45c3..1a0da68 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ExpenseRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ExpenseRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class ExpenseRepository : CrudRepository, IExpenseRepository +public class ExpenseRepository : ActiveRepository, IExpenseRepository { public ExpenseRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/PositionRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/PositionRepository.cs index a676738..2d64243 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/PositionRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/PositionRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class PositionRepository : CrudRepository, IPositionRepository +public class PositionRepository : ActiveRepository, IPositionRepository { public PositionRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ResourceRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ResourceRepository.cs index 18437b4..4e6e6c6 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ResourceRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/ResourceRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class ResourceRepository : CrudRepository, IResourceRepository +public class ResourceRepository : ActiveRepository, IResourceRepository { public ResourceRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/SchoolMemberRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/SchoolMemberRepository.cs index 6c341b6..fb1026d 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/SchoolMemberRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/SchoolMemberRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class SchoolMemberRepository : CrudRepository, ISchoolMemberRepository +public class SchoolMemberRepository : ActiveRepository, ISchoolMemberRepository { public SchoolMemberRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/StudentRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/StudentRepository.cs index dd707ce..9fab6d0 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/StudentRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/StudentRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class StudentRepository : CrudRepository, IStudentRepository +public class StudentRepository : ActiveRepository, IStudentRepository { public StudentRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TeacherRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TeacherRepository.cs index 4fc066e..19a119e 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TeacherRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TeacherRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class TeacherRepository : CrudRepository, ITeacherRepository +public class TeacherRepository : ActiveRepository, ITeacherRepository { public TeacherRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TuitorRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TuitorRepository.cs index a6dab35..d71b671 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TuitorRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/TuitorRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class TuitorRepository : CrudRepository, ITuitorRepository +public class TuitorRepository : ActiveRepository, ITuitorRepository { public TuitorRepository(IObjectContext context) : base(context) { diff --git a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/WorkerRepository.cs b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/WorkerRepository.cs index 1062657..1f5fc67 100644 --- a/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/WorkerRepository.cs +++ b/src/SchoolManagementSystem.Infrastructure/Repositories/Entities/WorkerRepository.cs @@ -5,7 +5,7 @@ namespace SchoolManagementSystem.Infrastructure.Repositories; -public class WorkerRepository : CrudRepository, IWorkerRepository +public class WorkerRepository : ActiveRepository, IWorkerRepository { public WorkerRepository(IObjectContext context) : base(context) {