private static TrackSpeaker CreateDxSpeaker(DbModel.Speaker ev) { var speaker = new TrackSpeaker() { Affiliation = ev.Affiliation.ToString(), Email = ev.Email, PicUrl = ev.PicUrl, Profile = ev.Profile, SpeakerId = ev.SpeakerID, SpeakerName = ev.SpeakerName, SpeakerType = ev.Type.ToString(), Title = ev.Title, BlogLink = ev.BlogLink, FacebookLink = ev.FacebookLink, LinkedinLink = ev.LinkedInLink, Location = ev.Location, TwitterLink = ev.TwitterHandle, SpeakerEvents = new ObservableCollection <Event>() }; //foreach (var trackAgenda in ev.TrackAgendas) //{ // var evt = trackAgenda.EventTrack.Event; // if (speaker.SpeakerEvents!=null && speaker.SpeakerEvents.FirstOrDefault(x=>x.EventId==evt.EventID) == null) // { // speaker.SpeakerEvents.Add(EventsController.CreateDxEvent(evt)); // } //} return(speaker); }
private static ObservableCollection <Event> CreateDxSpeaker(DbModel.Speaker ev) { var SpeakerEvents = new ObservableCollection <Event>(); foreach (var trackAgenda in ev.TrackAgendas) { var evt = trackAgenda.EventTrack.Event; if (SpeakerEvents.FirstOrDefault(x => x.EventId == evt.EventID) == null) { try { if (evt.EventToDate.HasValue && (DateTime.Now.Date - evt.EventToDate.Value.Date).TotalDays > 1) { continue; } SpeakerEvents.Add(EventsController.CreateDxEvent(evt)); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } return(SpeakerEvents); }