Exemplo n.º 1
0
 internal static CalendarUser CreateNew(
     CalendarId calendarId,
     MedicalStuffId medicalStuffId,
     MedicalStuffRole medicalStuffRole
     )
 {
     return(new CalendarUser(calendarId, medicalStuffId, medicalStuffRole));
 }
Exemplo n.º 2
0
 public void AddAccesToCalendar(
     MedicalStuffId medicalStuffId)
 {
     _calendarUsers.Add(CalendarUser.CreateNew(
                            Id,
                            medicalStuffId,
                            MedicalStuffRole.Nurse
                            ));
 }
        public async Task <MedicalStuff> GetById(MedicalStuffId id)
        {
            var connection = _sqlConnectionFactory.GetOpenConnection();

            const string sql          = "SELECT *  FROM [TestDb].[calendars].[MedicalStuffs] WHERE MedicalStuffs.Id = @Id";
            var          param        = new { Id = id.Value };
            var          medicalStaff = await connection.QuerySingleAsync <MedicalStaffDto>(sql, param);

            return(medicalStaff.Mapp());
        }
Exemplo n.º 4
0
 private CalendarUser(
     CalendarId calendarId,
     MedicalStuffId medicalStuffId,
     MedicalStuffRole medicalStuffRole)
 {
     CalendarId     = calendarId;
     MedicalStuffId = medicalStuffId;
     _role          = medicalStuffRole;
     AddDomainEvent(new CalendarUserCreatedDomainEvent(CalendarId, MedicalStuffId));
 }
Exemplo n.º 5
0
        public static MedicalStuff Mapp(this MedicalStaffDto medicalStaffDto)
        {
            var        medId      = new MedicalStuffId(medicalStaffDto.Id);
            CalendarId calendarId = null;

            if (medicalStaffDto.CalendarId != Guid.Parse("00000000-0000-0000-0000-000000000000"))
            {
                calendarId = new CalendarId(medicalStaffDto.CalendarId);
            }

            var clinicId = new ClinicId(medicalStaffDto.ClinicId);

            if (medicalStaffDto.RoleCode == MedicalStuffRole.Doctor.ToString())
            {
                return(new MedicalStuff(medId, clinicId, medicalStaffDto.Firstname, medicalStaffDto.Lastname, medicalStaffDto.DateOfBirth, calendarId, MedicalStuffRole.Doctor));
            }
            else
            {
                return(new MedicalStuff(medId, clinicId, medicalStaffDto.Firstname, medicalStaffDto.Lastname, medicalStaffDto.DateOfBirth, MedicalStuffRole.Nurse));
            }
        }
Exemplo n.º 6
0
 public CalendarUserCreatedDomainEvent(CalendarId calendarId, MedicalStuffId medicalStuffId)
 {
     CalendarId     = calendarId;
     MedicalStuffId = medicalStuffId;
 }
 public DoctorCreatedDomainEvent(MedicalStuffId medicalStuffId)
 {
     MedicalStuffId = medicalStuffId;
 }
 public NurseCreatedDomainEvent(MedicalStuffId medicalStuffId)
 {
     MedicalStuffId = medicalStuffId;
 }
 public async Task <MedicalStuff> GetByIdAsync(MedicalStuffId id)
 {
     return(await _schedulingContext.MedicalStuffs.FindAsync(id));
 }