コード例 #1
0
        /// <summary>
        /// Returns a List of EventDTOs build by using EventIDs from EventDetail objects with an EventDetailID from given list of EventDetailIDs
        /// </summary>
        /// <param name="eventDetailIds"></param>
        /// <returns></returns>
        public static List<EventDTO> GetEventDTOByEventDetailIDs(string eventDetailIds)
        {
            var eventDTO = new EventDTO();

            eventDTO.ConstructEventDTO(eventDetailIds);

            return eventDTO.events;
        }
コード例 #2
0
        private void AddEventArtistDTO(EventDetail eventDetail, EventDTO eventDTO)
        {
            if (eventDetail.ArtistID == null)
            {
                return;
            }

            var    artist       = eventDTO.artists.FirstOrDefault(a => a.ArtistID == eventDetail.ArtistID);
            var    instrumentID = eventDetail.InstrumentID ?? 0;
            string instrument;

            if (instrumentID == 0)
            {
                instrument = "";
            }
            else
            {
                instrument = Instrument.GetInstrumentByID((int)eventDetail.InstrumentID).Instrument1;
            }


            if (artist == null)
            {
                var artistID = eventDetail.ArtistID;
                if (artistID == null)
                {
                    return;
                }

                var artistObj = Artist.GetArtistByID((int)eventDetail.ArtistID);

                artist = new ArtistDTO
                {
                    ArtistFullName   = artistObj.ArtistFullName,
                    ArtistInstrument = instrument,
                    ArtistID         = (int)eventDetail.ArtistID
                };

                eventDTO.artists.Add(artist);
            }
        }
コード例 #3
0
        private EventDTO GetEventDTOByDTOID(int eventID)
        {
            var evtDTO = events.FirstOrDefault(ev => ev.EventID == eventID);

            if (evtDTO == null)
            {
                var evt = Event.GetEventByID(eventID);

                var eventDTO = new EventDTO
                {
                    EventProgramTitle = evt.EventProgramTitle,
                    EventDate = evt.EventDate,
                    EventStartTime = evt.EventStart,
                    EventEndTime = evt.EventEnd,
                    EventID = evt.EventID,
                    EventProgramNo = evt.EventProgramNumber
                };

                eventDTO.ProgramBookLink = String.Concat(Properties.Settings.Default.ContentDMLink, eventDTO.EventProgramNo);
                eventDTO.DetailLink = String.Concat("Detail.aspx?UniqueKey=", eventDTO.EventID.ToString());

                events.Add(eventDTO);

                return eventDTO;
            }

            return evtDTO;
        }
コード例 #4
0
        private void AddEventWorkDTO(EventDetail eventDetail, EventDTO eventDTO)
        {
            if (eventDetail.WorkID == null || Work.WorkShouldBeExcludedByGroupId((int)eventDetail.WorkGroupId))
                return;

            var work = eventDTO.works.FirstOrDefault(w => w.workID == (int)eventDetail.WorkID);

            if (work == null)
            {
                work = new WorkDTO
                {
                    WorkTitle = eventDetail.WorkTitle,
                    ComposerFullName = eventDetail.ComposerFullName,
                    workID = (int)eventDetail.WorkID,
                    Arranger = eventDetail.WorkArrangement,
                    WorkArtists = new List<ArtistDTO>()
                };

                eventDTO.works.Add(work);
            }

            var artistID = eventDetail.ArtistID;
            if (artistID == null)
                return;

            var workArtist = work.WorkArtists.FirstOrDefault(wa => wa.ArtistID == (int)eventDetail.ArtistID);

            var instrumentID = eventDetail.InstrumentID ?? 0;
            string instrument;
            if (instrumentID == 0)
                instrument = "";
            else
                instrument = Instrument.GetInstrumentByID((int)eventDetail.InstrumentID).Instrument1;

            if (workArtist == null)
            {
                var artist = Artist.GetArtistByID((int)artistID);

                workArtist = new ArtistDTO
                {
                    ArtistFullName = artist.ArtistFullName,
                    ArtistInstrument = instrument,
                    ArtistID = (int)eventDetail.ArtistID
                };

                work.WorkArtists.Add(workArtist);
            }
        }
コード例 #5
0
        private void AddEventArtistDTO(EventDetail eventDetail, EventDTO eventDTO)
        {
            if (eventDetail.ArtistID == null)
                return;

            var artist = eventDTO.artists.FirstOrDefault(a => a.ArtistID == eventDetail.ArtistID);
            var instrumentID = eventDetail.InstrumentID ?? 0;
            string instrument;
            if (instrumentID == 0)
                instrument = "";
            else
                instrument = Instrument.GetInstrumentByID((int)eventDetail.InstrumentID).Instrument1;

            if (artist == null){
                var artistID = eventDetail.ArtistID;
                if (artistID == null)
                    return;

                var artistObj = Artist.GetArtistByID((int)eventDetail.ArtistID);

                artist = new ArtistDTO
                {
                    ArtistFullName = artistObj.ArtistFullName,
                    ArtistInstrument = instrument,
                    ArtistID = (int)eventDetail.ArtistID
                };

                eventDTO.artists.Add(artist);
            }
        }
コード例 #6
0
        private void AddEventWorkDTO(EventDetail eventDetail, EventDTO eventDTO)
        {
            if (eventDetail.WorkID == null || Work.WorkShouldBeExcludedByGroupId((int)eventDetail.WorkGroupId))
            {
                return;
            }

            var work = eventDTO.works.FirstOrDefault(w => w.workID == (int)eventDetail.WorkID);

            if (work == null)
            {
                work = new WorkDTO
                {
                    WorkTitle        = eventDetail.WorkTitle,
                    ComposerFullName = eventDetail.ComposerFullName,
                    workID           = (int)eventDetail.WorkID,
                    Arranger         = eventDetail.WorkArrangement,
                    WorkArtists      = new List <ArtistDTO>(),
                    WorkDocuments    = new List <WorkDocumentDTO>()
                };

                eventDTO.works.Add(work);
            }

            var artistID = eventDetail.ArtistID;

            if (artistID != null)
            {
                var workArtist = work.WorkArtists.FirstOrDefault(wa => wa.ArtistID == (int)eventDetail.ArtistID);

                var    instrumentID = eventDetail.InstrumentID ?? 0;
                string instrument;
                if (instrumentID == 0)
                {
                    instrument = "";
                }
                else
                {
                    instrument = Instrument.GetInstrumentByID((int)eventDetail.InstrumentID).Instrument1;
                }

                if (workArtist == null)
                {
                    var artist = Artist.GetArtistByID((int)artistID);

                    workArtist = new ArtistDTO
                    {
                        ArtistFullName   = artist.ArtistFullName,
                        ArtistInstrument = instrument,
                        ArtistID         = (int)eventDetail.ArtistID
                    };

                    work.WorkArtists.Add(workArtist);
                }
            }
            var documentID = eventDetail.WorkDocumentID;

            if (documentID != null)
            {
                var workDocument = work.WorkDocuments.FirstOrDefault(wd => wd.WorkDocumentID == (int)eventDetail.WorkDocumentID);
                if (workDocument == null)
                {
                    var document = WorkDocument.GetDocumentByID((int)documentID);
                    workDocument = new WorkDocumentDTO
                    {
                        WorkDocumentID           = (int)eventDetail.WorkDocumentID,
                        WorkDocumentName         = document.WorkDocumentName,
                        WorkDocumentFileLocation = document.WorkDocumentFileLocation,
                    };
                    work.WorkDocuments.Add(workDocument);
                }
            }
        }