/// <summary>
        /// Given an EventDetailID builds a WorkDTO based on work from given EventDetail WorkID
        /// </summary>
        /// <param name="eventDetailID"></param>
        /// <returns></returns>
        public WorkDTO BuildRepertoireDTOByEventDetailID(int eventDetailID)
        {
            var eventDetail = Event.GetEventDetailByID(eventDetailID);
            var workID = eventDetail.WorkID;
            int eventDetailWorkGroupId = eventDetail.WorkGroupId ?? 0;

            if (workID == null || Work.WorkShouldBeExcludedByGroupId(eventDetailWorkGroupId))
                return null;

            var work = works.FirstOrDefault(w => w.WorkTitle == eventDetail.WorkTitle && w.ComposerFullName == eventDetail.ComposerFullName);

            if (work == null)
            {
                var evt = Event.GetEventByID(eventDetail.EventID);
                var workItem = Work.GetWorkByID((int)workID);
                var count = BsoArchiveEntities.Current.Works.Count(w => w.WorkGroupID == workItem.WorkGroupID);
                work = new WorkDTO
                {
                    WorkTitle = eventDetail.WorkTitle,
                    workID = workItem.WorkID,
                    workGroupID = workItem.WorkGroupID,
                    Arranger = workItem.WorkArrangement,
                    ComposerFullName = workItem.Composer.ComposerFullName,
                    PerformanceCount = count
                };

                work.WorkLink = string.Concat("Search.aspx?searchType=Performance&Composer=", work.ComposerFullName, "&Work=", workItem.WorkTitle.Replace("&", "%26"));

                works.Add(work);
            }

            return work;
        }
Beispiel #2
0
        /// <summary>
        /// Given an EventDetailID builds a WorkDTO based on work from given EventDetail WorkID
        /// </summary>
        /// <param name="eventDetailID"></param>
        /// <returns></returns>
        public WorkDTO BuildRepertoireDTOByEventDetailID(int eventDetailID)
        {
            var eventDetail            = Event.GetEventDetailByID(eventDetailID);
            var workID                 = eventDetail.WorkID;
            int eventDetailWorkGroupId = eventDetail.WorkGroupId ?? 0;

            if (workID == null || Work.WorkShouldBeExcludedByGroupId(eventDetailWorkGroupId))
            {
                return(null);
            }

            var work = works.FirstOrDefault(w => w.WorkTitle == eventDetail.WorkTitle && w.ComposerFullName == eventDetail.ComposerFullName);

            if (work == null)
            {
                var evt      = Event.GetEventByID(eventDetail.EventID);
                var workItem = Work.GetWorkByID((int)workID);
                var count    = BsoArchiveEntities.Current.Works.Count(w => w.WorkGroupID == workItem.WorkGroupID);
                work = new WorkDTO
                {
                    WorkTitle        = eventDetail.WorkTitle,
                    workID           = workItem.WorkID,
                    workGroupID      = workItem.WorkGroupID,
                    Arranger         = workItem.WorkArrangement,
                    ComposerFullName = workItem.Composer.ComposerFullName,
                    PerformanceCount = count
                };

                work.WorkLink = string.Concat("Search.aspx?searchType=Performance&Composer=", work.ComposerFullName, "&Work=", workItem.WorkTitle.Replace("&", "%26"));

                works.Add(work);
            }

            return(work);
        }
        /// <summary>
        /// Get Artist DTO by Artist Id
        /// </summary>
        /// <param name="artistDetailId"></param>
        /// <returns></returns>
        public static ArtistDTO GetArtistDTOByArtistDetailID(int artistDetailId, List<ArtistDTO> artistDTOList)
        {
            var artistDetail = ArtistDetail.GetArtistDetailByID(artistDetailId);

            var artist = artistDTOList.FirstOrDefault(a => a.ArtistFullName == artistDetail.EnsembleName && a.work.WorkTitle == artistDetail.WorkTitle);

            if (artist == null)
            {
                artist = new ArtistDTO
                {
                    ArtistFullName = artistDetail.EnsembleName ?? "",
                    artistInstruments = new List<InstrumentDTO>(),
                    ConductorCount = 0,
                    SoloistCount = 0,
                    EnsembleCount = 0
                };

                var artistsWork = new WorkDTO
                {
                    WorkTitle = artistDetail.WorkTitle ?? "",
                    ComposerFullName = artistDetail.ComposerFullName ?? ""
                };

                artist.work = artistsWork;

                String composerLink = String.Concat("&Composer=", artist.work.ComposerFullName, "&Work=", artist.work.WorkTitle);
                String linkBase = "Search.aspx?searchType=Performance";
                artist.ConductorLink = String.Concat(linkBase, "&Conductor=", artist.ArtistFullName, composerLink);
                artist.SoloistLink = String.Concat(linkBase, "&Soloist=", artist.ArtistFullName, composerLink);
                artist.OrchestraLink = String.Concat(linkBase, "&Orchestra=", artist.ArtistFullName, composerLink);

                int artistDetailWorkId = artistDetail.WorkId ?? 0;

                if (!Work.WorkShouldBeExcludedById(artistDetailWorkId) && artistDetailWorkId != 0)
                    artistDTOList.Add(artist);
            }

            if (artistDetail.EnsembleType == "Orchestra")
            {
                artist.EnsembleCount++;
                AddRoleToArtist(artistDetail, artist);
            }

            if (artistDetail.EnsembleType == "Conductor")
            {
                artist.ConductorCount++;
                AddRoleToArtist(artistDetail, artist);
            }

            if (artistDetail.EnsembleType == "Soloist")
            {
                artist.SoloistCount++;

                var instrumentID = artistDetail.InstrumentID;

                var instrument = new InstrumentDTO(instrumentID);
                var artistInstrument = artist.artistInstruments.FirstOrDefault(i => i.Instrument1 == instrument.Instrument1);

                if (artistInstrument == null)
                {
                    artistInstrument = instrument;
                    artist.artistInstruments.Add(artistInstrument);
                }
            }

            return artist;
        }
        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);
            }
        }
        /// <summary>
        /// Get Artist DTO by Artist Id
        /// </summary>
        /// <param name="artistDetailId"></param>
        /// <returns></returns>
        public static ArtistDTO GetArtistDTOByArtistDetailID(int artistDetailId, List <ArtistDTO> artistDTOList)
        {
            var artistDetail = ArtistDetail.GetArtistDetailByID(artistDetailId);

            var artist = artistDTOList.FirstOrDefault(a => a.ArtistFullName == artistDetail.EnsembleName && a.work.WorkTitle == artistDetail.WorkTitle);

            if (artist == null)
            {
                artist = new ArtistDTO
                {
                    ArtistFullName    = artistDetail.EnsembleName ?? "",
                    artistInstruments = new List <InstrumentDTO>(),
                    ConductorCount    = 0,
                    SoloistCount      = 0,
                    EnsembleCount     = 0
                };

                var artistsWork = new WorkDTO
                {
                    WorkTitle        = artistDetail.WorkTitle ?? "",
                    ComposerFullName = artistDetail.ComposerFullName ?? ""
                };

                artist.work = artistsWork;

                String composerLink = String.Concat("&Composer=", artist.work.ComposerFullName, "&Work=", artist.work.WorkTitle);
                String linkBase     = "Search.aspx?searchType=Performance";
                artist.ConductorLink = String.Concat(linkBase, "&Conductor=", artist.ArtistFullName, composerLink);
                artist.SoloistLink   = String.Concat(linkBase, "&Soloist=", artist.ArtistFullName, composerLink);
                artist.OrchestraLink = String.Concat(linkBase, "&Orchestra=", artist.ArtistFullName, composerLink);

                int artistDetailWorkId = artistDetail.WorkId ?? 0;

                if (!Work.WorkShouldBeExcludedById(artistDetailWorkId) && artistDetailWorkId != 0)
                {
                    artistDTOList.Add(artist);
                }
            }

            if (artistDetail.EnsembleType == "Orchestra")
            {
                artist.EnsembleCount++;
                AddRoleToArtist(artistDetail, artist);
            }

            if (artistDetail.EnsembleType == "Conductor")
            {
                artist.ConductorCount++;
                AddRoleToArtist(artistDetail, artist);
            }

            if (artistDetail.EnsembleType == "Soloist")
            {
                artist.SoloistCount++;

                var instrumentID = artistDetail.InstrumentID;

                var instrument       = new InstrumentDTO(instrumentID);
                var artistInstrument = artist.artistInstruments.FirstOrDefault(i => i.Instrument1 == instrument.Instrument1);

                if (artistInstrument == null)
                {
                    artistInstrument = instrument;
                    artist.artistInstruments.Add(artistInstrument);
                }
            }

            return(artist);
        }
Beispiel #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);
                }
            }
        }