Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
92b258cf
Commit
92b258cf
authored
Aug 13, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixxed s.
parent
3610daea
Changes
34
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1425 additions
and
64 deletions
+1425
-64
EmployeesErrors.cs
...nagement.Domain/Employees/DomainErrors/EmployeesErrors.cs
+15
-0
FinancialSpending.cs
...ment.Domain/FinancialSpends/Entities/FinancialSpending.cs
+4
-4
IFinancialSpendingRepository.cs
...ancialSpends/Repositories/IFinancialSpendingRepository.cs
+1
-1
ProjectBuilder.cs
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
+1
-0
ProjectsErrors.cs
PSManagement.Domain/Projects/DomainErrors/ProjectsErrors.cs
+4
-2
ParticipantAddedEvent.cs
...ent.Domain/Projects/DomainEvents/ParticipantAddedEvent.cs
+12
-0
ParticipantRemovedEvent.cs
...t.Domain/Projects/DomainEvents/ParticipantRemovedEvent.cs
+9
-0
ProjectApprovedEvent.cs
...ment.Domain/Projects/DomainEvents/ProjectApprovedEvent.cs
+9
-0
ProjectCancelledEvent.cs
...ent.Domain/Projects/DomainEvents/ProjectCancelledEvent.cs
+13
-0
EmployeeParticipate.cs
PSManagement.Domain/Projects/Entities/EmployeeParticipate.cs
+11
-0
Project.cs
PSManagement.Domain/Projects/Entities/Project.cs
+6
-5
Step.cs
PSManagement.Domain/Projects/Entities/Step.cs
+11
-7
IProjectsRepository.cs
...ement.Domain/Projects/Repositories/IProjectsRepository.cs
+8
-2
CancledState.cs
PSManagement.Domain/Projects/States/CancledState.cs
+4
-2
CompletedState.cs
PSManagement.Domain/Projects/States/CompletedState.cs
+4
-2
IProjectState.cs
PSManagement.Domain/Projects/States/IProjectState.cs
+4
-2
InPlanState.cs
PSManagement.Domain/Projects/States/InPlanState.cs
+10
-2
InProgressState.cs
PSManagement.Domain/Projects/States/InProgressState.cs
+7
-2
ProposedState.cs
PSManagement.Domain/Projects/States/ProposedState.cs
+6
-4
StepInfo.cs
PSManagement.Domain/Projects/ValueObjects/StepInfo.cs
+12
-0
DependencyInjection.cs
...ment.Infrastructure.Persistence/DI/DependencyInjection.cs
+2
-0
FinicialSpendingEntityConfiguration.cs
...itiesConfiguration/FinicialSpendingEntityConfiguration.cs
+1
-1
StepEntityConfiguration.cs
...sistence/EntitiesConfiguration/StepEntityConfiguration.cs
+9
-0
20240813073337_FixStepConvention.Designer.cs
...e/Migrations/20240813073337_FixStepConvention.Designer.cs
+1126
-0
20240813073337_FixStepConvention.cs
...ersistence/Migrations/20240813073337_FixStepConvention.cs
+50
-0
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+33
-12
PSManagement.Infrastructure.Persistence.csproj
...ersistence/PSManagement.Infrastructure.Persistence.csproj
+1
-0
ProjectsRepository.cs
...ence/Repositories/ProjectRepository/ProjectsRepository.cs
+23
-1
StepsRepository.cs
...ersistence/Repositories/StepRepository/StepsRepository.cs
+14
-0
BackgroundJobSyncEmployees.cs
...tructure/BackgroundServcies/BackgroundJobSyncEmployees.cs
+3
-6
PSManagement.Infrastructure.Services.csproj
...nfrastructure/PSManagement.Infrastructure.Services.csproj
+1
-0
EmployeesProvider.cs
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
+5
-4
PSManagement.Presentation.csproj
PSManagement.Presentation/PSManagement.Presentation.csproj
+1
-0
BaseSpecification.cs
PSManagement.SharedKernel/Specification/BaseSpecification.cs
+5
-5
No files found.
PSManagement.Domain/Employees/DomainErrors/EmployeesErrors.cs
0 → 100644
View file @
92b258cf
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. "
);
}
}
PSManagement.Domain/FinancialSpend
ing
/Entities/FinancialSpending.cs
→
PSManagement.Domain/FinancialSpend
s
/Entities/FinancialSpending.cs
View file @
92b258cf
...
...
@@ -2,13 +2,13 @@
using
PSManagement.SharedKernel.ValueObjects
;
using
System
;
namespace
PSManagement.Domain.
Project
s.Entities
namespace
PSManagement.Domain.
FinancialSpend
s.Entities
{
public
class
FinancialSpending
:
BaseEntity
public
class
FinancialSpending
:
BaseEntity
{
public
DateTime
ExpectedSpendingDate
{
get
;
set
;
}
public
S
tring
CostType
{
get
;
set
;
}
public
S
tring
Description
{
get
;
set
;
}
public
s
tring
CostType
{
get
;
set
;
}
public
s
tring
Description
{
get
;
set
;
}
public
int
LocalPurchase
{
get
;
set
;
}
public
Money
ExternalPurchase
{
get
;
set
;
}
...
...
PSManagement.Domain/FinancialSpend
ing
/Repositories/IFinancialSpendingRepository.cs
→
PSManagement.Domain/FinancialSpend
s
/Repositories/IFinancialSpendingRepository.cs
View file @
92b258cf
using
PSManagement.Domain.
Project
s.Entities
;
using
PSManagement.Domain.
FinancialSpend
s.Entities
;
using
PSManagement.SharedKernel.Repositories
;
namespace
PSManagement.Domain.FinincialSpending.Repositories
...
...
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
View file @
92b258cf
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.FinancialSpends.Entities
;
using
PSManagement.Domain.Projects.DomainEvents
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Projects.ValueObjects
;
...
...
PSManagement.Domain/Projects/DomainErrors/ProjectsErrors.cs
View file @
92b258cf
using
ErrorOr
;
using
Ardalis.Result
;
using
PSManagement.SharedKernel.DomainErrors
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -10,7 +10,9 @@ namespace PSManagement.Domain.Projects.DomainErrors
{
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"
);
}
}
PSManagement.Domain/Projects/DomainEvents/ParticipantAddedEvent.cs
0 → 100644
View file @
92b258cf
using
PSManagement.SharedKernel.Events
;
using
System
;
namespace
PSManagement.Domain.Projects.DomainEvents
{
public
record
ParticipantAddedEvent
(
int
EmployeeId
,
int
ProjectId
,
int
PartialTimeRatio
,
String
Role
):
IDomainEvent
;
}
PSManagement.Domain/Projects/DomainEvents/ParticipantRemovedEvent.cs
0 → 100644
View file @
92b258cf
using
PSManagement.SharedKernel.Events
;
namespace
PSManagement.Domain.Projects.DomainEvents
{
public
record
ParticipantRemovedEvent
(
int
EmployeeId
,
int
ProjectId
)
:
IDomainEvent
;
}
PSManagement.Domain/Projects/DomainEvents/ProjectApprovedEvent.cs
0 → 100644
View file @
92b258cf
using
PSManagement.Domain.Projects.ValueObjects
;
using
PSManagement.SharedKernel.Events
;
namespace
PSManagement.Domain.Projects.DomainEvents
{
public
record
ProjectApprovedEvent
(
int
ProjectId
,
Aggreement
ProjectAggreement
)
:
IDomainEvent
;
}
PSManagement.Domain/Projects/DomainEvents/ProjectCancledEvent.cs
→
PSManagement.Domain/Projects/DomainEvents/ProjectCanc
el
ledEvent.cs
View file @
92b258cf
using
System
;
using
PSManagement.SharedKernel.Events
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace
PSManagement.Domain.Projects.DomainEvents
{
class
ProjectCancledEvent
{
}
public
record
ProjectCancelledEvent
(
int
ProjectId
,
DateTime
CancellationTime
)
:
IDomainEvent
;
}
PSManagement.Domain/Projects/Entities/EmployeeParticipate.cs
View file @
92b258cf
...
...
@@ -12,5 +12,16 @@ namespace PSManagement.Domain.Projects.Entities
public
Project
Project
{
get
;
set
;
}
public
int
PartialTimeRatio
{
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
()
{
}
}
}
PSManagement.Domain/Projects/Entities/Project.cs
View file @
92b258cf
using
PSManagement.Domain.Customers.Entities
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.FinancialSpends.Entities
;
using
PSManagement.Domain.Projects.ValueObjects
;
using
PSManagement.Domain.ProjectsStatus.Entites
;
using
PSManagement.Domain.ProjectTypes.Entities
;
...
...
@@ -114,22 +115,22 @@ namespace PSManagement.Domain.Projects.Entities
}
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
()
{
_state
.
C
omplet
e
(
this
);
_state
.
C
ancl
e
(
this
);
}
public
void
Propose
()
{
_state
.
Complet
e
(
this
);
_state
.
Propos
e
(
this
);
}
...
...
PSManagement.Domain/Projects/Entities/Step.cs
View file @
92b258cf
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Projects.ValueObjects
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.Domain.Tracking.Entities
;
using
PSManagement.SharedKernel.Aggregate
;
using
PSManagement.SharedKernel.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -13,23 +13,27 @@ namespace PSManagement.Domain.Projects.Entities
{
public
class
Step
:
BaseEntity
{
public
string
StepName
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
public
int
Duration
{
get
;
set
;
}
public
StepInfo
StepInfo
{
get
;
set
;
}
public
int
CurrentCompletionRatio
{
get
;
set
;
}
public
int
Weight
{
get
;
set
;
}
public
DateTime
StartDate
{
get
;
set
;
}
public
int
ProjectId
{
get
;
set
;
}
public
Project
Project
{
get
;
set
;
}
public
ICollection
<
StepTrack
>
StepTracks
{
get
;
set
;
}
//public ICollection<Item> Purchases { get; set; }
//public ICollection<Employee> Participants { get; set; }
public
Step
()
{
}
public
Step
(
StepInfo
stepInfo
,
int
projectId
,
int
weight
)
{
StepInfo
=
stepInfo
;
ProjectId
=
projectId
;
Weight
=
weight
;
}
}
}
PSManagement.Domain/Projects/Repositories/IProjectsRepository.cs
View file @
92b258cf
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
System
;
using
System.Collections.Generic
;
...
...
@@ -10,6 +13,9 @@ namespace PSManagement.Domain.Projects.Repositories
{
public
interface
IProjectsRepository
:
IRepository
<
Project
>
{
public
IEnumerable
<
EmployeeParticipate
>
GetProjectParticipants
(
int
projectId
);
public
IEnumerable
<
Step
>
GetProjectPlan
(
int
projectId
);
public
IEnumerable
<
Track
>
GetProjectTracks
(
int
projectId
);
}
...
...
PSManagement.Domain/Projects/States/CancledState.cs
View file @
92b258cf
namespace
PSManagement.Domain.Projects.Entities
using
PSManagement.Domain.Projects.ValueObjects
;
namespace
PSManagement.Domain.Projects.Entities
{
public
class
CancledState
:
IProjectState
{
public
string
StateName
=>
"CancledState"
;
public
void
Approve
(
Project
project
)
public
void
Approve
(
Project
project
,
Aggreement
projectAggreement
)
{
}
...
...
PSManagement.Domain/Projects/States/CompletedState.cs
View file @
92b258cf
namespace
PSManagement.Domain.Projects.Entities
using
PSManagement.Domain.Projects.ValueObjects
;
namespace
PSManagement.Domain.Projects.Entities
{
public
class
CompletedState
:
IProjectState
{
public
string
StateName
=>
"Completed"
;
public
void
Approve
(
Project
project
)
public
void
Approve
(
Project
project
,
Aggreement
projectAggreement
)
{
}
...
...
PSManagement.Domain/Projects/States/IProjectState.cs
View file @
92b258cf
namespace
PSManagement.Domain.Projects.Entities
using
PSManagement.Domain.Projects.ValueObjects
;
namespace
PSManagement.Domain.Projects.Entities
{
public
interface
IProjectState
{
void
Complete
(
Project
project
);
void
Plan
(
Project
project
);
void
Approve
(
Project
project
);
void
Approve
(
Project
project
,
Aggreement
projectAggreement
);
void
Cancle
(
Project
project
);
void
Propose
(
Project
project
);
string
StateName
{
get
;
}
...
...
PSManagement.Domain/Projects/States/InPlanState.cs
View file @
92b258cf
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
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
());
}
public
void
Cancle
(
Project
project
)
{
project
.
AddDomainEvent
(
new
ProjectCancelledEvent
(
project
.
Id
,
DateTime
.
Now
));
project
.
SetState
(
new
CancledState
());
}
...
...
PSManagement.Domain/Projects/States/InProgressState.cs
View file @
92b258cf
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
string
StateName
=>
"InProgress"
;
public
void
Approve
(
Project
project
)
public
void
Approve
(
Project
project
,
Aggreement
projectAggreement
)
{
}
public
void
Cancle
(
Project
project
)
{
project
.
AddDomainEvent
(
new
ProjectCancelledEvent
(
project
.
Id
,
DateTime
.
Now
));
project
.
SetState
(
new
CancledState
());
}
...
...
PSManagement.Domain/Projects/States/ProposedState.cs
View file @
92b258cf
namespace
PSManagement.Domain.Projects.Entities
using
PSManagement.Domain.Projects.ValueObjects
;
namespace
PSManagement.Domain.Projects.Entities
{
public
class
ProposedState
:
IProjectState
{
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
)
...
...
@@ -26,7 +28,7 @@
public
void
Propose
(
Project
project
)
{
project
.
SetState
(
new
InPlanState
());
}
}
...
...
PSManagement.Domain/Projects/ValueObjects/StepInfo.cs
0 → 100644
View file @
92b258cf
using
System
;
namespace
PSManagement.Domain.Projects.ValueObjects
{
public
record
StepInfo
(
string
StepName
,
string
Description
,
DateTime
StartDate
,
int
Duration
);
}
PSManagement.Infrastructure.Persistence/DI/DependencyInjection.cs
View file @
92b258cf
...
...
@@ -10,6 +10,7 @@ using PSManagement.Infrastructure.Persistence.Repositories.Base;
using
PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.StepRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.UserRepository
;
using
PSManagement.Infrastructure.Persistence.UoW
;
using
PSManagement.SharedKernel.Interfaces
;
...
...
@@ -31,6 +32,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
services
.
AddScoped
<
IProjectsRepository
,
ProjectsRepository
>();
services
.
AddScoped
<
IRolesRepository
,
RolesRepository
>();
services
.
AddScoped
<
IEmployeesRepository
,
EmployeesRespository
>();
services
.
AddScoped
<
IStepsRepository
,
StepsRepository
>();
services
.
AddScoped
<
ProjectBuilder
>();
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/FinicialSpendingEntityConfiguration.cs
View file @
92b258cf
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
PSManagement.Domain.
Project
s.Entities
;
using
PSManagement.Domain.
FinancialSpend
s.Entities
;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/StepEntityConfiguration.cs
View file @
92b258cf
...
...
@@ -12,6 +12,15 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.
WithMany
(
p
=>
p
.
Steps
)
.
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
);
}
...
...
PSManagement.Infrastructure.Persistence/Migrations/20240813073337_FixStepConvention.Designer.cs
0 → 100644
View file @
92b258cf
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/20240813073337_FixStepConvention.cs
0 → 100644
View file @
92b258cf
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
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
92b258cf
...
...
@@ -303,21 +303,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
int
>(
"CurrentCompletionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
...
...
@@ -918,7 +906,40 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
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
(
"StepInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
...
...
PSManagement.Infrastructure.Persistence/PSManagement.Infrastructure.Persistence.csproj
View file @
92b258cf
...
...
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
...
...
PSManagement.Infrastructure.Persistence/Repositories/ProjectRepository/ProjectsRepository.cs
View file @
92b258cf
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.Infrastructure.Persistence.Repositories.Base
;
using
PSManagement.SharedKernel.Interfaces
;
using
PSManagement.SharedKernel.Repositories
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -15,5 +18,24 @@ namespace PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
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
();
}
}
}
PSManagement.Infrastructure.Persistence/Repositories/StepRepository/StepsRepository.cs
0 → 100644
View file @
92b258cf
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
)
{
}
}
}
PSManagement.Infrastructure/BackgroundServcies/BackgroundJobSyncEmployees.cs
View file @
92b258cf
...
...
@@ -12,16 +12,13 @@ namespace PSManagement.Infrastructure.BackgroundServcies
{
public
class
BackgroundJobSyncEmployees
:
BackgroundService
{
private
readonly
IDateTimeProvider
_timeProvider
;
private
readonly
IServiceScopeFactory
_scopeFactory
;
private
readonly
int
_syncIntervalInMinutes
;
public
BackgroundJobSyncEmployees
(
IDateTimeProvider
timeProvider
,
IOptions
<
EmployeesSyncJobSettings
>
settings
,
IServiceScopeFactory
scopeFactory
)
{
_timeProvider
=
timeProvider
;
_syncIntervalInMinutes
=
settings
.
Value
.
SyncIntervalInMinutes
;
_scopeFactory
=
scopeFactory
;
}
...
...
@@ -35,7 +32,7 @@ namespace PSManagement.Infrastructure.BackgroundServcies
try
{
using
(
var
scope
=
_scopeFactory
.
CreateScope
())
using
(
IServiceScope
scope
=
_scopeFactory
.
CreateScope
())
{
// Resolve the scoped IEmployeesRepository
var
dataProvider
=
scope
.
ServiceProvider
.
GetRequiredService
<
IEmployeesProvider
>();
...
...
@@ -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 Sync Employees Data End."
);
}
catch
(
Exception
ex
)
catch
{
}
...
...
PSManagement.Infrastructure/PSManagement.Infrastructure.Services.csproj
View file @
92b258cf
...
...
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
...
...
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
View file @
92b258cf
...
...
@@ -9,14 +9,15 @@ namespace PSManagement.Infrastructure.Services.Providers
{
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
()
{
return
Task
.
FromResult
(
E
mployees
.
AsEnumerable
());
return
Task
.
FromResult
(
_e
mployees
.
AsEnumerable
());
}
}
}
PSManagement.Presentation/PSManagement.Presentation.csproj
View file @
92b258cf
...
...
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
...
...
PSManagement.SharedKernel/Specification/BaseSpecification.cs
View file @
92b258cf
...
...
@@ -23,25 +23,25 @@ namespace PSManagement.SharedKernel.Specification
public
int
Skip
{
get
;
private
set
;
}
public
bool
IsPagingEnabled
{
get
;
private
set
;
}
=
false
;
p
rotected
virtual
void
AddInclude
(
Expression
<
Func
<
T
,
object
>>
includeExpression
)
p
ublic
virtual
void
AddInclude
(
Expression
<
Func
<
T
,
object
>>
includeExpression
)
{
Includes
.
Add
(
includeExpression
);
}
p
rotected
virtual
void
AddInclude
(
string
includeString
)
p
ublic
virtual
void
AddInclude
(
string
includeString
)
{
IncludeStrings
.
Add
(
includeString
);
}
p
rotected
virtual
void
ApplyPaging
(
int
skip
,
int
take
)
p
ublic
virtual
void
ApplyPaging
(
int
skip
,
int
take
)
{
Skip
=
skip
;
Take
=
take
;
IsPagingEnabled
=
true
;
}
p
rotected
virtual
void
ApplyOrderBy
(
Expression
<
Func
<
T
,
object
>>
orderByExpression
)
p
ublic
virtual
void
ApplyOrderBy
(
Expression
<
Func
<
T
,
object
>>
orderByExpression
)
{
OrderBy
=
orderByExpression
;
}
p
rotected
virtual
void
ApplyOrderByDescending
(
Expression
<
Func
<
T
,
object
>>
orderByDescendingExpression
)
p
ublic
virtual
void
ApplyOrderByDescending
(
Expression
<
Func
<
T
,
object
>>
orderByDescendingExpression
)
{
OrderByDescending
=
orderByDescendingExpression
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment