コード例 #1
0
        private async void AppointmentsListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var appointment = (AppointmentModel)e.SelectedItem;

            var patient = await PatientLogic.GetPatientAsync(General.UserId);

            var fullname = PatientLogic.GetFullName(patient.FirstName, patient.Surname);

            if (allAppointments.Any(a => a.PatientName == fullname && a.PatientID == patient.UserID))
            {
                await DisplayAlert("Appointment", "You already have an appointment booked!", "Okay");
            }
            else
            {
                var symptoms = await DisplayPromptAsync("Book Appointment",
                                                        string.Format("{0}, {1}", appointment.AppointmentTime.ToLongDateString(),
                                                                      appointment.AppointmentTime.ToShortTimeString()),
                                                        "Book", "Close", "Your symptoms ...");

                if (string.IsNullOrEmpty(symptoms))
                {
                }
                else
                {
                    appointment.symtoms      = symptoms;
                    appointment.diagnosis    = string.Empty;
                    appointment.PatientModel = patient;
                    appointment.PatientName  = string.Format("{0} {1}", patient.FirstName, patient.Surname);
                    appointment.PatientID    = patient.UserID;

                    await AppointmentLogic.UpdateCustomerAsync(appointment);
                }
            }
        }
コード例 #2
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            var appointmentLogic = new AppointmentLogic();
            await appointmentLogic.Init();

            var patient = await PatientLogic.GetPatientAsync(General.UserId);

            if (appointmentLogic.AllAppointments.Any(a => a.PatientName == PatientLogic.GetFullName(patient.FirstName, patient.Surname) &&
                                                     !a.Complete && a.PatientID == patient.UserID))
            {
                current = appointmentLogic.GetCurrentAppointment(patient, appointmentLogic.AllAppointments);

                titleLabel.IsVisible   = false;
                loadingLabel.IsVisible = false;
                detailsFrame.IsVisible = true;
                dateSpan.Text          = current.AppointmentTime.ToLongDateString() + ", ";
                timeSpan.Text          = current.AppointmentTime.ToShortTimeString();
                symptomsSpan.Text      = current.symtoms;

                if (current.Confirmed)
                {
                    statusSpan.TextColor = Color.Green;
                    statusSpan.Text      = "confirmed";
                }
                else
                {
                    statusSpan.TextColor = Color.Red;
                    statusSpan.Text      = "Pending";
                }
            }
            else
            {
                titleLabel.IsVisible = true;
                titleLabel.Text      = "You don't have an appointment booked.";
                titleLabel.HorizontalTextAlignment = TextAlignment.Center;
                loadingLabel.IsVisible             = false;
                detailsFrame.IsVisible             = false;
            }
        }