public CreateContactFormCommandHandler(IStudioDbContext context, IMediator mediator, ILoggerFactory loggerFactory, ISender emailSender)
 {
     this.loggerFactory = loggerFactory;
     this.emailSender = emailSender;
     this.context = context;
     this.mediator = mediator;
 }
        // Appointment Creation Helper Methods
        // Checking if InsideWorkingHours + Not Weekend
        public static bool IsInWorkingHours(IStudioDbContext context, Employee employee, DateTime start, DateTime end)
        {
            var startDay       = ((int)start.DayOfWeek == 0) ? 7 : (int)start.DayOfWeek;
            var endDay         = ((int)end.DayOfWeek == 0) ? 7 : (int)end.DayOfWeek;
            var locationEndDay = (int)employee.Location.EndDay;

            if (startDay > locationEndDay || endDay > locationEndDay)
            {
                return(false);
            }

            TimeRange workingHours = new TimeRange(TimeTrim.Hour(start, int.Parse(employee.Location.StartHour)), TimeTrim.Hour(start, int.Parse(employee.Location.EndHour)));

            return(workingHours.HasInside(new TimeRange(start, end)));
        }
        public static string ValidateNoAppoinmentClash(IStudioDbContext context, IAppointmentCommand appointment)
        {
            var appointments = context.Appointments.Where(x => x.EmployeeId == appointment.EmployeeId && x.IsDeleted != true);

            foreach (var item in appointments)
            {
                if (item.ReservationTime.ToShortTimeString() == appointment.ReservationTime.Value.ToShortTimeString() && item.ReservationDate.ToShortDateString() == appointment.ReservationDate.ToShortDateString())
                {
                    string errorMessage = string.Format(
                        GConst.ClashAppointmentMessage,
                        item.Employee.FirstName,
                        item.ReservationDate.ToShortDateString(),
                        item.ReservationTime.ToShortTimeString());
                    return(errorMessage);
                }
            }

            return(string.Empty);
        }
 public GetEmployeesByLocationListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Beispiel #5
0
 public GetAllEmployeeServicesListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Beispiel #6
0
 public GetAvailableAppontmentsQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #7
0
 public CreateEmployeeServiceCommandHandler(IStudioDbContext context, IMediator mediator)
 {
     this.context  = context;
     this.mediator = mediator;
 }
 public GetCountryByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #9
0
 public GetLocationByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public CreateCountryCommandHandler(IStudioDbContext context, IMediator mediator)
 {
     this.context  = context;
     this.mediator = mediator;
 }
Beispiel #11
0
 public GetAddressesNamesForEditListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
 public GetAllLocationIndustriesListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Beispiel #13
0
 public GetAddressByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public GetAppointmentByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #15
0
 public GetAppointmentsByUserIdListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
 public UpdateIndustryCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #17
0
 public GetLocationsNamesListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Beispiel #18
0
 public GetEmployeeByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public DeleteCountryCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #20
0
 public DeleteLocationIndustryCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #21
0
 public UpdateClientCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public UpdateEmployeeCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #23
0
 public DeleteServiceCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #24
0
 public DeleteAddressCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public CreateLocationIndustryCommandHandler(IStudioDbContext context, IMediator mediator)
 {
     this.context  = context;
     this.mediator = mediator;
 }
Beispiel #26
0
 public UpdateLocationCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
 public UpdateAppointmentCommandHandler(IStudioDbContext context)
 {
     this.context = context;
 }
Beispiel #28
0
 public GetAllClientsListQueryHandler(IStudioDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
 public GetClientByIdQueryHandler(IStudioDbContext context)
 {
     this.context = context;
 }