/// <summary> /// Retrieves a single <see cref='EventModel' /> instance. /// </summary> /// <param name="courseParentId"> /// The value which identifies the <see cref='EventModel' /> instance to be returned. /// </param> /// <returns> /// The <see cref='EventModel' /> instance that match the specified <paramref name='courseParentId' />. /// </returns> public LocalEventModel FetchByCourseParentId(String courseParentId) { CourseRecord record = this.Provider.DataProvider.Learning.Event.FetchByCourseParentId(courseParentId); LocalEventModel model = record == null ? null : new LocalEventModel(this.Provider, record); return(model); }
public LocalSessionModel CreateFromEvent(String eventId) { LocalSessionModel session = this.Create(); LocalEventModel eventModel = this.Provider.Learning.Event.FetchById(eventId); if (eventModel != null) { session.ProductId = eventModel.ProductId; session.Name = eventModel.Product.Name; session.MaxPlaces = eventModel.MaxPlaces; session.MinPlaces = eventModel.MinPlaces; session.FreePlaces = eventModel.FreePlaces; session.ActionDate = eventModel.StartDate; session.EndDate = session.ActionDate.Value.AddDays(eventModel.Product.CourseLen.HasValue ? eventModel.Product.CourseLen.Value : 0); session.OrganisationId = eventModel.OrganisationId; session.LocationId = eventModel.LocationId; session.Address = eventModel.Address.MailString; session.SellingCompanyId = eventModel.SellingCompanyId; session.SessionXrefActivity.Add(this.Provider.Learning.SessionXref.Create()); } return(session); }