/// <summary> /// Create a new SessionAttendee object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="eventAttendeeId">Initial value of the EventAttendeeId property.</param> /// <param name="checkedIn">Initial value of the CheckedIn property.</param> /// <param name="rating">Initial value of the Rating property.</param> /// <param name="comment">Initial value of the Comment property.</param> /// <param name="sessionId">Initial value of the SessionId property.</param> public static SessionAttendee CreateSessionAttendee(global::System.Int32 id, global::System.Int32 eventAttendeeId, global::System.String checkedIn, global::System.String rating, global::System.String comment, global::System.Int32 sessionId) { SessionAttendee sessionAttendee = new SessionAttendee(); sessionAttendee.Id = id; sessionAttendee.EventAttendeeId = eventAttendeeId; sessionAttendee.CheckedIn = checkedIn; sessionAttendee.Rating = rating; sessionAttendee.Comment = comment; sessionAttendee.SessionId = sessionId; return sessionAttendee; }
/// <summary> /// Deprecated Method for adding a new object to the SessionAttendees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSessionAttendees(SessionAttendee sessionAttendee) { base.AddObject("SessionAttendees", sessionAttendee); }
public void Save() { BusyMessage = "Saving your Volunteer Tasks...Please wait."; IsBusy = true; var personId = Int32.Parse(App.PersonId); // Business Rule Notes: // we need to Remove the ones that are dragged out, // Add the ones that are dragged in, // and leave the ones alone that were already there // We do we need to process Capacities both coming in and going out? // i.e., only get AvailableTasks that don't have a count of Session Attendee == Session.MacCapacity // or once there is one Sessin Attendee, no longer include that task? // we won't need to do anything with existing saved items: foreach (Session task in AssignedVolunteerTasks) { foreach (Session existingTask in ExistingVolunteerTasks) { if (task.Id == existingTask.Id) { ExistingFoundTasks.Add(task.Id); break; } } } // find any removed from the assigned group foreach (Session existingTask in ExistingVolunteerTasks) { var tId = existingTask.Id; var foundTask = AssignedVolunteerTasks.GetReferenceItem(t => t.Id == tId); if (foundTask.Id == 0) { var attendeeToRemove = VolunteerSessionAttendees.Where(s => s.EventAttendeeId == personId).Where(p => p.SessionId == tId).FirstOrDefault(); var sessionForUpdate = attendeeToRemove.Session; sessionForUpdate.Status = "Unfulfilled"; CodeCampDomainContext.SessionAttendees.Remove(attendeeToRemove); } } // find any new tasks foreach (Session assignedTask in AssignedVolunteerTasks) { var tId = assignedTask.Id; var foundTask = ExistingVolunteerTasks.GetReferenceItem(t => t.Id == tId); if (foundTask.Id == 0) { var attendeeToAdd = new SessionAttendee { EventAttendeeId = personId, SessionId = tId, Rating = "None ", CheckedIn = "N", Comment = "None" }; assignedTask.Status = "Confirmed"; attendeeToAdd.Session = assignedTask; CodeCampDomainContext.SessionAttendees.Add(attendeeToAdd); } } try { CodeCampDomainContext.SubmitChanges(ChangesSubmitted, null); } catch (DomainOperationException dex) { ErrorWindow.CreateNew(dex, StackTracePolicy.OnlyWhenDebuggingOrRunningLocally); _loggingService.LogException(dex); } catch (Exception ex) { ErrorWindow.CreateNew(ex, StackTracePolicy.OnlyWhenDebuggingOrRunningLocally); _loggingService.LogException(ex); } }