public static void bind_appointments(Int32 _programID) { List <scheduleheader> _list = dL.Schedule.List(_programID); foreach (scheduleheader _hdritem in _list) { foreach (scheduledetail _item in _hdritem.scheduledetails) { scheddtlcustom _custom = _item.scheddtlcustoms.Count > 0 ? CustomSlot.Single(_item.scheddtlcustoms.ElementAt(0).customID) : new scheddtlcustom(); scheddtlstandard _standard = _item.scheddtlstandards.Count > 0 ? dL.StandardSlot.Single(_item.scheddtlstandards.ElementAt(0).standardID) : new scheddtlstandard(); scheddtltalk _talk = _item.scheddtltalks.Count > 0 ? dL.Talk.Single(_item.scheddtltalks.ElementAt(0).scheddtltalkID) : new scheddtltalk(); talkspeaker _talkspeaker = _talk.talk != null?dL.Talk.Speaker.Single(_talk.talk.talkID) : null; scheddtlvenue _venue = _item.scheddtlvenues.Count > 0 ? dL.Venue.Single(_item.scheddtlvenues.ElementAt(0).dtlvenueID) : new scheddtlvenue(); scheduledtlrecurrence _recurrence = _item.scheduledtlrecurrences.FirstOrDefault(); string _talkid = _talk.talk != null?_talk.talkID.ToString() : String.Empty; string _talktitle = _talk.talk != null ? _talk.talk.title : String.Empty; string _speaker = _talkspeaker != null ? _talkspeaker.participant.participantprofile.lastname : String.Empty; string _standardid = _standard.slotinfo != null?_standard.standardslotID.ToString() : String.Empty; string _standardtitle = _standard.slotinfo != null ? _standard.slotinfo.slotinfoname : String.Empty; string _customtitle = _custom.customslot != null ? _custom.customslot : String.Empty; string _venueid = _venue.venue != null?_venue.venueID.ToString() : String.Empty; string _venuename = _venue.venue != null ? _venue.venue.venuename : String.Empty; string _recrule = _recurrence != null ? _recurrence.recurrence : String.Empty; string _recparentid = _recurrence != null?_recurrence.dtlID.ToString() : String.Empty; Appointments.Add(new dL.Schedule.AppointmentInfo(_item.hdrid.ToString(), _item.dtlID.ToString(), _speaker, _talkid, _talktitle, _standardid, _standardtitle, _customtitle, _venueid, _venuename, _item.start, _item.end, _recrule, _recparentid)); //Appointments.Add(new dL.Schedule.AppointmentInfo(_item.dtlID.ToString(), _talk, _standard, _custom, _venue, _item.start, _item.end, _recurrence != null ? _recurrence.recurrence : String.Empty, _recurrence != null ? _recurrence.dtlID.ToString() : String.Empty)); } } }