public void TestGetSetStartTime() { Schedule r = new Schedule(); DateTime d = new DateTime(2013, 2, 3); r.Start_time = d; Assert.True(r.Start_time == d); }
public UserControl_AddSchedule(Appointment selectedAppt, UserControl_ScheduleView parentUC) { InitializeComponent(); schedule = new Schedule(); sidLabel.Content = selectedAppt.Url; startDateTimePicker.SelectedValue = selectedAppt.Start; endDateTimePicker.SelectedValue = selectedAppt.End; EmpID.Text = selectedAppt.Body; wards = Ward.GetWards(); WardName.ItemsSource = wards; foreach (Ward i in wards) { if ((selectedAppt.Location.ToString()).CompareTo(i.WardName.ToString()) == 0) { WardName.SelectedItem = i; } } employee = Employee.GetEmployees(); foreach (Employee i in employee) { EmpID.Items.Add(i.Fname); } foreach (Employee i in employee) { if (selectedAppt.Body.CompareTo(i.Eid.ToString()) == 0) { EmpID.SelectedItem = i.Fname; } } _isSelected = true; SaveButton.Click += SaveButton_Click; CancelButton.Click += CancelButton_Click; ParentScheduleWindow = parentUC as UserControl_ScheduleView; }
public void TestScheduleCheckforInsertConflicts() { int nextEid = Employee.GenerateNextEid(); Schedule s1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 11, 0, 0), new DateTime(2013, 4, 1, 12, 30, 0), nextEid, "A"); s1.Insert(); Schedule overlapAfterS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 12, 0, 0), new DateTime(2013, 4, 1, 13, 0, 0), nextEid, "B"); Assert.False(overlapAfterS1.CheckforInsertConflicts()); Schedule overlapBeforeS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 10, 0, 0), new DateTime(2013, 4, 1, 12, 0, 0), nextEid, "B"); Assert.False(overlapBeforeS1.CheckforInsertConflicts()); Schedule insideS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 11, 30, 1), new DateTime(2013, 4, 1, 12, 0, 0), nextEid, "B"); Assert.False(insideS1.CheckforInsertConflicts()); Schedule containsS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 10, 0, 0), new DateTime(2013, 4, 1, 13, 0, 0), nextEid, "B"); Assert.False(containsS1.CheckforInsertConflicts()); Schedule noS1Overlap = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 13, 0, 0), new DateTime(2013, 4, 1, 14, 0, 0), Employee.GenerateNextEid(), "B"); Assert.True(noS1Overlap.CheckforInsertConflicts()); s1.Delete(); }
public UserControl_AddSchedule(Slot selectedSlot, UserControl_ScheduleView parentUC) { InitializeComponent(); sidLabel.Content = Schedule.GenerateNextSid(); schedule = new Schedule(); startDateTimePicker.SelectedValue = selectedSlot.Start; endDateTimePicker.SelectedValue = selectedSlot.End; wards = Ward.GetWards(); WardName.ItemsSource = wards; WardName.SelectedIndex = 0; employee = Employee.GetEmployees(); foreach(Employee i in employee){ EmpID.Items.Add(i.Fname); } EmpID.SelectedIndex = 0; SaveButton.Click += SaveButton_Click; CancelButton.Click += CancelButton_Click; ParentScheduleWindow = parentUC as UserControl_ScheduleView; }
public void TestGetSetWard() { Schedule r = new Schedule(); r.Ward = "UTW"; Assert.True(r.Ward == "UTW"); }
public void TestGetSetSid() { Schedule s = new Schedule(); s.Sid = 1; Assert.True(s.Sid == 1); }
public void TestGetSetEmployee() { Schedule r = new Schedule(); r.Employee = 1; Assert.True(r.Employee == 1); }
public void TestScheduleUpdate() { Schedule s = new Schedule(Schedule.GenerateNextSid(), new DateTime(), new DateTime(), 1, "STW"); s.Insert(); s.Start_time = new DateTime(2014, 10, 2); Assert.True(s.Update()); s.Delete(); }
public void TestScheduleSelectForAllAppointments() { Schedule s = new Schedule(Schedule.GenerateNextSid(), new DateTime(), new DateTime(), 1, "STW"); s.Insert(); ObservableCollection<Appointment> appts = Schedule.Select(); Assert.True(appts.Count >= 1); s.Delete(); }
public void TestScheduleInsert() { Schedule s = new Schedule(Schedule.GenerateNextSid(), new DateTime(), new DateTime(), 1, "STW"); Assert.True(s.Insert()); s.Delete(); }
void Schedule_DeleteButton_Click(object sender, RoutedEventArgs e) { IOccurrence selectedAppt = scheduleView.SelectedAppointment; Appointment sel = selectedAppt as Appointment; Schedule sch = new Schedule(); sch.Sid = Convert.ToInt32(sel.Url); sch.Delete(); // Refresh view ObservableCollection<Appointment> appointments = new ObservableCollection<Appointment>(); appointments = Schedule.Select(); scheduleView.AppointmentsSource = appointments; }