Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
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
almohanad.hafez
HIAST-Clinics
Commits
219cd6d0
Commit
219cd6d0
authored
Aug 16, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) update doctor-related entities
parent
f1582a50
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
151 additions
and
15 deletions
+151
-15
Doctor.cs
Clinics.Backend/Domain/Entities/People/Doctors/Doctor.cs
+64
-1
DoctorStatus.cs
...ctors/Shared/Constants/DoctorStatusValues/DoctorStatus.cs
+0
-12
DoctorPhone.cs
...kend/Domain/Entities/People/Doctors/Shared/DoctorPhone.cs
+28
-2
DoctorStatus.cs
.../People/Doctors/Shared/DoctorStatusValues/DoctorStatus.cs
+45
-0
DoctorStatuses.cs
...eople/Doctors/Shared/DoctorStatusValues/DoctorStatuses.cs
+14
-0
No files found.
Clinics.Backend/Domain/Entities/People/Doctors/Doctor.cs
View file @
219cd6d0
using
Domain.Entities.People.Doctors.Shared
;
using
Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues
;
using
Domain.Entities.People.Shared
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.People.Doctors
;
public
sealed
class
Doctor
(
int
id
)
:
Entity
(
id
)
public
sealed
class
Doctor
:
Entity
{
#
region
Private
ctor
private
Doctor
(
int
id
)
:
base
(
id
)
{
}
private
Doctor
(
int
id
,
PersonalInfo
personalInfo
)
:
base
(
id
)
{
PersonalInfo
=
personalInfo
;
Status
=
DoctorStatuses
.
Available
;
}
#
endregion
#
region
Properties
public
PersonalInfo
PersonalInfo
{
get
;
set
;
}
=
null
!;
...
...
@@ -20,4 +33,54 @@ public sealed class Doctor(int id) : Entity(id)
#
endregion
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Doctor
Create
(
string
firstName
,
string
middleName
,
string
lastName
)
{
PersonalInfo
personalInfo
;
try
{
personalInfo
=
PersonalInfo
.
Create
(
firstName
,
middleName
,
lastName
);
}
catch
{
throw
;
}
return
new
Doctor
(
0
,
personalInfo
);
}
#
endregion
#
region
Add
phone
public
void
AddPhone
(
string
phone
,
string
?
number
=
null
)
{
DoctorPhone
doctorPhone
;
try
{
doctorPhone
=
DoctorPhone
.
Create
(
phone
,
number
);
}
catch
{
throw
;
}
if
(
Phones
is
null
)
Phones
=
[];
Phones
.
Add
(
doctorPhone
);
}
#
endregion
#
region
Change
status
public
void
ChangeStatusTo
(
DoctorStatus
status
)
{
if
(
status
==
DoctorStatuses
.
Available
||
status
==
DoctorStatuses
.
Busy
||
status
==
DoctorStatuses
.
Working
)
Status
=
status
;
throw
new
InvalidValuesDomainException
<
DoctorStatus
>();
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/People/Doctors/Shared/Constants/DoctorStatusValues/DoctorStatus.cs
deleted
100644 → 0
View file @
f1582a50
using
Domain.Primitives
;
namespace
Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues
;
public
sealed
class
DoctorStatus
(
int
id
)
:
Entity
(
id
)
{
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
#
endregion
}
Clinics.Backend/Domain/Entities/People/Doctors/Shared/DoctorPhone.cs
View file @
219cd6d0
using
Domain.Primitives
;
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.People.Doctors.Shared
;
// TODO: Convert phone property to a value object
public
sealed
class
DoctorPhone
(
int
id
)
:
Entity
(
id
)
public
sealed
class
DoctorPhone
:
Entity
{
#
region
Private
ctor
private
DoctorPhone
(
int
id
)
:
base
(
id
)
{
}
private
DoctorPhone
(
int
id
,
string
phone
,
string
?
name
=
null
)
:
base
(
id
)
{
Phone
=
phone
;
Name
=
name
;
}
#
endregion
#
region
Properties
public
string
?
Name
{
get
;
set
;
}
...
...
@@ -12,4 +23,19 @@ public sealed class DoctorPhone(int id) : Entity(id)
public
string
Phone
{
get
;
set
;
}
=
null
!;
#
endregion
#
region
Methods
#
region
Static
factory
public
static
DoctorPhone
Create
(
string
phone
,
string
?
name
)
{
if
(
phone
is
null
)
throw
new
InvalidValuesDomainException
<
DoctorPhone
>();
return
new
DoctorPhone
(
0
,
phone
,
name
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/People/Doctors/Shared/DoctorStatusValues/DoctorStatus.cs
0 → 100644
View file @
219cd6d0
using
Domain.Exceptions.InvalidValue
;
using
Domain.Primitives
;
namespace
Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues
;
public
sealed
class
DoctorStatus
:
Entity
{
#
region
Private
ctor
private
DoctorStatus
(
int
id
)
:
base
(
id
)
{
}
private
DoctorStatus
(
int
id
,
string
name
)
:
base
(
id
)
{
Name
=
name
;
}
#
endregion
#
region
Properties
public
string
Name
{
get
;
set
;
}
=
null
!;
#
endregion
#
region
Methods
#
region
Static
factory
public
static
DoctorStatus
Create
(
string
name
,
int
?
id
)
{
if
(
name
is
null
)
throw
new
InvalidValuesDomainException
<
DoctorStatus
>();
if
(
id
is
not
null
)
{
if
(
id
<
0
)
throw
new
InvalidValuesDomainException
<
DoctorStatus
>();
return
new
DoctorStatus
(
id
.
Value
,
name
);
}
return
new
DoctorStatus
(
0
,
name
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/People/Doctors/Shared/
Constants/
DoctorStatusValues/DoctorStatuses.cs
→
Clinics.Backend/Domain/Entities/People/Doctors/Shared/DoctorStatusValues/DoctorStatuses.cs
View file @
219cd6d0
...
...
@@ -4,11 +4,11 @@ public static class DoctorStatuses
{
#
region
Constant
id
values
public
static
int
Available
=>
1
;
public
static
DoctorStatus
Available
=>
DoctorStatus
.
Create
(
"متاح"
,
1
)
;
public
static
int
Working
=>
2
;
public
static
DoctorStatus
Working
=>
DoctorStatus
.
Create
(
"لديه مريض"
,
1
)
;
public
static
int
Busy
=>
3
;
public
static
DoctorStatus
Busy
=>
DoctorStatus
.
Create
(
"مشغول"
,
1
)
;
#
endregion
}
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