Example #1
0
        public void TestScheduleCheckforUpdateConflicts()
        {
            int nextId = Schedule.GenerateNextSid();

            Schedule s1 = new Schedule(nextId, new DateTime(2013, 4, 1, 11, 0, 0), new DateTime(2013, 4, 1, 12, 30, 0), 1, "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), 2, "B");
            Assert.False(overlapAfterS1.CheckforUpdateConflicts());

            Schedule overlapBeforeS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 10, 0, 0), new DateTime(2013, 4, 1, 12, 0, 0), 2, "B");
            Assert.False(overlapBeforeS1.CheckforUpdateConflicts());

            Schedule insideS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 11, 30, 1), new DateTime(2013, 4, 1, 12, 0, 0), 2, "B");
            Assert.False(insideS1.CheckforUpdateConflicts());

            Schedule containsS1 = new Schedule(Schedule.GenerateNextSid(), new DateTime(2013, 4, 1, 10, 0, 0), new DateTime(2013, 4, 1, 13, 0, 0), 2, "B");
            Assert.False(containsS1.CheckforUpdateConflicts());

            Schedule noS1Overlap = new Schedule(nextId, new DateTime(2013, 4, 1, 13, 0, 0), new DateTime(2013, 4, 1, 14, 0, 0), 2, "B");
            Assert.True(noS1Overlap.CheckforUpdateConflicts());

            s1.Delete();
        }
Example #2
0
        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();
        }
Example #3
0
        public void TestScheduleInsert()
        {
            Schedule s = new Schedule(Schedule.GenerateNextSid(), new DateTime(), new DateTime(), 1, "STW");
            Assert.True(s.Insert());

            s.Delete();
        }
Example #4
0
        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();
        }
 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;
 }