Esempio n. 1
0
        public static Speaker AsSpeaker(this OCC.Data.Person p)
        {
            Speaker speaker = new Speaker()
            {
                ID = p.ID,
                Email = p.Email,
                Name = p.FirstName + " " + p.LastName,
                Title = p.Title,
                Bio = p.Bio,
                Website = p.Website,
                Blog = p.Blog,
                Twitter = p.Twitter,
                ImageUrl = p.ImageUrl
            };

            // TODO: copy sessions

            return speaker;
        }
Esempio n. 2
0
        public static Speaker AsSpeaker(this Data.Person p)
        {
            Speaker speaker = new Speaker()
            {
                ID = p.ID,
                Email = p.Email,
                FirstName = p.FirstName,
                LastName = p.LastName,
                Title = p.Title,
                Bio = p.Bio,
                Website = p.Website,
                Blog = p.Blog,
                Twitter = p.Twitter,
                ImageUrl = p.ImageUrl
            };

            foreach (var session in p.Sessions)
                speaker.Sessions.Add(session.Map());

            return speaker;
        }
Esempio n. 3
0
        public Speaker GetSpeaker(int eventId, int speakerId)
        {
            using (OCCDB db = new OCCDB())
            {
                var s = (from speaker in db.People.Include("Sessions")
                         where speaker.ID == speakerId
                         select speaker).FirstOrDefault();

                if (s == null) throw new ArgumentException("Speaker not found");

                // OLD: return s.AsSpeaker(); // ?? how to filter sessions by event id ??

                Speaker result = new Speaker()
                {
                    ID = s.ID,
                    Email = s.Email,
                    FirstName = s.FirstName,
                    LastName = s.LastName,
                    Title = string.IsNullOrEmpty(s.Title) ? string.Empty : s.Title,
                    Bio = string.IsNullOrEmpty(s.Bio) ? string.Empty : s.Bio,
                    Website = string.IsNullOrEmpty(s.Website) ? string.Empty : s.Website,
                    Blog = string.IsNullOrEmpty(s.Blog) ? string.Empty : s.Blog,
                    Twitter = string.IsNullOrEmpty(s.Twitter) ? string.Empty : s.Twitter,
                    ImageUrl = s.ImageUrl
                };

                foreach (var session in s.Sessions)
                    if (session.Event_ID == eventId)
                    {
                        var tSlot = (from timeslot in db.Timeslots
                                     where timeslot.ID == session.Timeslot_ID
                                     select timeslot);
                        var tRack = (from track in db.Tracks
                                     where track.ID == session.Track_ID
                                     select track);
                        if (tSlot != null)
                        {
                            session.Timeslot = tSlot.FirstOrDefault();
                        }
                        if (tRack != null)
                        {
                            session.Track = tRack.FirstOrDefault();
                        }

                        result.Sessions.Add(session.Map());
                    }

                return result;
            }
        }