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
9f943cfa
Commit
9f943cfa
authored
Aug 25, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix paginaton issues
parent
626a2c9b
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
36 deletions
+34
-36
GetAvailableEmployeesQueryHandler.cs
...etAvailableEmployees/GetAvailableEmployeesQueryHandler.cs
+4
-3
GetEmployeeParticipationQueryHandler.cs
...yeeParticipations/GetEmployeeParticipationQueryHandler.cs
+1
-3
GetEmployeeTrackHistoryQueryHandler.cs
...ployeeTrackHistory/GetEmployeeTrackHistoryQueryHandler.cs
+2
-4
GetEmployeesByFilterQueryHandler.cs
.../GetEmployeesByFilter/GetEmployeesByFilterQueryHandler.cs
+1
-3
GetFinancialSpendItemByProjectQueryHandler.cs
...ngByProject/GetFinancialSpendItemByProjectQueryHandler.cs
+1
-6
GetProjectAttachmentsQueryHandler.cs
...etProjectAttachments/GetProjectAttachmentsQueryHandler.cs
+9
-1
GetProjectsByFilterQueryHandler.cs
...es/GetProjectsByFilter/GetProjectsByFilterQueryHandler.cs
+1
-5
ListAllProjectsQueryHandler.cs
...ses/Queries/ListAllProject/ListAllProjectsQueryHandler.cs
+2
-5
GetTracksByProjectQueryHandler.cs
...ries/GetTracksByProject/GetTracksByProjectQueryHandler.cs
+2
-6
BaseSpecification.cs
PSManagement.SharedKernel/Specification/BaseSpecification.cs
+11
-0
No files found.
PSManagement.Application/Employees/UseCases/Queries/GetAvailableEmployees/GetAvailableEmployeesQueryHandler.cs
View file @
9f943cfa
...
...
@@ -29,11 +29,12 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetAvailableEmploy
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetAvailableEmployeesQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
EmployeeDTO
>>(
await
_employeesRepository
.
ListAsync
(
_specification
)));
}
}
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeeParticipations/GetEmployeeParticipationQueryHandler.cs
View file @
9f943cfa
...
...
@@ -30,9 +30,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeById
public
async
Task
<
Result
<
IEnumerable
<
EmployeeParticipateDTO
>>>
Handle
(
GetEmployeeParticipationQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
AddInclude
(
"Employee.User"
);
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeeTrackHistory/GetEmployeeTrackHistoryQueryHandler.cs
View file @
9f943cfa
...
...
@@ -30,14 +30,12 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeeTrackHi
public
async
Task
<
Result
<
IEnumerable
<
EmployeeTrackDTO
>>>
Handle
(
GetEmployeeTrackHistoryQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
Track
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
);
_specification
.
AddInclude
(
e
=>
e
.
Employee
.
User
);
_specification
.
Criteria
=
e
=>
e
.
EmployeeId
==
request
.
EmployeeId
&&
e
.
Track
.
ProjectId
==
request
.
ProjectId
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
IEnumerable
<
EmployeeTrack
>
employeeTracks
=
await
_employeeTracksRepository
.
ListAsync
(
_specification
);
...
...
PSManagement.Application/Employees/UseCases/Queries/GetEmployeesByFilter/GetEmployeesByFilterQueryHandler.cs
View file @
9f943cfa
...
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Employees.UseCases.Queries.GetEmployeesByFilt
public
async
Task
<
Result
<
IEnumerable
<
EmployeeDTO
>>>
Handle
(
GetEmployeesByFilterQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
Department
);
_specification
.
AddInclude
(
e
=>
e
.
User
);
...
...
PSManagement.Application/FinancialSpends/UseCases/Queries/GetFinancialSpendingByProject/GetFinancialSpendItemByProjectQueryHandler.cs
View file @
9f943cfa
...
...
@@ -31,12 +31,7 @@ namespace PSManagement.Application.FinancialSpends.UseCases.Queries.GetFinancial
public
async
Task
<
Result
<
IEnumerable
<
FinancialSpendingDTO
>>>
Handle
(
GetFinancialSpendItemByProjectQuery
request
,
CancellationToken
cancellationToken
)
{
_specification
.
Criteria
=
p
=>
p
.
ProjectId
==
request
.
ProjectId
;
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
IEnumerable
<
FinancialSpending
>
spending
=
await
_spendRepository
.
ListAsync
(
_specification
);
if
(
spending
is
null
)
...
...
PSManagement.Application/Projects/UseCases/Queries/GetProjectAttachments/GetProjectAttachmentsQueryHandler.cs
View file @
9f943cfa
...
...
@@ -32,8 +32,16 @@ namespace PSManagement.Application.Projects.UseCases.Queries.GetProjectAttachmen
var
attachments
=
await
_attachmentRepository
.
ListAsync
();
if
(
request
.
PageSize
.
HasValue
&&
request
.
PageNumber
.
HasValue
)
{
attachments
=
attachments
.
Where
(
e
=>
e
.
ProjectId
==
request
.
ProjectId
).
Skip
((
pageNumber
-
1
)
*
pageSize
).
Take
(
pageSize
);
}
else
{
attachments
=
attachments
.
Where
(
e
=>
e
.
ProjectId
==
request
.
ProjectId
);
}
return
Result
.
Success
(
_mapper
.
Map
<
IEnumerable
<
AttachmentDTO
>>(
attachments
));
}
}
...
...
PSManagement.Application/Projects/UseCases/Queries/GetProjectsByFilter/GetProjectsByFilterQueryHandler.cs
View file @
9f943cfa
...
...
@@ -34,11 +34,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
_specification
.
AddInclude
(
e
=>
e
.
Executer
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
IEnumerable
<
Project
>
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
...
...
PSManagement.Application/Projects/UseCases/Queries/ListAllProject/ListAllProjectsQueryHandler.cs
View file @
9f943cfa
...
...
@@ -29,9 +29,7 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
public
async
Task
<
Result
<
IEnumerable
<
ProjectDetailsDTO
>>>
Handle
(
ListAllProjectsQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
ProjectManager
);
_specification
.
AddInclude
(
e
=>
e
.
Proposer
);
_specification
.
AddInclude
(
e
=>
e
.
TeamLeader
);
...
...
@@ -39,7 +37,6 @@ namespace PSManagement.Application.Projects.UseCases.Queries.ListAllProject
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
var
projects
=
await
_projectsRepository
.
ListAsync
(
_specification
);
...
...
PSManagement.Application/Tracks/UseCaes/Queries/GetTracksByProject/GetTracksByProjectQueryHandler.cs
View file @
9f943cfa
...
...
@@ -34,13 +34,9 @@ namespace PSManagement.Application.Tracks.UseCaes.Queries.GetTracksByProject
public
async
Task
<
Result
<
IEnumerable
<
TrackDTO
>>>
Handle
(
GetTracksByProjectQuery
request
,
CancellationToken
cancellationToken
)
{
int
pageNumber
=
request
.
PageNumber
.
HasValue
&&
request
.
PageNumber
.
Value
>
0
?
request
.
PageNumber
.
Value
:
1
;
int
pageSize
=
request
.
PageSize
.
HasValue
&&
request
.
PageSize
.
Value
>
0
&&
request
.
PageSize
.
Value
<=
30
?
request
.
PageSize
.
Value
:
30
;
_specification
.
ApplyOptionalPagination
(
request
.
PageSize
,
request
.
PageNumber
);
_specification
.
AddInclude
(
e
=>
e
.
Project
);
_specification
.
ApplyPaging
((
pageNumber
-
1
)
*
pageSize
,
pageSize
);
_specification
.
Criteria
=
t
=>
t
.
ProjectId
==
request
.
ProjectId
;
var
project
=
await
_projectsRepository
.
GetByIdAsync
(
request
.
ProjectId
);
...
...
PSManagement.SharedKernel/Specification/BaseSpecification.cs
View file @
9f943cfa
...
...
@@ -46,5 +46,16 @@ namespace PSManagement.SharedKernel.Specification
OrderByDescending
=
orderByDescendingExpression
;
}
public
void
ApplyOptionalPagination
(
int
?
pageSize
,
int
?
pageNumber
)
{
int
actPageNumber
=
pageNumber
.
HasValue
&&
pageNumber
.
Value
>
0
?
pageNumber
.
Value
:
1
;
int
actPageSize
=
pageSize
.
HasValue
&&
pageSize
.
Value
>
0
&&
pageSize
.
Value
<=
30
?
pageSize
.
Value
:
30
;
if
(
pageNumber
.
HasValue
&&
pageSize
.
HasValue
)
{
ApplyPaging
((
actPageNumber
-
1
)
*
actPageSize
,
actPageSize
);
}
}
}
}
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