protected override async Task InitializeAsync() { if (_appointmentId.HasValue) { Appointment = await _client.AppointmentsService.GetAsync(_appointmentId.Value); } }
internal async Task CreateNewAppointment(ClinicAppointment appointment) { await this.client.AppointmentsService.PostAsync(appointment); }
public async void CreateNewAppointment() { if (this.Patient == null || this.Doctor == null || this.SelectedAppointment == null) return; IsCreatingAppointment = true; ClinicAppointment clinicAppointment = new ClinicAppointment(); clinicAppointment.Patient = Patient; clinicAppointment.PatientId = Patient.PatientId; clinicAppointment.Doctor = this.Doctor; clinicAppointment.DoctorId = this.Doctor.DoctorId; clinicAppointment.TenantId = this.Doctor.TenantId; clinicAppointment.Speciality = this.Doctor.Speciality; clinicAppointment.RoomNumber = this.SelectedAppointment.RoomNumber; clinicAppointment.DateTime = this.SelectedAppointment.StartTime.ToUniversalTime(); clinicAppointment.Description = "Follow up in order to determine the effectiveness of treatment received"; clinicAppointment.IsUrgent = this.SelectedAppointment.IsUrgent; await this.CreateNewAppointment(clinicAppointment); IsCreatingAppointment = false; NavigationHelper.NavigateToPatientInfo(); }
public async Task<int> PostAsync(ClinicAppointment appointment) { string url = $"{_UrlPrefix}api/clinicappointments"; return await PostAsync<int, ClinicAppointment>(url, appointment); }
async Task CreateNewAppointmentAsync() { try { IsBusy = true; var patient = await client.PatientsService.GetAsync( AppSettings.DefaultPatientId); int roomNumber = _random.Next(AppSettings.MinimumRoomNumber, AppSettings.MaximumRoomNumber); var appointment = new ClinicAppointment { PatientId = patient.PatientId, DoctorId = _selectedDoctor.DoctorId, TenantId = _selectedDoctor.TenantId, Speciality = _selectedDoctor.Speciality, DateTime = _selectedAppointmentDateAndHour, Description = AppSettings.DefaultAppointmentDescription, RoomNumber = roomNumber }; await client.AppointmentsService.PostAsync(appointment); if (!string.IsNullOrEmpty(MicrosoftGraphService.LoggedInUserEmail)) { // Add the event to the patient's calendar await MicrosoftGraphService.AddEventUsingRestApiAsync( subject: "Clinic Appointment with " + _selectedDoctor.Name, startTime: _selectedAppointmentDateAndHour, endTime: _selectedAppointmentDateAndHour + TimeSpan.FromMinutes(45), attendeeEmails: new string[0], description: AppSettings.DefaultAppointmentDescription, locationDisplayName: $"Room {roomNumber}"); // Add the events to the doctor's calendar. var @event = new Office365.Appointment { DoctorPrincipalName = _selectedDoctor.Email, Subject = "Clinic Appointment with " + patient.Name, Description = AppSettings.DefaultAppointmentDescription, PatientEmail = patient.Email, Start = _selectedAppointmentDateAndHour, LengthInMinutes = 45, Location = $"Room {roomNumber}" }; //TODO: Uncomment to enable doctor calendar integration. //await client.DoctorCalendarService.PostAsync(@event); } await dialogService.AlertAsync("The appointment was created successfully.", "New appointment", OkText); } finally { IsBusy = false; } }