Ejemplo n.º 1
0
        /// <summary>
        /// Get a Work object from XElement node
        /// </summary>
        /// <remarks>
        /// Gets the workItem data from the XElement and checks if the 
        /// Work object already exists. If yes then return that work item. 
        /// Otherwise create a new Work object and assign its values the 
        /// data extracted from the XElement node.
        /// </remarks>
        /// <param name="node"></param>
        /// <returns></returns>
        public static Work GetWorkFromNode(System.Xml.Linq.XElement node)
        {
            if(node == null || node.Element(Constants.Work.workIDElement) == null)
                return null;

            int workID = 0;
            int.TryParse(node.GetXElement(Constants.Work.workIDElement), out workID);

            Work work = GetWorkByID(workID);

            if (!work.IsNew)
            {
                work.WorkPremiere = (string)node.GetXElement(Constants.Work.workPremiereElement);

                return work;
            }

            work.WorkID = workID;

            work = SetWorkTitles(node, work);

            work = GetComposers(node, work);

            work = SetWorkData(node, workID, work);

            work = GetWorkInstruments(node, work);

            work = GetWorkArtists(node, work);

            BsoArchiveEntities.Current.Save();

            return work;
        }
Ejemplo n.º 2
0
 private static void SetInstrumentDetails(System.Xml.Linq.XElement node, Instrument instrument, int instrumentID)
 {
     instrument.InstrumentID = instrumentID;
     string artistInstrument1 = node.GetXElement(Constants.Artist.artistInstrumentElement);
     string artistInstrument2 = node.GetXElement(Constants.Artist.artistInstrument2Element);
     instrument.Instrument1 = artistInstrument1;
     instrument.Instrument2 = artistInstrument2;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Get Artist object from XElement node
        /// </summary>
        /// <param name="node"></param>
        /// <remarks>
        /// Takes an XElement node of eventItem and extracts the data for that events 
        /// Artist element. Checks to see if that Artist already exists, if yes than return, 
        /// if no then create a new Artist from data in node.
        /// </remarks>
        /// <returns></returns>
        public static Artist GetArtistFromNode(System.Xml.Linq.XElement node)
        {
            if (node == null || node.Element(Constants.Artist.artistIDElement) == null)
                return null;

            int artistId = 0;
            var artistElement = node.GetXElement(Constants.Artist.artistIDElement);
            int.TryParse(artistElement, out artistId);

            Artist artist = Artist.GetArtistByID(artistId);
            if (!artist.IsNew)
                return artist;

            int artistStatusId, artistStatus;
            string artistFirstName = (string)node.GetXElement(Constants.Artist.artistFirstNameElement);
            string artistLastName = (string)node.GetXElement(Constants.Artist.artistLastNameElement);
            string artistName4 = (string)node.GetXElement(Constants.Artist.artistName4Element);
            string artistName5 = (string)node.GetXElement(Constants.Artist.artistName5Element);
            string artistNote = (string)node.GetXElement(Constants.Artist.artistNoteElement);

            int.TryParse((string)node.GetXElement(Constants.Artist.artistStatusElement), out artistStatus);
            int.TryParse((string)node.GetXElement(Constants.Artist.artistStatusIDElement), out artistStatusId);

            artist = SetArtistData(artist, artistId, artistFirstName, artistLastName, artistName4, artistName5, artistNote, artistStatus, artistStatusId);

            return artist;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a WorkArtist object from a workItem XElement node
        /// </summary>
        /// <param name="node"></param>
        /// <remarks>
        /// Takes a XElement node and extracts the WorkArtist information 
        /// and creates a new WorkArtist object and returns it.
        /// </remarks>
        /// <returns></returns>
        public static WorkArtist GetWorkArtistFromNode(System.Xml.Linq.XElement node)
        {
            if (node == null || node.Element(Constants.WorkArtist.workArtistIDElement) == null)
                return null;

            int workArtistID = 0;
            int.TryParse((string)node.GetXElement(Constants.WorkArtist.workArtistIDElement), out workArtistID);

            WorkArtist workArtist = WorkArtist.NewWorkArtist();

            return BuildWorkArtist(node, workArtistID, workArtist);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get Event object from XmlNode
        /// </summary>
        /// <param name="eventItemNode"></param>
        /// <remarks>
        /// Takes a event Node from the list of node events and gets the values of 
        /// its child elements and creates a new Event object with the values then 
        /// returns the Event object.
        /// </remarks>
        /// <returns></returns>
        public static Event GetEventFromNodeItem(System.Xml.Linq.XElement eventItemNode)
        {
            int eventID;
            int.TryParse((string)eventItemNode.GetXElement(Constants.Event.eventIDElement), out eventID);

            Event eventItem = Event.GetEventByID(eventID);
            if (!eventItem.IsNew)
                return eventItem;

            eventItem = BuildEventItem(eventItemNode, eventID, eventItem);

            return eventItem;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get Instrument from XElement node
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static Instrument GetInstrumentFromNode(System.Xml.Linq.XElement node)
        {
            if (node == null || node.Element(Constants.Artist.artistInstrumentIDElement) == null)
                return null;

            int instrumentID;
            int.TryParse(node.GetXElement(Constants.Artist.artistInstrumentIDElement), out instrumentID);

            Instrument instrument = Instrument.GetInstrumentByID(instrumentID);
            if (!instrument.IsNew)
                return instrument;

            SetInstrumentDetails(node, instrument, instrumentID);

            return instrument;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Given an XElement node extracts the composer information and creates a Composer object and returns it.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static Composer GetComposerFromNode(System.Xml.Linq.XElement node)
        {
            if (node == null || node.Element(Constants.Composer.composerIDElement) == null)
                return null;

            int composerID;
            int.TryParse(node.GetXElement(Constants.Composer.composerIDElement), out composerID);

            Composer composer = Composer.GetComposerByID(composerID);
            if (!composer.IsNew)
                return composer;

            composer.ComposerID = composerID;

            GetComposerData(node, composer);

            return composer;
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            XElement configEl = section.GetXElement();

            StartupBunch sttpBunch = new StartupBunch()
            {
                BaseFolder = XmlLinq.GetAttributeSafe(configEl, "path")
            };

            XElement xApps = configEl.Element("apps");

            string sharedPluginsPath = XmlLinq.GetAttributeSafe(xApps, "sharedPluginsPath");

            if (!string.IsNullOrEmpty(sharedPluginsPath))
                sttpBunch.SharedPluginsFolder = DataAvail.Utils.Path.GetFullPath(sttpBunch.BaseFolder, sharedPluginsPath);

            sttpBunch.AppConfigs = GetAppConfigs(sttpBunch, xApps).Where(p => p.IsActive).ToArray();

            return sttpBunch;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get Participant object from XElement node
        /// </summary>
        /// <param name="node"></param>
        /// <remarks>
        /// Takes an XElement node of eventItem and extracts the data for that events 
        /// Participant element. Checks to see if that Participant already exists, if yes than return, 
        /// if no then create a new Artist from data in node.
        /// </remarks>
        /// <returns></returns>
        public static Participant GetParticipantFromNode(System.Xml.Linq.XElement node)
        {
            if (node == null || string.IsNullOrEmpty((string)node.GetXElement(Constants.Participant.participantIDElement)))
                return null;

            int participantID;
            int.TryParse(node.GetXElement(Constants.Participant.participantIDElement), out participantID);

            Participant participant = Participant.GetParticipantByID(participantID);
            if (!participant.IsNew)
                return participant;

            string participantFirstName = node.GetXElement(Constants.Participant.participantFirstNameElement);
            string participantLastName = node.GetXElement(Constants.Participant.participantLastNameElement);
            string participantGroup = node.GetXElement(Constants.Participant.participantGroupNameElement);

            int participantStatus, participantStatusID;
            int.TryParse(node.GetXElement(Constants.Participant.participantStatusIDElement), out participantStatusID);
            int.TryParse(node.GetXElement(Constants.Participant.participantStatusElement), out participantStatus);

            SetParticipantData(participantID, participant, participantFirstName, participantLastName, participantGroup, participantStatus, participantStatusID);

            return participant;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Gets the conductors information from the given node.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="composer"></param>
        private static void GetComposerData(System.Xml.Linq.XElement node, Composer composer)
        {
            string composerLastName = node.GetXElement(Constants.Composer.composerLastNameElement);
            string composerFirstName = node.GetXElement(Constants.Composer.composerFirstNameElement);
            string composerName2 = node.GetXElement(Constants.Composer.composerName2Element);
            string composerName4 = node.GetXElement(Constants.Composer.composerName4Element);
            string composerName5 = node.GetXElement(Constants.Composer.composerName5Element);
            string composerBirthYear = node.GetXElement(Constants.Composer.composerBirthYearElement);
            string composerDeathYear = node.GetXElement(Constants.Composer.composerDeathYearElement);

            var composerAddElement = node.Element(Constants.Composer.composerAddNameElement);
            if (composerAddElement != null)
                GetComposerAddNames(composerAddElement, composer);

            SetComposerData(composer, composerLastName, composerFirstName, composerName2, composerName4, composerName5, composerBirthYear, composerDeathYear);
        }
Ejemplo n.º 11
0
 private static void GetComposerAddNames(System.Xml.Linq.XElement node, Composer composer)
 {
     composer.ComposerAddNameFirst = node.GetXElement(Constants.Composer.composerAddNameFirstElement);
     composer.ComposerAddNameLast = node.GetXElement(Constants.Composer.composerAddNameLastElement);
     composer.ComposerAddName2 = node.GetXElement(Constants.Composer.composerAddName2Element);
     composer.ComposerAddText = node.GetXElement(Constants.Composer.composerAddNameTextElement);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Get the instrument variables from the XElement node.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="work"></param>
        /// <remarks>
        /// Extracts the values representing the instruments in the XElement node. Then 
        /// it calls SetWorkInstruments to assign them to the Work object.
        /// </remarks>
        /// <returns></returns>
        private static Work GetWorkInstruments(System.Xml.Linq.XElement node, Work work)
        {
            int flute, oboe, clarinet, bassoon, horn, trumpet, trombone, tuba, timpani,
                percussion, harp, keyboard, extra, violin1, violin2, viola, cello, bass;
            int.TryParse((string)node.GetXElement(Constants.Work.workFluteElement), out flute);
            int.TryParse((string)node.GetXElement(Constants.Work.workOboeElement), out oboe);
            int.TryParse((string)node.GetXElement(Constants.Work.workClarinetElement), out clarinet);
            int.TryParse((string)node.GetXElement(Constants.Work.workBassoonElement), out bassoon);
            int.TryParse((string)node.GetXElement(Constants.Work.workHornElement), out horn);
            int.TryParse((string)node.GetXElement(Constants.Work.workTrumpetElement), out trumpet);
            int.TryParse((string)node.GetXElement(Constants.Work.workTromboneElement), out trombone);
            int.TryParse((string)node.GetXElement(Constants.Work.workTubaElement), out tuba);
            int.TryParse((string)node.GetXElement(Constants.Work.workTimpaniElement), out timpani);
            int.TryParse((string)node.GetXElement(Constants.Work.workPercussionElement), out percussion);
            int.TryParse((string)node.GetXElement(Constants.Work.workHarpElement), out harp);
            int.TryParse((string)node.GetXElement(Constants.Work.workKeyboardElement), out keyboard);
            int.TryParse((string)node.GetXElement(Constants.Work.workExtraElement), out extra);
            int.TryParse((string)node.GetXElement(Constants.Work.workViolin1Element), out violin1);
            int.TryParse((string)node.GetXElement(Constants.Work.workViolin2Element), out violin2);
            int.TryParse((string)node.GetXElement(Constants.Work.workViolaElement), out viola);
            int.TryParse((string)node.GetXElement(Constants.Work.workCelloElement), out cello);
            int.TryParse((string)node.GetXElement(Constants.Work.workBassElement), out bass);

            work = SetWorkInstruments(work, flute, oboe, clarinet, bassoon, horn, trumpet, trombone, tuba, timpani, percussion, harp, keyboard, extra, violin1, violin2, viola, bass);

            return work;
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Set added titles of the Work object
 /// </summary>
 /// <remarks>
 /// Adds the alternate titles that will be used with titles that have diacritics
 /// </remarks>
 /// <param name="node"></param>
 /// <param name="work"></param>
 private static void SetAddedSecondaryTitles(System.Xml.Linq.XElement node, Work work)
 {
     work.WorkAddTitle1 = (string)node.GetXElement(Constants.Work.workAddTitleTitle1Element);
     work.WorkAddTitle2 = (string)node.GetXElement(Constants.Work.workAddTitleTitle2Element);
     work.WorkAddTitle3 = (string)node.GetXElement(Constants.Work.workAddTitleTitle3Element);
     work.WorkAddTitleText = (string)node.GetXElement(Constants.Work.workAddTitleTextElement);
 }
Ejemplo n.º 14
0
        private static WorkArtist BuildWorkArtist(System.Xml.Linq.XElement node, int workArtistID, WorkArtist workArtist)
        {
            Artist artist = Artist.GetArtistByID(workArtistID);
            if (artist.IsNew)
            {
                artist.ArtistID = workArtistID;
                artist.ArtistLastName = (string)node.GetXElement(Constants.WorkArtist.workArtistLastNameElement);
                artist.ArtistFirstName = (string)node.GetXElement(Constants.WorkArtist.workArtistFirstNameElement);
                artist.ArtistName4 = (string)node.GetXElement(Constants.WorkArtist.workArtistName4Element);
                artist.ArtistName5 = (string)node.GetXElement(Constants.WorkArtist.workArtistName5Element);
            }
            workArtist.Artist = artist;

            int workArtistStatus, workArtistStatusID, instrumentID;

            int.TryParse((string)node.GetXElement(Constants.WorkArtist.workArtistInstrumentIDElement), out instrumentID);
            int.TryParse((string)node.GetXElement(Constants.WorkArtist.workArtistStatusElement), out workArtistStatus);
            int.TryParse((string)node.GetXElement(Constants.WorkArtist.workArtistStatusIDElement), out workArtistStatusID);
            string workArtistNote = (string)node.GetXElement(Constants.WorkArtist.workArtistNoteElement);

            workArtist = SetWorkArtistData(workArtist, workArtistNote, workArtistStatus, workArtistStatusID);

            string workArtistInstrument = (string)node.GetXElement(Constants.WorkArtist.workArtistInstrumentElement);
            string workArtistInstrument2 = (string)node.GetXElement(Constants.WorkArtist.workArtistInstrument2Element);

            CreateWorkArtistInstrument(workArtist, instrumentID, workArtistInstrument, workArtistInstrument2);

            return workArtist;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Assigns data from XElement node to Work object.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="workID"></param>
        /// <param name="work"></param>
        /// <remarks>
        /// Extracts information about the workItem from the XElement 
        /// node then assigns it to the Work object variables.
        /// </remarks>
        /// <returns></returns>
        private static Work SetWorkData(System.Xml.Linq.XElement node, int workID, Work work)
        {
            int workGroupID = 0;
            int.TryParse((string)node.GetXElement(Constants.Work.workGroupIDElement), out workGroupID);
            string workArrangement = (string)node.GetXElement(Constants.Work.workArrangementElement);
            string workCompYear = (string)node.GetXElement(Constants.Work.workCompYearElement);
            string workCompYear2 = (string)node.GetXElement(Constants.Work.workCompYear2Element);
            string workPremiere = (string)node.GetXElement(Constants.Work.workPremiereElement);
            string workRegular = (string)node.GetXElement(Constants.Work.workRegularElement);
            string workIntermission = (string)node.GetXElement(Constants.Work.workIntermissionElement);
            string workNote = node.GetXElement(Constants.Work.workNoteElement);
            string workCommission = node.GetXElement(Constants.Work.workCommissionElement);

            work.WorkGroupID = workGroupID;
            work.WorkNote = workNote;
            work.WorkArrangement = workArrangement;
            work.WorkCompYear = workCompYear;
            work.WorkCompYear2 = workCompYear;
            work.WorkPremiere = workPremiere;
            work.WorkCommission = workCommission;
            work.WorkRegular = workRegular;
            work.WorkIntermission = workIntermission;
            work.WorkID = workID;

            return work;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Extracts the Event data from a node and assigns the values to the Event object.
        /// </summary>
        /// <param name="eventItemNode"></param>
        /// <param name="eventID"></param>
        /// <param name="eventItem"></param>
        /// <returns></returns>
        private static Event BuildEventItem(System.Xml.Linq.XElement eventItemNode, int eventID, Event eventItem)
        {
            int eventLevel, eventProgramNo;
            int.TryParse((string)eventItemNode.GetXElement(Constants.Event.eventLevelElement), out eventLevel);
            int.TryParse((string)eventItemNode.GetXElement(Constants.Event.eventProgramNoElement), out eventProgramNo);

            string eventText = (string)eventItemNode.GetXElement(Constants.Event.eventTextElement);
            string eventNote = (string)eventItemNode.GetXElement(Constants.Event.eventNoteElement);
            string programTitle = (string)eventItemNode.GetXElement(Constants.Event.eventProgramTitleElement);
            string eventDate = (string)eventItemNode.GetXElement(Constants.Event.eventDateElement);
            string eventStart = (string)eventItemNode.GetXElement(Constants.Event.eventStartElement);
            string eventEnd = (string)eventItemNode.GetXElement(Constants.Event.eventEndElement);
            eventItem.SetEventData(eventID, eventLevel, eventProgramNo, eventText, eventNote, programTitle, eventDate, eventStart, eventEnd);

            return eventItem;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Sets the titles of the Work object
        /// </summary>
        /// <param name="node"></param>
        /// <param name="work"></param>
        /// <remarks>
        /// Extracts the 3 Titles from the XElement node and assigns them 
        /// to the Work object then returns that object.
        /// </remarks>
        /// <returns></returns>
        private static Work SetWorkTitles(System.Xml.Linq.XElement node, Work work)
        {
            string workTitle = (string)node.GetXElement(Constants.Work.workTitleElement);
            string workTitle2 = (string)node.GetXElement(Constants.Work.workTitle2Element);
            string workTitle3 = (string)node.GetXElement(Constants.Work.workTitle3Element);
            work.WorkTitle = workTitle;
            work.WorkTitle2 = workTitle2;
            work.WorkTitle3 = workTitle3;

            var workAddTitle = node.Element(Constants.Work.workAddTitleElement);
            if(workAddTitle != null)
                SetAddedSecondaryTitles(workAddTitle, work);

            return work;
        }