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
9c6c50b6
Commit
9c6c50b6
authored
Aug 25, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CQRS and migration for the project type and completion info
parent
fcb517f9
Changes
21
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1666 additions
and
206 deletions
+1666
-206
PSManagement.Domain.csproj
PSManagement.Domain/PSManagement.Domain.csproj
+0
-1
ProjectBuilder.cs
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
+16
-3
PrjectTypesErrors.cs
...agement.Domain/Projects/DomainErrors/PrjectTypesErrors.cs
+11
-0
Project.cs
PSManagement.Domain/Projects/Entities/Project.cs
+7
-3
ProjectCompletion.cs
PSManagement.Domain/Projects/Entities/ProjectCompletion.cs
+19
-0
ProjectType.cs
PSManagement.Domain/Projects/Entities/ProjectType.cs
+15
-0
IProjectTypesRepository.cs
...t.Domain/Projects/Repositories/IProjectTypesRepository.cs
+16
-0
ProjectTypeSpecification.cs
...Domain/Projects/Specification/ProjectTypeSpecification.cs
+16
-0
CancledState.cs
PSManagement.Domain/Projects/States/CancledState.cs
+1
-1
CompletedState.cs
PSManagement.Domain/Projects/States/CompletedState.cs
+1
-1
IProjectState.cs
PSManagement.Domain/Projects/States/IProjectState.cs
+1
-1
InPlanState.cs
PSManagement.Domain/Projects/States/InPlanState.cs
+2
-1
InProgressState.cs
PSManagement.Domain/Projects/States/InProgressState.cs
+2
-1
ProposedState.cs
PSManagement.Domain/Projects/States/ProposedState.cs
+1
-1
ProjectClassification.cs
...ent.Domain/Projects/ValueObjects/ProjectClassification.cs
+1
-2
Report.cs
PSManagement.Domain/XReports/Entities/Report.cs
+0
-45
AppDbContext.cs
...Infrastructure.Persistence/AppDataContext/AppDbContext.cs
+1
-3
ProjectEntityConfiguration.cs
...tence/EntitiesConfiguration/ProjectEntityConfiguration.cs
+12
-3
20240825063804_AddProjectType.Designer.cs
...ence/Migrations/20240825063804_AddProjectType.Designer.cs
+1191
-0
20240825063804_AddProjectType.cs
...e.Persistence/Migrations/20240825063804_AddProjectType.cs
+294
-0
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+59
-140
No files found.
PSManagement.Domain/PSManagement.Domain.csproj
View file @
9c6c50b6
...
...
@@ -6,7 +6,6 @@
<ItemGroup>
<Folder Include="Identity\ValueObjects\" />
<Folder Include="XReports\Repositories\" />
</ItemGroup>
<ItemGroup>
...
...
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
View file @
9c6c50b6
...
...
@@ -17,7 +17,7 @@ namespace PSManagement.Domain.Projects.Builders
private
ProjectInfo
_projectInfo
;
private
FinancialFund
_financialFund
;
private
Aggreement
_projectAggreement
;
private
ProjectType
_projectType
;
// information about who lead and execute the project
private
int
_teamLeaderId
;
private
int
_projectManagerId
;
...
...
@@ -30,6 +30,13 @@ namespace PSManagement.Domain.Projects.Builders
private
ICollection
<
Attachment
>
_attachments
;
private
ICollection
<
FinancialSpending
>
_financialSpending
;
public
ProjectBuilder
WithClassification
(
ICollection
<
FinancialSpending
>
financialSpendings
)
{
_financialSpending
=
financialSpendings
;
return
this
;
}
public
ProjectBuilder
WithClassification
(
ProjectClassification
projectClassification
)
{
_projectClassification
=
projectClassification
;
...
...
@@ -40,6 +47,11 @@ namespace PSManagement.Domain.Projects.Builders
_participants
=
participates
;
return
this
;
}
public
ProjectBuilder
WithType
(
ProjectType
projectType
)
{
_projectType
=
projectType
;
return
this
;
}
public
ProjectBuilder
WithFinancialSpending
(
ICollection
<
FinancialSpending
>
financialSpending
)
{
...
...
@@ -120,7 +132,8 @@ namespace PSManagement.Domain.Projects.Builders
_projectManagerId
,
_executerId
,
_stateName
,
_projectClassification
);
_projectClassification
,
_projectType
);
project
.
FinancialFund
=
_financialFund
;
if
(
_attachments
is
not
null
)
{
...
...
PSManagement.Domain/Projects/DomainErrors/PrjectTypesErrors.cs
0 → 100644
View file @
9c6c50b6
using
Ardalis.Result
;
using
PSManagement.SharedKernel.DomainErrors
;
namespace
PSManagement.Domain.Projects.DomainErrors
{
public
class
PrjectTypesErrors
{
public
static
DomainError
InvalidEntryError
{
get
;
}
=
new
(
"ProjectErrors.InvalidEntry."
,
"Invalid Step Data"
);
public
static
DomainError
InvalidName
{
get
;
}
=
new
(
"ProjectErrors.InvalidEntry."
,
"the name is already exist"
);
}
}
PSManagement.Domain/Projects/Entities/Project.cs
View file @
9c6c50b6
...
...
@@ -25,6 +25,8 @@ namespace PSManagement.Domain.Projects.Entities
public
ProposalInfo
ProposalInfo
{
get
;
set
;
}
public
ProjectInfo
ProjectInfo
{
get
;
set
;
}
public
Aggreement
ProjectAggreement
{
get
;
set
;
}
public
ProjectType
ProjectType
{
get
;
set
;
}
public
ProjectCompletion
ProjectCompletion
{
get
;
set
;
}
public
ProjectClassification
ProjectClassification
{
get
;
set
;
}
#
endregion
Project
informations
...
...
@@ -119,9 +121,9 @@ namespace PSManagement.Domain.Projects.Entities
#
region
State
Transitions
public
Result
Complete
()
public
Result
Complete
(
ProjectCompletion
projectCompletion
)
{
return
State
.
Complete
(
this
);
return
State
.
Complete
(
this
,
projectCompletion
);
}
public
Result
Plan
()
...
...
@@ -175,9 +177,11 @@ namespace PSManagement.Domain.Projects.Entities
int
projectManagerId
,
int
executerId
,
string
stateName
,
ProjectClassification
projectClassification
ProjectClassification
projectClassification
,
ProjectType
projectType
)
{
ProjectType
=
projectType
;
ProjectClassification
=
projectClassification
;
SetStateFromString
(
stateName
);
ProposalInfo
=
proposalInfo
;
...
...
PSManagement.Domain/Projects/Entities/ProjectCompletion.cs
0 → 100644
View file @
9c6c50b6
using
PSManagement.SharedKernel.Entities
;
using
System
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Domain.Projects.Entities
{
public
class
ProjectCompletion
:
BaseEntity
{
public
int
ProjectId
{
get
;
set
;
}
public
Project
Project
{
get
;
set
;
}
public
DateTime
CompletionDate
{
get
;
set
;
}
public
String
CustomerNotes
{
get
;
set
;
}
public
int
CustomerRate
{
get
;
set
;
}
}
}
PSManagement.Domain/Projects/Entities/ProjectType.cs
0 → 100644
View file @
9c6c50b6
using
PSManagement.SharedKernel.Entities
;
using
System.Collections.Generic
;
namespace
PSManagement.Domain.Projects.Entities
{
public
class
ProjectType
:
BaseEntity
{
public
string
TypeName
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
public
int
ExpectedEffort
{
get
;
set
;
}
public
ICollection
<
Project
>
Projects
{
get
;
set
;
}
}
}
PSManagement.Domain/Projects/Repositories/IProjectTypesRepository.cs
0 → 100644
View file @
9c6c50b6
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.SharedKernel.Interfaces
;
using
PSManagement.SharedKernel.Repositories
;
using
System.Collections.Generic
;
using
System.Threading.Tasks
;
namespace
PSManagement.Domain.Projects.Repositories
{
public
interface
IProjectTypesRepository
:
IRepository
<
ProjectType
>
{
public
Task
<
IEnumerable
<
Project
>>
GetProjectsByTypeName
(
string
typeName
,
ISpecification
<
ProjectType
>
specification
=
null
);
public
Task
<
IEnumerable
<
ProjectType
>>
GetByTypeName
(
string
typeName
,
ISpecification
<
ProjectType
>
specification
=
null
);
}
}
PSManagement.Domain/Projects/Specification/ProjectTypeSpecification.cs
0 → 100644
View file @
9c6c50b6
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.SharedKernel.Specification
;
using
System
;
using
System.Linq.Expressions
;
namespace
PSManagement.Domain.Projects
{
public
class
ProjectTypeSpecification
:
BaseSpecification
<
ProjectType
>
{
public
ProjectTypeSpecification
(
Expression
<
Func
<
ProjectType
,
bool
>>
criteria
=
null
)
:
base
(
criteria
)
{
AddInclude
(
u
=>
u
.
Projects
);
}
}
}
PSManagement.Domain/Projects/States/CancledState.cs
View file @
9c6c50b6
...
...
@@ -19,7 +19,7 @@ namespace PSManagement.Domain.Projects.Entities
return
Result
.
Invalid
(
ProjectsErrors
.
StateTracnsitionError
(
"Cancelled"
,
"Cancelled"
));
}
public
Result
Complete
(
Project
project
)
public
Result
Complete
(
Project
project
,
ProjectCompletion
projectCompletion
)
{
return
Result
.
Invalid
(
ProjectsErrors
.
StateTracnsitionError
(
"Cancelled"
,
"Completed"
));
}
...
...
PSManagement.Domain/Projects/States/CompletedState.cs
View file @
9c6c50b6
...
...
@@ -19,7 +19,7 @@ namespace PSManagement.Domain.Projects.Entities
return
Result
.
Invalid
(
ProjectsErrors
.
StateTracnsitionError
(
"Completed"
,
"Cancelled"
));
}
public
Result
Complete
(
Project
project
)
public
Result
Complete
(
Project
project
,
ProjectCompletion
ProjectCompletion
)
{
return
Result
.
Invalid
(
ProjectsErrors
.
StateTracnsitionError
(
"Completed"
,
"Completed"
));
}
...
...
PSManagement.Domain/Projects/States/IProjectState.cs
View file @
9c6c50b6
...
...
@@ -6,7 +6,7 @@ namespace PSManagement.Domain.Projects.Entities
{
public
interface
IProjectState
{
Result
Complete
(
Project
project
);
Result
Complete
(
Project
project
,
ProjectCompletion
projectCompletion
);
Result
Plan
(
Project
project
);
Result
Approve
(
Project
project
);
Result
Cancel
(
Project
project
,
DateTime
canellationTime
);
...
...
PSManagement.Domain/Projects/States/InPlanState.cs
View file @
9c6c50b6
...
...
@@ -27,8 +27,9 @@ namespace PSManagement.Domain.Projects.Entities
}
public
Result
Complete
(
Project
project
)
public
Result
Complete
(
Project
project
,
ProjectCompletion
projectCompletion
)
{
project
.
ProjectCompletion
=
projectCompletion
;
project
.
AddDomainEvent
(
new
ProjectCompletedEvent
(
project
.
Id
));
project
.
SetState
(
new
CompletedState
());
return
Result
.
Success
();
...
...
PSManagement.Domain/Projects/States/InProgressState.cs
View file @
9c6c50b6
...
...
@@ -24,8 +24,9 @@ namespace PSManagement.Domain.Projects.Entities
return
Result
.
Success
();
}
public
Result
Complete
(
Project
project
)
public
Result
Complete
(
Project
project
,
ProjectCompletion
projectCompletion
)
{
project
.
ProjectCompletion
=
projectCompletion
;
project
.
AddDomainEvent
(
new
ProjectCompletedEvent
(
project
.
Id
));
project
.
SetState
(
new
CompletedState
());
return
Result
.
Success
();
...
...
PSManagement.Domain/Projects/States/ProposedState.cs
View file @
9c6c50b6
...
...
@@ -22,7 +22,7 @@ namespace PSManagement.Domain.Projects.Entities
}
public
Result
Complete
(
Project
project
)
public
Result
Complete
(
Project
project
,
ProjectCompletion
projectCompletion
)
{
return
Result
.
Invalid
(
ProjectsErrors
.
StateTracnsitionError
(
"Proposed"
,
"Completed"
));
...
...
PSManagement.Domain/Projects/ValueObjects/ProjectClassification.cs
View file @
9c6c50b6
...
...
@@ -2,8 +2,7 @@
{
public
record
ProjectClassification
(
string
ProjectNature
,
string
ProjectStatus
,
string
ProjectType
string
ProjectStatus
);
}
PSManagement.Domain/XReports/Entities/Report.cs
deleted
100644 → 0
View file @
fcb517f9
using
PSManagement.SharedKernel.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Domain.Reports.Entities
{
public
class
Report
:
BaseEntity
{
public
String
ReportName
{
get
;
set
;
}
public
ICollection
<
Section
>
Sections
{
get
;
set
;
}
}
public
class
Section
:
BaseEntity
{
public
String
SectionName
{
get
;
set
;
}
public
Report
Report
{
get
;
set
;
}
public
ICollection
<
Question
>
Questions
{
get
;
set
;
}
}
public
class
Question
:
BaseEntity
{
public
String
QuestionName
{
get
;
set
;
}
public
ICollection
<
Section
>
Sections
{
get
;
set
;
}
}
public
class
Answer
:
BaseEntity
{
public
Question
Question
{
get
;
set
;
}
public
String
AnswerValue
{
get
;
set
;
}
}
public
class
ReportResult
:
BaseEntity
{
public
Report
Report
{
get
;
set
;
}
public
ICollection
<
Answer
>
Answers
{
get
;
set
;
}
}
}
PSManagement.Infrastructure.Persistence/AppDataContext/AppDbContext.cs
View file @
9c6c50b6
...
...
@@ -4,7 +4,6 @@ using PSManagement.Domain.Employees.Entities;
using
PSManagement.Domain.FinancialSpends.Entities
;
using
PSManagement.Domain.Identity.Entities
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Reports.Entities
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.Domain.Tracking.Entities
;
using
PSManagement.Infrastructure.Persistence.SeedDataContext
;
...
...
@@ -19,8 +18,7 @@ namespace PSManagement.Infrastructure.Persistence
{
}
public
DbSet
<
Report
>
Reports
{
get
;
set
;
}
public
DbSet
<
ReportResult
>
ReportResults
{
get
;
set
;
}
public
DbSet
<
User
>
Users
{
get
;
set
;
}
public
DbSet
<
Role
>
Roles
{
get
;
set
;
}
public
DbSet
<
Permission
>
Permission
{
get
;
set
;
}
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/ProjectEntityConfiguration.cs
View file @
9c6c50b6
...
...
@@ -5,7 +5,7 @@ using PSManagement.Domain.Projects.Entities;
namespace
PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public
class
ProjectEntityConfiguration
:
IEntityTypeConfiguration
<
Project
>
public
class
ProjectEntityConfiguration
:
IEntityTypeConfiguration
<
Project
>
,
IEntityTypeConfiguration
<
ProjectCompletion
>
{
public
void
Configure
(
EntityTypeBuilder
<
Project
>
builder
)
{
...
...
@@ -30,10 +30,14 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p
=>
{
p
.
Property
(
e
=>
e
.
ProjectNature
).
HasColumnName
(
"ProjectNature"
);
p
.
Property
(
e
=>
e
.
ProjectStatus
).
HasColumnName
(
"ProjectStatus"
);
p
.
Property
(
e
=>
e
.
ProjectType
).
HasColumnName
(
"ProjectType"
);
}
);
builder
.
HasOne
(
e
=>
e
.
ProjectType
)
.
WithMany
();
builder
.
OwnsOne
(
c
=>
c
.
ProjectInfo
,
p
=>
{
p
.
Property
(
e
=>
e
.
Description
).
HasColumnName
(
"Description"
);
...
...
@@ -85,7 +89,12 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
}
public
void
Configure
(
EntityTypeBuilder
<
ProjectCompletion
>
builder
)
{
builder
.
HasOne
(
e
=>
e
.
Project
)
.
WithOne
(
e
=>
e
.
ProjectCompletion
)
;
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240825063804_AddProjectType.Designer.cs
0 → 100644
View file @
9c6c50b6
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/20240825063804_AddProjectType.cs
0 → 100644
View file @
9c6c50b6
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
9c6c50b6
This diff is collapsed.
Click to expand it.
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