Exemple #1
0
        private void TBPatientName_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (TBPatientName == null || string.IsNullOrWhiteSpace(TBPatientName.Text))
            {
                doctor_scheduleViewSource.View.Filter = null;
                return;
            }
            else
            {
                string txt = TBPatientName.Text.ToString().ToLower();
                doctor_scheduleViewSource.View.Filter = item =>
                {
#pragma warning disable IDE0019 // Use pattern matching
                    doctor_schedule m = item as doctor_schedule;
#pragma warning restore IDE0019 // Use pattern matching
                    if (m != null)
                    {
                        if (!string.IsNullOrWhiteSpace(m.Patient) && m.Patient.ToLower().Contains(txt))
                        {
                            return(true);
                        }
                    }
                    return(false);
                };
            }
        }
Exemple #2
0
 private void btDelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (clinicEntities context = new clinicEntities())
         {
             doctor_schedule app           = (doctor_schedule)doctor_scheduleDataGrid.SelectedItem;
             int             timeslot      = app.slotId;
             int             appointmentId = app.appointmentId;
             var             app1          = context.appointments.Find(appointmentId);
             context.timeslots.Find(timeslot).IsAvailable = true;
             context.appointments.Remove(app1);
             MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure to delete this appointment?", "Delete Confirmation", MessageBoxButton.YesNo);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 context.SaveChanges();
                 MessageBox.Show("the appointment is deleted");
                 context.doctor_schedule.Load();
                 doctor_scheduleViewSource.Source = context.doctor_schedule.Local;
             }
         }
     }
     catch
     {
         MessageBox.Show("there is no appointment selected");
     }
 }
        private void dpFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dpFrom.SelectedDate == null)
            {
                doctor_scheduleViewSource.View.Filter = null;
                return;
            }
            else
            {
                doctor_scheduleViewSource.View.Filter = item =>
                {
#pragma warning disable IDE0019 // Use pattern matching
                    doctor_schedule m = item as doctor_schedule;
#pragma warning restore IDE0019 // Use pattern matching
                    if (m != null)
                    {
                        if (m.SlotStart > dpFrom.SelectedDate)
                        {
                            return(true);
                        }
                    }
                    return(false);
                };
            }
        }
Exemple #4
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     context.doctor_schedule.Load();
     doctor_scheduleViewSource.Source      = context.doctor_schedule.Local;
     doctor_scheduleViewSource.View.Filter = item =>
     {
         doctor_schedule m = item as doctor_schedule;
         if (m != null)
         {
             if (m.DoctorId.Equals(Globals.SessionId))
             {
                 return(true);
             }
         }
         return(false);
     };
 }
Exemple #5
0
        private void dpFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dpFrom.SelectedDate == null)
            {
                doctor_scheduleViewSource.View.Filter = null;
                return;
            }
            else
            {
                doctor_scheduleViewSource.View.Filter = item =>
                {
                    doctor_schedule m = item as doctor_schedule;

                    if (m != null)
                    {
                        if (m.Start >= dpFrom.SelectedDate)
                        {
                            return(true);
                        }
                    }
                    return(false);
                };
            }
        }
Exemple #6
0
        private void dpTo_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dpTo.SelectedDate == null)
            {
                doctor_scheduleViewSource.View.Filter = null;
                return;
            }
            else
            {
                doctor_scheduleViewSource.View.Filter = item =>
                {
                    doctor_schedule m = item as doctor_schedule;

                    if (m != null)
                    {
                        if (m.End <= dpTo.SelectedDate.Value.AddDays(1))
                        {
                            return(true);
                        }
                    }
                    return(false);
                };
            }
        }