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
3604a56e
Commit
3604a56e
authored
Aug 14, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemnt some services
parent
16f4443d
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
3746 additions
and
72 deletions
+3746
-72
AppDbContext.cs
...Infrastructure.Persistence/AppDataContext/AppDbContext.cs
+1
-1
EmployeeEntityConfiguration.cs
...ence/EntitiesConfiguration/EmployeeEntityConfiguration.cs
+2
-1
20240814102008_ADDDepartmentToEmployeee.Designer.cs
...tions/20240814102008_ADDDepartmentToEmployeee.Designer.cs
+1152
-0
20240814102008_ADDDepartmentToEmployeee.cs
...nce/Migrations/20240814102008_ADDDepartmentToEmployeee.cs
+117
-0
20240814111808_AddDepartmentToEmployeee1.Designer.cs
...ions/20240814111808_AddDepartmentToEmployeee1.Designer.cs
+1153
-0
20240814111808_AddDepartmentToEmployeee1.cs
...ce/Migrations/20240814111808_AddDepartmentToEmployeee1.cs
+31
-0
20240814115828_UpdateTrackEntity.Designer.cs
...e/Migrations/20240814115828_UpdateTrackEntity.Designer.cs
+1156
-0
20240814115828_UpdateTrackEntity.cs
...ersistence/Migrations/20240814115828_UpdateTrackEntity.cs
+24
-0
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+91
-61
SeedData.cs
...nt.Infrastructure.Persistence/SeedDataContext/SeedData.cs
+6
-4
EmployeesProvider.cs
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
+4
-1
SyncEmployeesService.cs
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
+9
-4
No files found.
PSManagement.Infrastructure.Persistence/AppDataContext/AppDbContext.cs
View file @
3604a56e
...
@@ -46,7 +46,7 @@ namespace PSManagement.Infrastructure.Persistence
...
@@ -46,7 +46,7 @@ namespace PSManagement.Infrastructure.Persistence
SeedData
.
SeedAsync
(
modelBuilder
).
Wait
();
SeedData
.
SeedAsync
(
modelBuilder
).
Wait
();
base
.
OnModelCreating
(
modelBuilder
);
base
.
OnModelCreating
(
modelBuilder
);
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
);
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
);
}
}
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/EmployeeEntityConfiguration.cs
View file @
3604a56e
...
@@ -40,7 +40,8 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
...
@@ -40,7 +40,8 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.
HasForeignKey
<
Employee
>(
e
=>
e
.
UserId
);
;
.
HasForeignKey
<
Employee
>(
e
=>
e
.
UserId
);
;
builder
.
HasOne
(
e
=>
e
.
Department
).
WithMany
().
OnDelete
(
DeleteBehavior
.
Restrict
).
IsRequired
(
false
);
}
}
public
void
Configure
(
EntityTypeBuilder
<
User
>
builder
)
public
void
Configure
(
EntityTypeBuilder
<
User
>
builder
)
...
...
PSManagement.Infrastructure.Persistence/Migrations/20240814102008_ADDDepartmentToEmployeee.Designer.cs
0 → 100644
View file @
3604a56e
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/20240814102008_ADDDepartmentToEmployeee.cs
0 → 100644
View file @
3604a56e
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
ADDDepartmentToEmployeee
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DeleteData
(
table
:
"Roles"
,
keyColumn
:
"Id"
,
keyValue
:
3
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"DepartmentId"
,
table
:
"Employees"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
UpdateData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
2
,
column
:
"Name"
,
value
:
"قسم النظم الإلكترونية"
);
migrationBuilder
.
UpdateData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
3
,
column
:
"Name"
,
value
:
"قسم الميكاترونيكس"
);
migrationBuilder
.
InsertData
(
table
:
"Departments"
,
columns
:
new
[]
{
"Id"
,
"Name"
},
values
:
new
object
[,]
{
{
4
,
"قسم الفيزياء"
},
{
5
,
"مديرية التطوير والخدمات البرمجية"
},
{
6
,
"شؤون الطلاب"
}
});
migrationBuilder
.
InsertData
(
table
:
"Roles"
,
columns
:
new
[]
{
"Id"
,
"Name"
},
values
:
new
object
[]
{
4
,
"Scientific-Deputy"
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Employees_DepartmentId"
,
table
:
"Employees"
,
column
:
"DepartmentId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Employees_Departments_DepartmentId"
,
table
:
"Employees"
,
column
:
"DepartmentId"
,
principalTable
:
"Departments"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Employees_Departments_DepartmentId"
,
table
:
"Employees"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Employees_DepartmentId"
,
table
:
"Employees"
);
migrationBuilder
.
DeleteData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
4
);
migrationBuilder
.
DeleteData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
5
);
migrationBuilder
.
DeleteData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
6
);
migrationBuilder
.
DeleteData
(
table
:
"Roles"
,
keyColumn
:
"Id"
,
keyValue
:
4
);
migrationBuilder
.
DropColumn
(
name
:
"DepartmentId"
,
table
:
"Employees"
);
migrationBuilder
.
UpdateData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
2
,
column
:
"Name"
,
value
:
"قسم النظم الإلكترونيى"
);
migrationBuilder
.
UpdateData
(
table
:
"Departments"
,
keyColumn
:
"Id"
,
keyValue
:
3
,
column
:
"Name"
,
value
:
"شؤون الطلاب"
);
migrationBuilder
.
InsertData
(
table
:
"Roles"
,
columns
:
new
[]
{
"Id"
,
"Name"
},
values
:
new
object
[]
{
3
,
"Scientific-Supervisor"
});
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240814111808_AddDepartmentToEmployeee1.Designer.cs
0 → 100644
View file @
3604a56e
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/20240814111808_AddDepartmentToEmployeee1.cs
0 → 100644
View file @
3604a56e
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddDepartmentToEmployeee1
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DepartmentId"
,
table
:
"Employees"
,
type
:
"int"
,
nullable
:
true
,
defaultValue
:
0
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
,
oldNullable
:
true
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DepartmentId"
,
table
:
"Employees"
,
type
:
"int"
,
nullable
:
true
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240814115828_UpdateTrackEntity.Designer.cs
0 → 100644
View file @
3604a56e
This diff is collapsed.
Click to expand it.
PSManagement.Infrastructure.Persistence/Migrations/20240814115828_UpdateTrackEntity.cs
0 → 100644
View file @
3604a56e
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
UpdateTrackEntity
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
bool
>(
name
:
"IsCompleted"
,
table
:
"Tracks"
,
type
:
"bit"
,
nullable
:
false
,
defaultValue
:
false
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropColumn
(
name
:
"IsCompleted"
,
table
:
"Tracks"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
3604a56e
...
@@ -61,11 +61,26 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -61,11 +61,26 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
new
new
{
{
Id
=
2
,
Id
=
2
,
Name
=
"قسم النظم الإلكتروني
ى
"
Name
=
"قسم النظم الإلكتروني
ة
"
},
},
new
new
{
{
Id
=
3
,
Id
=
3
,
Name
=
"قسم الميكاترونيكس"
},
new
{
Id
=
4
,
Name
=
"قسم الفيزياء"
},
new
{
Id
=
5
,
Name
=
"مديرية التطوير والخدمات البرمجية"
},
new
{
Id
=
6
,
Name
=
"شؤون الطلاب"
Name
=
"شؤون الطلاب"
});
});
});
});
...
@@ -77,6 +92,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -77,6 +92,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasColumnType
(
"int"
)
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"DepartmentId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HIASTId"
)
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
...
@@ -85,12 +103,43 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -85,12 +103,43 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasKey
(
"Id"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DepartmentId"
);
b
.
HasIndex
(
"UserId"
)
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
b
.
ToTable
(
"Employees"
);
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
DateTime
>(
"ExpectedSpendingDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"LocalPurchase"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinancialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
{
b
.
Property
<
int
>(
"Id"
)
b
.
Property
<
int
>(
"Id"
)
...
@@ -133,8 +182,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -133,8 +182,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
},
},
new
new
{
{
Id
=
3
,
Id
=
4
,
Name
=
"Scientific-
Supervisor
"
Name
=
"Scientific-
Deputy
"
});
});
});
});
...
@@ -222,35 +271,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -222,35 +271,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeParticipate"
);
b
.
ToTable
(
"EmployeeParticipate"
);
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinancialSpending"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
DateTime
>(
"ExpectedSpendingDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"LocalPurchase"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinancialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
{
b
.
Property
<
int
>(
"Id"
)
b
.
Property
<
int
>(
"Id"
)
...
@@ -471,6 +491,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -471,6 +491,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasColumnType
(
"int"
)
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
bool
>(
"IsCompleted"
)
.
HasColumnType
(
"bit"
);
b
.
Property
<
int
>(
"ProjectId"
)
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
...
@@ -603,6 +626,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -603,6 +626,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Department"
)
.
WithMany
()
.
HasForeignKey
(
"DepartmentId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
...
@@ -680,6 +708,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -680,6 +708,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"Department"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"User"
);
...
@@ -687,35 +717,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -687,35 +717,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"WorkInfo"
);
b
.
Navigation
(
"WorkInfo"
);
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.FinancialSpending"
,
b
=>
{
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
WithMany
(
"FinancialSpending"
)
...
@@ -749,6 +751,34 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -749,6 +751,34 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"ExternalPurchase"
);
b
.
Navigation
(
"ExternalPurchase"
);
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
...
...
PSManagement.Infrastructure.Persistence/SeedDataContext/SeedData.cs
View file @
3604a56e
...
@@ -23,8 +23,11 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
...
@@ -23,8 +23,11 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
builder
.
Entity
<
Department
>().
HasData
(
builder
.
Entity
<
Department
>().
HasData
(
new
Department
{
Id
=
1
,
Name
=
"قسم المعلوميات"
},
new
Department
{
Id
=
1
,
Name
=
"قسم المعلوميات"
},
new
Department
{
Id
=
2
,
Name
=
"قسم النظم الإلكترونيى"
},
new
Department
{
Id
=
2
,
Name
=
"قسم النظم الإلكترونية"
},
new
Department
{
Id
=
3
,
Name
=
"شؤون الطلاب"
}
new
Department
{
Id
=
3
,
Name
=
"قسم الميكاترونيكس"
},
new
Department
{
Id
=
4
,
Name
=
"قسم الفيزياء"
},
new
Department
{
Id
=
5
,
Name
=
"مديرية التطوير والخدمات البرمجية"
},
new
Department
{
Id
=
6
,
Name
=
"شؤون الطلاب"
}
)
;
)
;
...
@@ -34,10 +37,9 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
...
@@ -34,10 +37,9 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
{
{
builder
.
Entity
<
Role
>().
HasData
(
builder
.
Entity
<
Role
>().
HasData
(
new
Role
{
Id
=
1
,
Name
=
"Admin"
},
new
Role
{
Id
=
1
,
Name
=
"Admin"
},
new
Role
{
Id
=
2
,
Name
=
"Employee"
},
new
Role
{
Id
=
2
,
Name
=
"Employee"
},
new
Role
{
Id
=
3
,
Name
=
"Scientific-Supervisor
"
}
new
Role
{
Id
=
4
,
Name
=
"Scientific-Deputy
"
}
);
);
...
...
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
View file @
3604a56e
...
@@ -12,7 +12,10 @@ namespace PSManagement.Infrastructure.Services.Providers
...
@@ -12,7 +12,10 @@ namespace PSManagement.Infrastructure.Services.Providers
private
readonly
static
List
<
Employee
>
_employees
=
new
()
private
readonly
static
List
<
Employee
>
_employees
=
new
()
{
{
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"
)
}
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"
,
HashedPassword
=
"1234"
},
DepartmentId
=
1
,
WorkInfo
=
new
WorkInfo
(
"Researcher"
,
"Worker"
)
},
new
Employee
{
Availability
=
new
Availability
(
0
,
true
),
PersonalInfo
=
new
PersonalInfo
(
"Mhd"
,
"hasan"
),
HIASTId
=
5
,
User
=
new
User
{
UserName
=
"mhd@mail.hiast"
,
Email
=
"mhd@mail.hiast"
,
HashedPassword
=
"1234"
},
DepartmentId
=
1
,
WorkInfo
=
new
WorkInfo
(
"worker"
,
"Worker"
)
},
new
Employee
{
Availability
=
new
Availability
(
0
,
true
),
PersonalInfo
=
new
PersonalInfo
(
"mahmoud"
,
"hasan"
),
HIASTId
=
6
,
User
=
new
User
{
UserName
=
"mahmoud@mail.hiast"
,
Email
=
"mahmoud@mail.hiast"
,
HashedPassword
=
"1234"
},
DepartmentId
=
2
,
WorkInfo
=
new
WorkInfo
(
"worker"
,
"Worker"
)
},
new
Employee
{
Availability
=
new
Availability
(
0
,
true
),
PersonalInfo
=
new
PersonalInfo
(
"ali"
,
"ahmad"
),
HIASTId
=
8
,
User
=
new
User
{
UserName
=
"rawad@mail.hiast"
,
Email
=
"rawad@mail.hiast"
,
HashedPassword
=
"1234"
},
DepartmentId
=
2
,
WorkInfo
=
new
WorkInfo
(
"worker"
,
"Worker"
)
}
};
};
public
Task
<
IEnumerable
<
Employee
>>
FetchEmployees
()
public
Task
<
IEnumerable
<
Employee
>>
FetchEmployees
()
...
...
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
View file @
3604a56e
...
@@ -14,6 +14,7 @@ using PSManagement.Domain.Employees.Repositories;
...
@@ -14,6 +14,7 @@ using PSManagement.Domain.Employees.Repositories;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.SharedKernel.Specification
;
using
PSManagement.SharedKernel.Specification
;
using
PSManagement.Domain.Employees.Specification
;
using
PSManagement.Domain.Employees.Specification
;
using
PSManagement.Application.Contracts.Authorization
;
namespace
PSManagement.Infrastructure.BackgroundServcies
namespace
PSManagement.Infrastructure.BackgroundServcies
{
{
...
@@ -24,18 +25,20 @@ namespace PSManagement.Infrastructure.BackgroundServcies
...
@@ -24,18 +25,20 @@ namespace PSManagement.Infrastructure.BackgroundServcies
private
readonly
IEmployeesProvider
_employeesProviders
;
private
readonly
IEmployeesProvider
_employeesProviders
;
private
readonly
BaseSpecification
<
Employee
>
_specification
;
private
readonly
BaseSpecification
<
Employee
>
_specification
;
private
readonly
IDateTimeProvider
_timeProvider
;
private
readonly
IDateTimeProvider
_timeProvider
;
private
readonly
IUserRoleService
_userRoleService
;
public
SyncEmployeesService
(
public
SyncEmployeesService
(
IEmployeesRepository
employeesRepository
,
IEmployeesRepository
employeesRepository
,
IEmployeesProvider
employeesProviders
,
IEmployeesProvider
employeesProviders
,
IDateTimeProvider
timeProvider
IDateTimeProvider
timeProvider
,
)
IUserRoleService
userRoleService
)
{
{
_employeesRepository
=
employeesRepository
;
_employeesRepository
=
employeesRepository
;
_employeesProviders
=
employeesProviders
;
_employeesProviders
=
employeesProviders
;
_specification
=
new
EmployeesSpecification
();
_specification
=
new
EmployeesSpecification
();
_timeProvider
=
timeProvider
;
_timeProvider
=
timeProvider
;
_userRoleService
=
userRoleService
;
}
}
public
async
Task
<
SyncResponse
>
SyncEmployees
(
IEmployeesProvider
employeesProvider
)
public
async
Task
<
SyncResponse
>
SyncEmployees
(
IEmployeesProvider
employeesProvider
)
...
@@ -47,7 +50,9 @@ namespace PSManagement.Infrastructure.BackgroundServcies
...
@@ -47,7 +50,9 @@ namespace PSManagement.Infrastructure.BackgroundServcies
_specification
.
Criteria
=
empl
=>
empl
.
HIASTId
==
employee
.
HIASTId
;
_specification
.
Criteria
=
empl
=>
empl
.
HIASTId
==
employee
.
HIASTId
;
Employee
emp
=
_employeesRepository
.
ListAsync
(
_specification
).
Result
.
FirstOrDefault
();
Employee
emp
=
_employeesRepository
.
ListAsync
(
_specification
).
Result
.
FirstOrDefault
();
if
(
emp
is
null
)
{
if
(
emp
is
null
)
{
await
_employeesRepository
.
AddAsync
(
employee
);
emp
=
await
_employeesRepository
.
AddAsync
(
employee
);
await
_userRoleService
.
AssignUserToRole
(
emp
.
User
.
Email
,
"Employee"
);
count
++;
count
++;
}
}
...
...
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