Commit 92b258cf authored by hasan khaddour's avatar hasan khaddour

fixxed s.

parent 3610daea
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Employees.DomainErrors
{
public class EmployeesErrors
{
public static readonly DomainError EmployeeUnExist = new("Employees.UnExist", "The Provided Credential Dosent match any employee. ");
}
}
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
using PSManagement.SharedKernel.ValueObjects; using PSManagement.SharedKernel.ValueObjects;
using System; using System;
namespace PSManagement.Domain.Projects.Entities namespace PSManagement.Domain.FinancialSpends.Entities
{ {
public class FinancialSpending: BaseEntity public class FinancialSpending : BaseEntity
{ {
public DateTime ExpectedSpendingDate { get; set; } public DateTime ExpectedSpendingDate { get; set; }
public String CostType { get; set; } public string CostType { get; set; }
public String Description { get; set; } public string Description { get; set; }
public int LocalPurchase { get; set; } public int LocalPurchase { get; set; }
public Money ExternalPurchase { get; set; } public Money ExternalPurchase { get; set; }
......
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.SharedKernel.Repositories; using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.FinincialSpending.Repositories namespace PSManagement.Domain.FinincialSpending.Repositories
......
using PSManagement.Domain.Employees.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.Domain.Projects.DomainEvents; using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.ValueObjects; using PSManagement.Domain.Projects.ValueObjects;
......
using ErrorOr; using Ardalis.Result;
using PSManagement.SharedKernel.DomainErrors; using PSManagement.SharedKernel.DomainErrors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -10,7 +10,9 @@ namespace PSManagement.Domain.Projects.DomainErrors ...@@ -10,7 +10,9 @@ namespace PSManagement.Domain.Projects.DomainErrors
{ {
public class ProjectsErrors public class ProjectsErrors
{ {
public static Error InvalidEntryError { get; } = Error.Validation("ProjectError.InvalidEntry.", "Invalid Project Data"); public static DomainError InvalidEntryError { get; } = new ("ProjectError.InvalidEntry.", "Invalid Project Data");
public static DomainError ParticipantExistError { get; } = new("ProjectError.Participant.Exist.", "the Project already have the given particpant Data");
public static DomainError ParticipantUnExistError { get; } = new("ProjectError.Participant.UnExist.", "the Project doesnt have the given particpant Data");
} }
} }
using PSManagement.SharedKernel.Events;
using System;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ParticipantAddedEvent (
int EmployeeId,
int ProjectId,
int PartialTimeRatio,
String Role
):IDomainEvent;
}
using PSManagement.SharedKernel.Events;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ParticipantRemovedEvent(
int EmployeeId,
int ProjectId
) : IDomainEvent;
}
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.SharedKernel.Events;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ProjectApprovedEvent(
int ProjectId,
Aggreement ProjectAggreement) : IDomainEvent;
}
using System; using PSManagement.SharedKernel.Events;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -6,7 +7,7 @@ using System.Threading.Tasks; ...@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.DomainEvents namespace PSManagement.Domain.Projects.DomainEvents
{ {
class ProjectCancledEvent public record ProjectCancelledEvent(
{ int ProjectId,
} DateTime CancellationTime) : IDomainEvent;
} }
...@@ -12,5 +12,16 @@ namespace PSManagement.Domain.Projects.Entities ...@@ -12,5 +12,16 @@ namespace PSManagement.Domain.Projects.Entities
public Project Project { get; set; } public Project Project { get; set; }
public int PartialTimeRatio { get; set; } public int PartialTimeRatio { get; set; }
public string Role { get; set; } public string Role { get; set; }
public EmployeeParticipate(int employeeId, int projectId, string role, int partialTimeRatio)
{
EmployeeId = employeeId;
ProjectId = projectId;
Role = role;
PartialTimeRatio = partialTimeRatio;
}
public EmployeeParticipate()
{
}
} }
} }
using PSManagement.Domain.Customers.Entities; using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Employees.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.Domain.Projects.ValueObjects; using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.ProjectsStatus.Entites; using PSManagement.Domain.ProjectsStatus.Entites;
using PSManagement.Domain.ProjectTypes.Entities; using PSManagement.Domain.ProjectTypes.Entities;
...@@ -114,22 +115,22 @@ namespace PSManagement.Domain.Projects.Entities ...@@ -114,22 +115,22 @@ namespace PSManagement.Domain.Projects.Entities
} }
public void Plan() public void Plan()
{ {
_state.Complete(this); _state.Plan(this);
} }
public void Approve() public void Approve(Aggreement projectAggreement)
{ {
_state.Complete(this); _state.Approve(this,projectAggreement);
} }
public void Cancle() public void Cancle()
{ {
_state.Complete(this); _state.Cancle(this);
} }
public void Propose() public void Propose()
{ {
_state.Complete(this); _state.Propose(this);
} }
......
using PSManagement.Domain.Employees.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.Tracking; using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities; using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate; using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities; using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -13,23 +13,27 @@ namespace PSManagement.Domain.Projects.Entities ...@@ -13,23 +13,27 @@ namespace PSManagement.Domain.Projects.Entities
{ {
public class Step : BaseEntity public class Step : BaseEntity
{ {
public string StepName { get; set; }
public string Description { get; set; } public StepInfo StepInfo { get; set; }
public int Duration { get; set; }
public int CurrentCompletionRatio { get; set; } public int CurrentCompletionRatio { get; set; }
public int Weight { get; set; } public int Weight { get; set; }
public DateTime StartDate { get; set; }
public int ProjectId { get; set; } public int ProjectId { get; set; }
public Project Project { get; set; } public Project Project { get; set; }
public ICollection<StepTrack> StepTracks { get; set; } public ICollection<StepTrack> StepTracks { get; set; }
//public ICollection<Item> Purchases { get; set; }
//public ICollection<Employee> Participants { get; set; }
public Step() public Step()
{ {
} }
public Step(StepInfo stepInfo, int projectId, int weight)
{
StepInfo = stepInfo;
ProjectId = projectId;
Weight = weight;
}
} }
} }
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories; using PSManagement.SharedKernel.Repositories;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -10,7 +13,10 @@ namespace PSManagement.Domain.Projects.Repositories ...@@ -10,7 +13,10 @@ namespace PSManagement.Domain.Projects.Repositories
{ {
public interface IProjectsRepository :IRepository<Project> public interface IProjectsRepository :IRepository<Project>
{ {
public IEnumerable<EmployeeParticipate> GetProjectParticipants(int projectId);
public IEnumerable<Step> GetProjectPlan(int projectId);
public IEnumerable<Track> GetProjectTracks(int projectId);
} }
} }
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{ {
public class CancledState : IProjectState public class CancledState : IProjectState
{ {
public string StateName => "CancledState"; public string StateName => "CancledState";
public void Approve(Project project) public void Approve(Project project, Aggreement projectAggreement)
{ {
} }
......
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{ {
public class CompletedState : IProjectState public class CompletedState : IProjectState
{ {
public string StateName => "Completed"; public string StateName => "Completed";
public void Approve(Project project) public void Approve(Project project, Aggreement projectAggreement)
{ {
} }
......
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{ {
public interface IProjectState public interface IProjectState
{ {
void Complete(Project project); void Complete(Project project);
void Plan(Project project); void Plan(Project project);
void Approve(Project project); void Approve(Project project, Aggreement projectAggreement);
void Cancle(Project project); void Cancle(Project project);
void Propose(Project project); void Propose(Project project);
string StateName { get; } string StateName { get; }
......
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.ValueObjects;
using System;
namespace PSManagement.Domain.Projects.Entities
{ {
public class InPlanState : IProjectState public class InPlanState : IProjectState
{ {
public string StateName => "InPlan"; public string StateName => "InPlan";
public void Approve(Project project) public void Approve(Project project, Aggreement projectAggreement)
{ {
project.ProjectAggreement = projectAggreement;
project.AddDomainEvent(new ProjectApprovedEvent(project.Id,projectAggreement));
project.SetState(new InProgressState()); project.SetState(new InProgressState());
} }
public void Cancle(Project project) public void Cancle(Project project)
{ {
project.AddDomainEvent(new ProjectCancelledEvent(project.Id,DateTime.Now));
project.SetState(new CancledState()); project.SetState(new CancledState());
} }
......
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.ValueObjects;
using System;
namespace PSManagement.Domain.Projects.Entities
{ {
public class InProgressState : IProjectState public class InProgressState : IProjectState
{ {
public string StateName => "InProgress"; public string StateName => "InProgress";
public void Approve(Project project) public void Approve(Project project, Aggreement projectAggreement)
{ {
} }
public void Cancle(Project project) public void Cancle(Project project)
{ {
project.AddDomainEvent(new ProjectCancelledEvent(project.Id, DateTime.Now));
project.SetState(new CancledState()); project.SetState(new CancledState());
} }
......
namespace PSManagement.Domain.Projects.Entities using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{ {
public class ProposedState : IProjectState public class ProposedState : IProjectState
{ {
public string StateName => "Proposed"; public string StateName => "Proposed";
public void Approve(Project project) public void Approve(Project project, Aggreement projectAggreement)
{ {
project.SetState(new InPlanState());
} }
public void Cancle(Project project) public void Cancle(Project project)
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
public void Propose(Project project) public void Propose(Project project)
{ {
project.SetState(new InPlanState());
} }
} }
......
using System;
namespace PSManagement.Domain.Projects.ValueObjects
{
public record StepInfo(
string StepName,
string Description,
DateTime StartDate,
int Duration
);
}
...@@ -10,6 +10,7 @@ using PSManagement.Infrastructure.Persistence.Repositories.Base; ...@@ -10,6 +10,7 @@ using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository; using PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository;
using PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository; using PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository;
using PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository; using PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository;
using PSManagement.Infrastructure.Persistence.Repositories.StepRepository;
using PSManagement.Infrastructure.Persistence.Repositories.UserRepository; using PSManagement.Infrastructure.Persistence.Repositories.UserRepository;
using PSManagement.Infrastructure.Persistence.UoW; using PSManagement.Infrastructure.Persistence.UoW;
using PSManagement.SharedKernel.Interfaces; using PSManagement.SharedKernel.Interfaces;
...@@ -31,6 +32,7 @@ namespace PSManagement.Infrastructure.Persistence.DI ...@@ -31,6 +32,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
services.AddScoped<IProjectsRepository, ProjectsRepository>(); services.AddScoped<IProjectsRepository, ProjectsRepository>();
services.AddScoped<IRolesRepository, RolesRepository>(); services.AddScoped<IRolesRepository, RolesRepository>();
services.AddScoped<IEmployeesRepository, EmployeesRespository>(); services.AddScoped<IEmployeesRepository, EmployeesRespository>();
services.AddScoped<IStepsRepository, StepsRepository>();
services.AddScoped<ProjectBuilder>(); services.AddScoped<ProjectBuilder>();
......
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.FinancialSpends.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{ {
......
...@@ -12,6 +12,15 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration ...@@ -12,6 +12,15 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.WithMany(p => p.Steps) .WithMany(p => p.Steps)
.HasForeignKey(s => s.ProjectId); .HasForeignKey(s => s.ProjectId);
builder.OwnsOne(c => c.StepInfo,
p => {
p.Property(e => e.Description).HasColumnName("Description");
p.Property(e => e.StepName).HasColumnName("StepName");
p.Property(e => e.StartDate).HasColumnName("StartDate");
p.Property(e => e.Duration).HasColumnName("Duration");
}
);
builder.HasMany(e => e.StepTracks); builder.HasMany(e => e.StepTracks);
} }
......
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class FixStepConvention : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "Steps",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<int>(
name: "Duration",
table: "Steps",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "Steps",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "Duration",
table: "Steps",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
}
}
}
...@@ -303,21 +303,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -303,21 +303,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("CurrentCompletionRatio") b.Property<int>("CurrentCompletionRatio")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId") b.Property<int>("ProjectId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int>("Weight") b.Property<int>("Weight")
.HasColumnType("int"); .HasColumnType("int");
...@@ -918,7 +906,40 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -918,7 +906,40 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.StepInfo", "StepInfo", b1 =>
{
b1.Property<int>("StepId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<int>("Duration")
.HasColumnType("int")
.HasColumnName("Duration");
b1.Property<DateTime>("StartDate")
.HasColumnType("datetime2")
.HasColumnName("StartDate");
b1.Property<string>("StepName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StepName");
b1.HasKey("StepId");
b1.ToTable("Steps");
b1.WithOwner()
.HasForeignKey("StepId");
});
b.Navigation("Project"); b.Navigation("Project");
b.Navigation("StepInfo");
}); });
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Answer", b => modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Answer", b =>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories; using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.Tracking;
using PSManagement.Infrastructure.Persistence.Repositories.Base; using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories; using PSManagement.SharedKernel.Repositories;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -15,5 +18,24 @@ namespace PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository ...@@ -15,5 +18,24 @@ namespace PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
public ProjectsRepository(AppDbContext context) : base(context) public ProjectsRepository(AppDbContext context) : base(context)
{ {
} }
public IEnumerable<EmployeeParticipate> GetProjectParticipants(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.EmployeeParticipates.AsEnumerable();
}
public IEnumerable<Step> GetProjectPlan(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.Steps.AsEnumerable();
}
public IEnumerable<Track> GetProjectTracks(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.Tracks.AsEnumerable();
}
} }
} }
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Infrastructure.Persistence.Repositories.Base;
namespace PSManagement.Infrastructure.Persistence.Repositories.StepRepository
{
public class StepsRepository : BaseRepository<Step>, IStepsRepository
{
public StepsRepository(AppDbContext context) : base(context)
{
}
}
}
...@@ -12,16 +12,13 @@ namespace PSManagement.Infrastructure.BackgroundServcies ...@@ -12,16 +12,13 @@ namespace PSManagement.Infrastructure.BackgroundServcies
{ {
public class BackgroundJobSyncEmployees: BackgroundService public class BackgroundJobSyncEmployees: BackgroundService
{ {
private readonly IDateTimeProvider _timeProvider;
private readonly IServiceScopeFactory _scopeFactory; private readonly IServiceScopeFactory _scopeFactory;
private readonly int _syncIntervalInMinutes; private readonly int _syncIntervalInMinutes;
public BackgroundJobSyncEmployees( public BackgroundJobSyncEmployees(
IDateTimeProvider timeProvider,
IOptions<EmployeesSyncJobSettings> settings, IOptions<EmployeesSyncJobSettings> settings,
IServiceScopeFactory scopeFactory) IServiceScopeFactory scopeFactory)
{ {
_timeProvider = timeProvider;
_syncIntervalInMinutes = settings.Value.SyncIntervalInMinutes; _syncIntervalInMinutes = settings.Value.SyncIntervalInMinutes;
_scopeFactory = scopeFactory; _scopeFactory = scopeFactory;
} }
...@@ -35,7 +32,7 @@ namespace PSManagement.Infrastructure.BackgroundServcies ...@@ -35,7 +32,7 @@ namespace PSManagement.Infrastructure.BackgroundServcies
try try
{ {
using (var scope = _scopeFactory.CreateScope()) using (IServiceScope scope = _scopeFactory.CreateScope())
{ {
// Resolve the scoped IEmployeesRepository // Resolve the scoped IEmployeesRepository
var dataProvider = scope.ServiceProvider.GetRequiredService<IEmployeesProvider>(); var dataProvider = scope.ServiceProvider.GetRequiredService<IEmployeesProvider>();
...@@ -47,9 +44,9 @@ namespace PSManagement.Infrastructure.BackgroundServcies ...@@ -47,9 +44,9 @@ namespace PSManagement.Infrastructure.BackgroundServcies
Console.WriteLine("A Data sync for Employees Occured At " +response.SyncDate +"\n The number of new Employees are "+response.SyncDataCount ); Console.WriteLine("A Data sync for Employees Occured At " +response.SyncDate +"\n The number of new Employees are "+response.SyncDataCount );
} }
Console.WriteLine("A Sync Employees Data End.");
} }
catch (Exception ex) catch
{ {
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -9,14 +9,15 @@ namespace PSManagement.Infrastructure.Services.Providers ...@@ -9,14 +9,15 @@ namespace PSManagement.Infrastructure.Services.Providers
{ {
public class EmployeesProvider :IEmployeesProvider public class EmployeesProvider :IEmployeesProvider
{ {
private static List<Employee> Employees = new List<Employee> private readonly static List<Employee> _employees = new()
{ {
new Employee{Availability=new Availability(0,true),PersonalInfo= new ("Hasan","Khaddour"),HIASTId=1,User = new User{UserName="Hasan@mail.hiast",Email="Hasan@mail.hiast" },WorkInfo = new WorkInfo("Researcher","Worker") },
new Employee { Availability = new Availability(0, true), PersonalInfo = new PersonalInfo("Hasan", "Khaddour"), HIASTId = 1, User = new User { UserName = "Hasan@mail.hiast", Email = "Hasan@mail.hiast" }, WorkInfo = new WorkInfo("Researcher", "Worker") }
}; };
public Task<IEnumerable<Employee>> FetchEmployees() public Task<IEnumerable<Employee>> FetchEmployees()
{ {
return Task.FromResult(Employees.AsEnumerable()); return Task.FromResult(_employees.AsEnumerable());
} }
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -23,25 +23,25 @@ namespace PSManagement.SharedKernel.Specification ...@@ -23,25 +23,25 @@ namespace PSManagement.SharedKernel.Specification
public int Skip { get; private set; } public int Skip { get; private set; }
public bool IsPagingEnabled { get; private set; } = false; public bool IsPagingEnabled { get; private set; } = false;
protected virtual void AddInclude(Expression<Func<T, object>> includeExpression) public virtual void AddInclude(Expression<Func<T, object>> includeExpression)
{ {
Includes.Add(includeExpression); Includes.Add(includeExpression);
} }
protected virtual void AddInclude(string includeString) public virtual void AddInclude(string includeString)
{ {
IncludeStrings.Add(includeString); IncludeStrings.Add(includeString);
} }
protected virtual void ApplyPaging(int skip, int take) public virtual void ApplyPaging(int skip, int take)
{ {
Skip = skip; Skip = skip;
Take = take; Take = take;
IsPagingEnabled = true; IsPagingEnabled = true;
} }
protected virtual void ApplyOrderBy(Expression<Func<T, object>> orderByExpression) public virtual void ApplyOrderBy(Expression<Func<T, object>> orderByExpression)
{ {
OrderBy = orderByExpression; OrderBy = orderByExpression;
} }
protected virtual void ApplyOrderByDescending(Expression<Func<T, object>> orderByDescendingExpression) public virtual void ApplyOrderByDescending(Expression<Func<T, object>> orderByDescendingExpression)
{ {
OrderByDescending = orderByDescendingExpression; OrderByDescending = orderByDescendingExpression;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment