Beispiel #1
0
 private void AddSession()
 {
     if (MessageBox.Show("Are you sure", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         var sessions = SessionService.GetAllSessions().Where(d => d.CourseId == SelectedCourse.Id);
         if (ScheduleConflict(sessions))
         {
             //if Session Start is within Start and End of existing session for the same course - there is a schedule conflict and the operation must not be allowed
             MessageBox.Show("Schedule Conflict");
             return;
         }
         //create location from strings
         var address = AddressService.AddAddress(new Address()
         {
             ZipCode = VenueAddress,
         });
         var location = LocationService.AddLocation(new Location()
         {
             Address  = address,
             Capacity = VenueCapacity
         });
         Session = SessionService.AddSession(Session);
         var sessionLocation = SessionLocationService.Add(new Session_Location()
         {
             Session  = Session,
             Location = location
         });
         BackProc();
     }
 }
Beispiel #2
0
        private void AddSessionAndLocation()
        {
            var randomCourse  = CourseService.GetAllCourses()[random.Next(100)];
            var randomAddress = AddressService.GetAllAdresses()[random.Next(100)];
            var newLocation   = LocationService.AddLocation(new Location()
            {
                Address = randomAddress,
            });
            var addedSession = new Session()
            {
                Course = randomCourse
            };

            SessionService.AddSession(addedSession);
            SessionLocationService.Add(new Session_Location()
            {
                Session  = addedSession,
                Location = newLocation
            });
        }