private void Refresh() { _patientList = new ObservableCollection<Patient>(App.amApp.Patients); _practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners); _appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments.Where(h=>h.Patient==Id)); _queueList = new ObservableCollection<Queue>(App.amApp.Queues); appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString(); AppointmentlistView.ItemsSource = null; _appointment = new Appointment(null); ListQueue.Clear(); ListAppoint.Clear(); foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text)) { _appointment = new Appointment(null); _appointment.Id = T.Id; _appointment.Org = T.Org; _appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "HOURS: \t " + T.StartTime + "-END" + T.EndTime + Environment.NewLine + "REASON : \t" + T.Reason + Environment.NewLine + "Notify : \t" + T.Reminder; _appointment.Practitioner = T.Practitioner; _appointment.Patient = T.Patient; _appointment.Dated = T.Dated; _appointment.StartTime = T.StartTime; _appointment.EndTime = T.EndTime; _appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image; _appointment.Reason = T.Reason; ListAppoint.Add(_appointment); } AppointmentlistView.ItemsSource = ListAppoint; }
private void Refresh() { _patientList = new ObservableCollection<Patient>(App.amApp.Patients); _practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners); _appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments); _queueList = new ObservableCollection<Queue>(App.amApp.Queues); appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString(); queuecount.Content = "People in queue :" + _queueList.Where(k => Convert.ToDateTime(k.Day).Date == Convert.ToDateTime(selectdate.Text).Date).Count().ToString(); QueuelistView.ItemsSource = null; AppointmentlistView.ItemsSource = null; _appointment = new Appointment(null); ListQueue.Clear(); ListAppoint.Clear(); foreach (Queue Q in _queueList.Where(m => Convert.ToDateTime(m.Day).Date == Convert.ToDateTime(selectdate.Text).Date && m.Seen=="F")) { _queue = new Queue(null); _queue.Id = Q.Id; _queue.Org = Q.Org; _queue.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(Q.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(Q.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(Q.Practitioner)).Name + " " + Environment.NewLine + "TIME :" + Q.Checked + Environment.NewLine + "REASON: \t" + Q.Reason + " " + Environment.NewLine + "State:" + Q.Seen + " Amount paid:" + Q.Amount; ; _queue.Practitioner = Q.Practitioner; _queue.Patient = Q.Patient; _queue.Patientimage = _patientList.First(x => x.Id.Equals(Q.Patient)).Image; _queue.Payment = Q.Payment; _queue.Amount = Q.Amount; _queue.Checked = Convert.ToDateTime(Q.Checked).ToString("T"); _queue.Reason = Q.Reason; ListQueue.Add(_queue); } //apointment list view QueuelistView.ItemsSource = ListQueue; foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text)) { _appointment = new Appointment(null); _appointment.Id = T.Id; _appointment.Org = T.Org; _appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "PERIOD: \t \t " + T.Meet + "-" + T.EndTime +" "+ Environment.NewLine + " REASON : \t" + T.Reason; _appointment.Practitioner = T.Practitioner; _appointment.Patient = T.Patient; _appointment.Dated = T.Dated; _appointment.StartTime = T.StartTime; _appointment.EndTime = T.EndTime; _appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image; _appointment.Reason = T.Reason; ListAppoint.Add(_appointment); } AppointmentlistView.ItemsSource = ListAppoint; }
public static void Remind() { string selectdate = DateTime.Now.Date.ToString(); _appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments); _patientList = new ObservableCollection<Patient>(App.amApp.Patients); _practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners); foreach (Appointment T in _appointmentList) { if (T.Reminder == "false") { if (Convert.ToDateTime(T.Dated).Date == Convert.ToDateTime(selectdate).Date) Messenger.Send(App.amApp, "Reminder You are reminded of your appointment with a " + _practitionerList.First(x => x.Id == T.Practitioner).Practice + " on:" + T.Dated + " at:" + T.Meet + "to " + T.EndTime + " ", _patientList.First(x => x.Id == T.Patient.ToString()).Phone); _appointment = new Appointment(null); _appointment.UpdateReminder(T.Id, "true"); } } }
private void SaveAppointment() { string fmt = "00"; int period = Convert.ToInt32(endHour.Text) - Convert.ToInt32(startHour.Text); _appointment = App.amApp.Appointments.Add(); string build = startHour.Text; for (int p = 0; p <= period; p++) { build += (Convert.ToInt32(startHour.Text) + p).ToString(fmt) + " "; } if (ChkNotify.IsChecked == true) { _appointment.Reminder = "false"; } else { _appointment.Reminder = "true"; } _appointment.Patient = patient.Content.ToString(); _appointment.Practitioner = selectedPrac; _appointment.Dated = startDate.Text; _appointment.StartTime = build; _appointment.Meet = startHour.Text +":" + startMin.Text; _appointment.EndTime = endHour.Text + ":" + endMin.Text; _appointment.Reason = reason.Text; _appointment.Sync = "F"; _appointment.Org = "test"; _appointment.Save(); System.Windows.MessageBox.Show("Appointment created "); this.DialogResult = true; }