private void CurrentMonthDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { workingDay.IsEnabled = true; ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; if (term == null) { if (lastSelectedTerm.IsWorkingDay == true) { workingDay.IsChecked = true; } else { workingDay.IsChecked = false; } } else if (term.IsWorkingDay == true) { workingDay.IsChecked = true; } else { workingDay.IsChecked = false; } }
public void CreateTerms(string text) { string[] pom = text.Split(")"); foreach (var item in pom) { if (item.Length < 5) { break; } string[] table = item.Split(","); int x = 0; if (table.Length > 7) { x++; } ClassTerm term = new ClassTerm(); term.StartTime = TimeSpan.Parse(table[x].Split("'")[1]); term.EndTime = TimeSpan.Parse(table[x + 1].Split("'")[1]); string[] date = table[x + 2].Split("'")[1].Split("-"); term.Date = new DateTime(int.Parse(date[0]), int.Parse(date[1]), int.Parse(date[2])); term.CalendarDoctor = new ClassCalendarDoctor(); term.CalendarDoctor.CalendarDoctorId = int.Parse(table[x + 3]); term.CalendarDay = new ClassCalendarDay(); term.CalendarDay.CalendarDayId = int.Parse(table[x + 4]); term.Office = new ClassOffice(); term.Office.OfficeNumber = int.Parse(table[x + 5]); term.Doctor = new Przychodnia.Class.DictionariesHanding.ClassDoctor(); term.Doctor.Doctor_id = int.Parse(table[x + 6]); term.TermId = NextTermId; NextTermId++; ListTerm.Add(term); } }
public SqlAppointment() { ClassAppointment cA1 = new ClassAppointment(); cA1.AppointmendtId = 1; cA1.Description = "badania1"; cA1.Doctor = new ClassDoctor(); cA1.Doctor.Doctor_id = 1; cA1.Topic = "badania1"; cA1.Term = new ClassTerm(); cA1.Term.Date = new DateTime(1); cA1.Patient = new ClassPatient(); cA1.Patient.PatientId = 1; cA1.Patient.Name = "Waldek"; cA1.Patient.Surname = "wotal"; listAppointment.Add(cA1); ClassAppointment cA2 = new ClassAppointment(); cA2.AppointmendtId = 2; cA2.Description = "badania2"; cA2.Doctor = new ClassDoctor(); cA2.Doctor.Doctor_id = 2; cA2.Topic = "badania2"; cA2.Term = new ClassTerm(); cA2.Term.Date = new DateTime(1); cA2.Patient = new ClassPatient(); cA2.Patient.PatientId = 2; cA2.Patient.Name = "Wojtek"; cA2.Patient.Surname = "kona"; listAppointment.Add(cA2); ClassTerm t1 = new ClassTerm(); t1.TermId = 1; t1.StartTime = new TimeSpan(7, 0, 0); t1.EndTime = new TimeSpan(19, 0, 0); t1.Date = new DateTime(2021, 6, 12); listTerm.Add(t1); ClassTerm t2 = new ClassTerm(); t2.TermId = 2; t2.StartTime = new TimeSpan(7, 0, 0); t2.EndTime = new TimeSpan(19, 0, 0); t2.Date = new DateTime(2021, 7, 12); listTerm.Add(t2); }
private void availableDates_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (availableDates.SelectedItem != null) { ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; RefreshLastSelectedItems(term); ClassSqlCalendar.UpdateTerm(((ClassCalendarDay)availableDates.SelectedItem).CalendarDayId, ((ClassCalendarDay)availableDates.SelectedItem).Date, lastSelectedTerm.TermId); CurrentMonthDataGrid.ItemsSource = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id); CurrentMonthDataGrid.SelectedIndex = lastSelectedIndex; checkBoxChangeDay.IsChecked = false; } }
public void CreateTerm(TimeSpan startTime, TimeSpan endTime, int CalendarDoctorId, int CalendarDayId, int OfficeId, int doctorID, DateTime Date) { ClassTerm term = new ClassTerm(); term.StartTime = startTime; term.EndTime = endTime; term.CalendarDoctor = new ClassCalendarDoctor(); term.CalendarDoctor.CalendarDoctorId = CalendarDoctorId; term.CalendarDay = new ClassCalendarDay(); term.CalendarDay.CalendarDayId = CalendarDayId; term.Office = new ClassOffice(); term.Office.OfficeId = OfficeId; term.Doctor = new ClassDoctor(); term.Doctor.Doctor_id = doctorID; term.Date = Date; ListTerm.Add(term); }
private void CheckBoxWorkingDay_Unchecked(object sender, RoutedEventArgs e) { if (lastSelectedTerm != null) { workingDayFrom.IsEnabled = false; workingDayTo.IsEnabled = false; ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; RefreshLastSelectedItems(term); lastSelectedTerm.IsWorkingDay = false; ListOfTerms.RemoveAt(CurrentMonthDataGrid.SelectedIndex); ListOfTerms.Insert(CurrentMonthDataGrid.SelectedIndex, term); RefreshDataGrid(); workingDayFrom.ItemsSource = null; workingDayTo.ItemsSource = null; } }
private void CheckBoxWorkingDay_Checked(object sender, RoutedEventArgs e) { if (lastSelectedTerm != null) { workingDayFrom.IsEnabled = true; workingDayTo.IsEnabled = true; ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; RefreshLastSelectedItems(term); lastSelectedTerm.IsWorkingDay = true; ListOfTerms.RemoveAt(CurrentMonthDataGrid.SelectedIndex); ListOfTerms.Insert(CurrentMonthDataGrid.SelectedIndex, lastSelectedTerm); RefreshDataGrid(); workingDayFrom.ItemsSource = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 0, 0), new TimeSpan(19, 45, 0)); workingDayFrom.SelectedItem = lastSelectedTerm.StartTime; workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 15, 0), new TimeSpan(20, 0, 0)); workingDayTo.SelectedItem = lastSelectedTerm.EndTime; } }
public SqlCalendar() { #region Calendar ClassTerm t1 = new ClassTerm(); t1.TermId = 1; t1.CalendarDay = new ClassCalendarDay(); t1.CalendarDoctor = new ClassCalendarDoctor(); t1.CalendarDoctor.CalendarDoctorId = 1; t1.CalendarDay.CalendarDayId = 1; t1.StartTime = new TimeSpan(12, 0, 0); t1.EndTime = new TimeSpan(18, 0, 0); t1.Date = new DateTime(2000, 3, 5); t1.Doctor = new ClassDoctor(); t1.Doctor.Doctor_id = 1; t1.IsWorkingDay = true; ListTerm.Add(t1); ClassTerm t2 = new ClassTerm(); t2.TermId = 2; t2.CalendarDay = new ClassCalendarDay(); t2.CalendarDay.CalendarDayId = 5; t2.CalendarDoctor = new ClassCalendarDoctor(); t2.CalendarDoctor.CalendarDoctorId = 2; t2.StartTime = new TimeSpan(8, 0, 0); t2.EndTime = new TimeSpan(15, 0, 0); t2.Date = new DateTime(2000, 3, 7); t2.Doctor = new ClassDoctor(); t2.Doctor.Doctor_id = 2; t2.IsWorkingDay = true; ListTerm.Add(t2); ClassCalendarDoctor c1 = new ClassCalendarDoctor(); c1.CalendarDoctorId = 1; c1.Doctor = new ClassDoctor(); c1.Doctor.Doctor_id = 5; c1.Calendar = new ClassCalendar(); c1.Calendar.CalendarId = 4; ClassCalendarDoctor c2 = new ClassCalendarDoctor(); c2.CalendarDoctorId = 4; c2.Doctor = new ClassDoctor(); c2.Doctor.Doctor_id = 6; c2.Calendar = new ClassCalendar(); c2.Calendar.CalendarId = 3; ListCalendarForDoctor = new List <ClassCalendarDoctor>() { c1, c2 }; #endregion }
public SqlCalendar() { #region Office ClassOffice o1 = new ClassOffice(); o1.OfficeId = 1; o1.OfficeNumber = 100; ClassOffice o2 = new ClassOffice(); o1.OfficeId = 2; o1.OfficeNumber = 200; ListOffice = new List <ClassOffice>() { o1, o2 }; #endregion #region Status ClassStatus s1 = new ClassStatus(); s1.StatusId = 1; s1.Status = "New"; ClassStatus s2 = new ClassStatus(); s2.StatusId = 2; s2.Status = "Shared for doctors"; ClassStatus s3 = new ClassStatus(); s3.StatusId = 3; s3.Status = "During verification"; ClassStatus s4 = new ClassStatus(); s4.StatusId = 4; s4.Status = "Verified"; ClassStatus s5 = new ClassStatus(); s5.StatusId = 5; s5.Status = "Waiting for administrator acceptance"; ClassStatus s6 = new ClassStatus(); s6.StatusId = 6; s6.Status = "During verification by the doctor"; ClassStatus s7 = new ClassStatus(); s7.StatusId = 7; s7.Status = "Accepted by the doctor"; ListStatus = new List <ClassStatus>() { s1, s2, s3, s4, s5, s6, s7 }; #endregion #region Doctor ClassDoctor dct1 = new ClassDoctor(); dct1.Active = true; dct1.Doctor_id = 1; dct1.Name = "Jan"; dct1.Surname = "Nowak"; dct1.OfficeNumber = 100; ClassDoctor dct2 = new ClassDoctor(); dct2.Active = true; dct2.Doctor_id = 2; dct2.Name = "Tomasz"; dct2.Surname = "Kowalski"; dct2.OfficeNumber = 200; ListDoctor = new List <ClassDoctor>() { dct1, dct2 }; #endregion #region FixedTerms ClassFixedTerms ft1 = new ClassFixedTerms(); ft1.Day = 2; ft1.Start = new TimeSpan(8, 0, 0); ft1.End = new TimeSpan(12, 0, 0); ft1.DoctorId = 1; ClassFixedTerms ft2 = new ClassFixedTerms(); ft2.Day = 3; ft2.Start = new TimeSpan(13, 0, 0); ft2.End = new TimeSpan(15, 0, 0); ft2.DoctorId = 2; ListFixedTerms = new List <ClassFixedTerms>() { ft1, ft2 }; #endregion #region Calendar ClassCalendar c1 = new ClassCalendar(); c1.Year = 2000; c1.Month = 2; c1.CalendarId = 1; c1.Status = new ClassStatus(); c1.Status.StatusId = 1; ListCalendar.Add(c1); ClassCalendar c2 = new ClassCalendar(); c2.Year = 2000; c2.Month = 3; c2.CalendarId = 2; c2.Status = new ClassStatus(); c2.Status.StatusId = 3; ListCalendar.Add(c2); ClassCalendar c3 = new ClassCalendar(); c3.Year = 2000; c3.Month = 4; c3.CalendarId = 3; c3.Status = new ClassStatus(); c3.Status.StatusId = 1; ListCalendar.Add(c3); #endregion #region Calendar Doctor ClassCalendarDoctor cd1 = new ClassCalendarDoctor(); cd1.Calendar = new ClassCalendar(); cd1.Calendar.CalendarId = 2; cd1.CalendarDoctorId = 1; cd1.Doctor = new ClassDoctor(); cd1.Doctor.Doctor_id = 1; cd1.Status = new ClassStatus(); cd1.Status.StatusId = 7; ListCalendarDoctor.Add(cd1); ClassCalendarDoctor cd2 = new ClassCalendarDoctor(); cd2.Calendar = new ClassCalendar(); cd2.Calendar.CalendarId = 2; cd2.CalendarDoctorId = 2; cd2.Doctor = new ClassDoctor(); cd2.Doctor.Doctor_id = 2; cd2.Status = new ClassStatus(); cd2.Status.StatusId = 7; ListCalendarDoctor.Add(cd2); #endregion #region Calendar Day ClassCalendarDay d1 = new ClassCalendarDay(); d1.Calendar = new ClassCalendar(); d1.Calendar.CalendarId = 1; d1.CalendarDayId = 1; d1.Day = 1; d1.StartTime = new TimeSpan(7, 0, 0); d1.EndTime = new TimeSpan(20, 0, 0); ListCalendarDay.Add(d1); ClassCalendarDay d2 = new ClassCalendarDay(); d2.Calendar = new ClassCalendar(); d2.Calendar.CalendarId = 1; d2.CalendarDayId = 2; d2.Day = 2; d2.StartTime = new TimeSpan(7, 0, 0); d2.EndTime = new TimeSpan(20, 0, 0); ListCalendarDay.Add(d2); ClassCalendarDay d3 = new ClassCalendarDay(); d3.Calendar = new ClassCalendar(); d3.Calendar.CalendarId = 2; d3.CalendarDayId = 3; d3.Day = 1; d3.StartTime = new TimeSpan(7, 0, 0); d3.EndTime = new TimeSpan(20, 0, 0); ListCalendarDay.Add(d3); ClassCalendarDay d4 = new ClassCalendarDay(); d4.Calendar = new ClassCalendar(); d4.Calendar.CalendarId = 2; d4.CalendarDayId = 4; d4.Day = 7; d4.StartTime = new TimeSpan(7, 0, 0); d4.EndTime = new TimeSpan(20, 0, 0); ListCalendarDay.Add(d4); #endregion #region Term ClassTerm t1 = new ClassTerm(); t1.TermId = 1; t1.CalendarDay = new ClassCalendarDay(); t1.CalendarDay = d3; t1.CalendarDoctor = cd1; t1.Date = new DateTime(2000, 3, 1); t1.Doctor = dct1; t1.StartTime = new TimeSpan(8, 0, 0); t1.EndTime = new TimeSpan(12, 0, 0); t1.Office = new ClassOffice(); t1.Office.OfficeNumber = 100; ListTerm.Add(t1); ClassTerm t2 = new ClassTerm(); t2.TermId = 2; t2.CalendarDay = new ClassCalendarDay(); t2.CalendarDay = d4; t2.CalendarDoctor = cd2; t2.Date = new DateTime(2000, 3, 7); t2.Doctor = dct2; t2.StartTime = new TimeSpan(13, 0, 0); t2.EndTime = new TimeSpan(15, 0, 0); t2.Office = new ClassOffice(); t2.Office.OfficeNumber = 200; ListTerm.Add(t2); #endregion }
private void RefreshLastSelectedItems(ClassTerm term) { lastSelectedTerm = term; lastSelectedIndex = CurrentMonthDataGrid.SelectedIndex; }
private void CurrentMonthDataGrid_LostFocus(object sender, RoutedEventArgs e) { ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; RefreshLastSelectedItems(term); }