Example #1
0
 public AppointmentTypesController(AppointmentTypeService appointmentTypeService, IMapper mapper,
                                   LinkGenerator linkGenerator)
 {
     _appointmentTypeService = appointmentTypeService;
     _mapper        = mapper;
     _linkGenerator = linkGenerator;
 }
Example #2
0
        protected override async Task OnInitializedAsync()
        {
            SchedulerService.Appointments = await AppointmentService.ListAsync();

            AppointmentTypes = await AppointmentTypeService.ListAsync();

            Clients = await ClientService.ListAsync();

            Rooms = await RoomService.ListAsync();

            // Patients belong to Clients - This should be driven by the selected client
            Patients = await PatientService.ListAsync(ClientId);

            Patient = Patients.FirstOrDefault(p => p.PatientId == PatientId);

            Today = await ConfigurationService.ReadAsync();

            StartDate = UpdateDateToToday(StartDate);
            DayStart  = UpdateDateToToday(DayStart);
            DayEnd    = UpdateDateToToday(DayEnd);

            Groups.Add("Rooms");

            IsLoaded = true;

            await AddPatientImages();

            await InitSignalR();
        }
        protected override async Task OnInitializedAsync()
        {
            Logger.LogInformation($"Initialize AppointmentEditor with appointment starting at {Appointment.Start}");
            Doctors = await DoctorService.ListAsync();

            if (IsAdd)
            {
                Appointment.DoctorId = Doctors[0].DoctorId;
            }

            AppointmentTypes = await AppointmentTypeService.ListAsync();

            if (IsAdd)
            {
                Appointment.AppointmentTypeId = AppointmentTypes[0].AppointmentTypeId;
            }

            // set appointment to current patient if not specified
            if (string.IsNullOrEmpty(Appointment.PatientName))
            {
                Appointment.PatientName = Patient.Name;
                Appointment.PatientId   = Patient.PatientId;
                Appointment.ClientId    = Patient.ClientId;
                Appointment.ClientName  = Patient.ClientName;
                Appointment.Title       = $"(WE) {Appointment.PatientName} - {Appointment.ClientName}";
                Logger.LogInformation("Setting new appointment up for " + Appointment.Title);
            }

            await LoadPicture();
        }
        // GET: AppointmentMessages/Create
        public ActionResult Create()
        {
            PatientService patientService = new PatientService();

            ViewBag.IdPatient = new SelectList(patientService.GetList(), "Id", "FirstName");

            ViewBag.IdAppointmentType = new SelectList(AppointmentTypeService.GetList(), "Id", "Name");

            return(View());
        }
        public void GetDefault_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            var service    = new AppointmentTypeService(repository);

            // Act
            AppointmentTypeModel result = service.GetDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsDefault);
        }
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            var service    = new AppointmentTypeService(repository);

            // Act
            IEnumerable <AppointmentTypeModel> result = service.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.appointmentType.Count(), result.Count());
        }
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            var service    = new AppointmentTypeService(repository);
            int id         = 1;

            // Act
            AppointmentTypeModel result = service.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.Id);
        }
        public void ConvertModelToEntity_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var service = new AppointmentTypeService();
            AppointmentTypeModel model = GetTestModel();

            // Act
            appointmentType entity = service.ConvertModelToEntity(model);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(entity.name, model.Name);
            Assert.AreEqual(entity.isDefault, model.IsDefault);
            Assert.AreEqual(entity.isCurrent, model.IsCurrent);
            Assert.AreEqual(model.Length, entity.length);
        }
        protected override async Task OnInitializedAsync()
        {
            Doctors = await DoctorService.ListAsync();

            if (IsAdd)
            {
                Appointment.DoctorId = Doctors[0].DoctorId;
            }

            AppointmentTypes = await AppointmentTypeService.ListAsync();

            if (IsAdd)
            {
                Appointment.AppointmentTypeId = AppointmentTypes[0].AppointmentTypeId;
            }

            await LoadPicture();
        }
        public void ConvertEntityToModel_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            //var repository = new AppointmentTypeRepository(context);
            var             service = new AppointmentTypeService();
            appointmentType entity  = context.appointmentType.Where(x => x.id == 1).FirstOrDefault();

            // Act
            AppointmentTypeModel model = service.ConvertEntityToModel(entity);

            // Assert
            Assert.IsNotNull(model);
            Assert.AreEqual(model.Id, entity.id);
            Assert.AreEqual(model.Name, entity.name);
            Assert.AreEqual(model.IsDefault, entity.isDefault);
            Assert.AreEqual(model.IsCurrent, entity.isCurrent);
            Assert.AreEqual(model.Length, entity.length);
        }
        // GET: AppointmentMessages/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AppointmentMessage appointmentMessage = _appointmentService.GetById(id.Value);

            PatientService patientService = new PatientService();

            ViewBag.IdPatient = new SelectList(patientService.GetList(), "Id", "FirstName", appointmentMessage?.IdPatient);

            ViewBag.IdAppointmentType = new SelectList(AppointmentTypeService.GetList(), "Id", "Name", appointmentMessage?.IdAppointmentType);

            if (appointmentMessage == null)
            {
                return(HttpNotFound());
            }
            return(View(appointmentMessage));
        }