/// <summary> /// Returns a Season object based on the eventSeason data passed by the /// XElement eventItem element. /// </summary> /// <param name="node"></param> /// <returns></returns> public static Season GetSeasonFromNode(System.Xml.Linq.XElement node) { System.Xml.Linq.XElement seasonElement = node.Element(Constants.Season.seasonElement); if (seasonElement == null || string.IsNullOrEmpty((string)seasonElement.GetXElement(Constants.Season.seasonIDElement))) { return(null); } int seasonID; int.TryParse(seasonElement.GetXElement(Constants.Season.seasonIDElement), out seasonID); Season season = GetSeasonByID(seasonID); if (!season.IsNew) { return(season); } string seasonName = seasonElement.GetXElement(Constants.Season.seasonNameElement); string seasonCode = seasonElement.GetXElement(Constants.Season.seasonCodeElement); season = SetSeasonData(seasonID, season, seasonCode, seasonName); return(season); }
/// <summary> /// Returns a Project object based on the eventProject data passed by the /// XElement eventItem element. /// </summary> /// <param name="node"></param> /// <returns></returns> public static Project GetProjectFromNode(System.Xml.Linq.XElement node) { System.Xml.Linq.XElement projectElement = node.Element(Constants.Project.projectElement); if (projectElement == null || string.IsNullOrEmpty(projectElement.GetXElement(Constants.Project.projectIDElement))) { return(null); } int projectID; int.TryParse(projectElement.GetXElement(Constants.Project.projectIDElement), out projectID); Project project = GetProjectByID(projectID); if (!project.IsNew) { return(project); } string projectName = projectElement.GetXElement(Constants.Project.projectNameElement); string projectName2 = projectElement.GetXElement(Constants.Project.projectName2Element); string projectTypeName = projectElement.GetXElement(Constants.Project.projectTypeNameElement); project = SetWorkData(projectID, project, projectName, projectName2, projectTypeName); return(project); }
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); }
/// <summary> /// Returns a Orchestra object based on the eventOrchestra data passed by the /// XElement eventItem element. /// </summary> /// <param name="node"></param> /// <returns></returns> public static Orchestra GetOrchestraFromNode(System.Xml.Linq.XElement node) { System.Xml.Linq.XElement orchestraElement = node.Element(Constants.Orchestra.orchestraElement); if (orchestraElement == null || string.IsNullOrEmpty(orchestraElement.GetXElement(Constants.Orchestra.orchestraIDElement))) { return(null); } int orchestraID; int.TryParse(orchestraElement.GetXElement(Constants.EventRoot + Constants.Orchestra.OrchestraID), out orchestraID); Orchestra orchestra = Orchestra.GetOrchestraByID(orchestraID); if (!orchestra.IsNew) { return(orchestra); } string orchestraName = orchestraElement.GetXElement(Constants.Orchestra.orchestraNameElement); string orchestraURL = orchestraElement.GetXElement(Constants.Orchestra.orchestraURLElement); string orchestraNote = orchestraElement.GetXElement(Constants.Orchestra.orchestraNotesElement); orchestra = SetOrchestraData(orchestraID, orchestra, orchestraName, orchestraURL, orchestraNote); return(orchestra); }
/// <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); }
/// <summary> /// Get Type object from XElement eventItem node /// </summary> /// <param name="node"></param> /// <remarks> /// Takes an XElement node which represents an eventItem /// and takes the Type data from it and checks to see if /// the Type object exists. If yes then returns it. Otherwise /// create a new Type object. /// </remarks> /// <returns></returns> public static EventType GetEventTypeFromNode(System.Xml.Linq.XElement node) { System.Xml.Linq.XElement typeElement = node.Element(Constants.EventType.typeElement); if (typeElement == null || string.IsNullOrEmpty((string)typeElement.GetXElement(Constants.EventType.typeIDElement))) { return(null); } int typeID; int.TryParse(typeElement.GetXElement(Constants.EventType.typeIDElement), out typeID); EventType type = GetEventTypeByID(typeID); if (!type.IsNew) { return(type); } string typeName = typeElement.GetXElement(Constants.EventType.typeNameElement); string typeName2 = typeElement.GetXElement(Constants.EventType.typeNameElement); type = SetEventTypeData(typeID, type, typeName, typeName2); return(type); }
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); }
/// <summary> /// Get TypeGroup object based on an XElement node /// </summary> /// <param name="node"></param> /// <remarks> /// Takes a eventItem node and extracts the TypeGroup information /// for that event. It then returns either an existing TypeGroup if one /// exists with the same id, or creates a new one to return. /// </remarks> /// <returns></returns> public static EventTypeGroup GetEventTypeGroupFromNode(System.Xml.Linq.XElement node) { System.Xml.Linq.XElement typeGroupElement = node.Element(Constants.EventTypeGroup.typeGroupElement); if (typeGroupElement == null || string.IsNullOrEmpty((string)typeGroupElement.GetXElement(Constants.EventTypeGroup.typeGroupIDElement))) { return(null); } int typeGroupID; int.TryParse(typeGroupElement.GetXElement(Constants.EventTypeGroup.typeGroupIDElement), out typeGroupID); if (typeGroupID == 0) { typeGroupID = 1000; } EventTypeGroup typeGroup = GetTypeGroupByID(typeGroupID); if (!typeGroup.IsNew) { return(typeGroup); } string typeGroupName = typeGroupElement.GetXElement(Constants.EventTypeGroup.typeGroupNameElement); string typeGroupName2 = typeGroupElement.GetXElement(Constants.EventTypeGroup.typeGroupName2Element); typeGroup = SetTypeGroupData(typeGroupID, typeGroup, typeGroupName, typeGroupName2); return(typeGroup); }
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; }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Get Conductor object from XmlNode /// </summary> /// <param name="conductorItemNode"></param> /// <remarks> /// Takes an eventConductor child element from an eventItem and gets all its /// child elements to create a Conductor object, then returns that object. /// </remarks> /// <returns></returns> public static Conductor GetConductorFromNode(System.Xml.Linq.XElement conductorItemNode) { System.Xml.Linq.XElement conductorElement = conductorItemNode.Element(Constants.Conductor.conductorElement); if (conductorElement == null || string.IsNullOrEmpty((string)conductorElement.GetXElement(Constants.Conductor.conductorIDElement))) { return(null); } int conductorID; int.TryParse((string)conductorElement.GetXElement(Constants.Conductor.conductorIDElement), out conductorID); var conductor = Conductor.GetConductorByID(conductorID); if (!conductor.IsNew) { return(conductor); } var conductorFirstName = conductorElement.GetXElement(Constants.Conductor.conductorFirstNameElement); var conductorLastName = conductorElement.GetXElement(Constants.Conductor.conductorLastNameElement); var conductorNote = conductorElement.GetXElement(Constants.Conductor.conductorNoteElement); var conductorName4 = conductorElement.GetXElement(Constants.Conductor.conductorName4Element); var conductorName5 = conductorElement.GetXElement(Constants.Conductor.conductorName5Element); conductor = SetConductorData(conductorID, conductor, conductorFirstName, conductorLastName, conductorName4, conductorName5, conductorNote); return(conductor); }
/// <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); }
/// <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); }
/// <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); work = GetWorkDocuments(node, work); BsoArchiveEntities.Current.Save(); return(work); }
/// <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)); }
/// <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); }
public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { Conductor updateConductor = Conductor.GetConductorFromNode(element); System.Xml.Linq.XElement conductorNode = element.Element(Constants.Conductor.conductorElement); if (conductorNode == null) { continue; } object newValue = conductorNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateConductor, newValue, columnName); } }
/// <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); }
/// <summary> /// Get Venue object from XmlNode /// </summary> /// <param name="venueItemNode"></param> /// <remarks> /// Takes a eventVenue child element from an eventItem and /// gets its child elements to create a Venue object, then returns /// that object. /// </remarks> /// <returns></returns> public static Venue GetVenueFromNode(System.Xml.Linq.XElement venueItemNode) { System.Xml.Linq.XElement venueElement = venueItemNode.Element(Constants.Venue.venueElement); if (venueElement == null || string.IsNullOrEmpty((string)venueElement.GetXElement(Constants.Venue.venueIDElement))) { return(null); } int venueID; int.TryParse(venueElement.GetXElement(Constants.Venue.venueIDElement), out venueID); if (venueID == 0) { return(null); } Venue venue = Venue.GetVenueByID(venueID); if (!venue.IsNew) { return(venue); } string venueName = (string)venueElement.GetXElement(Constants.Venue.venueNameElement); string venueCode = (string)venueElement.GetXElement(Constants.Venue.venueCodeElement); string venueCountry = (string)venueElement.GetXElement(Constants.Venue.venueCountryElement); string venueCity = (string)venueElement.GetXElement(Constants.Venue.venueCityElement); string venueZipCode = (string)venueElement.GetXElement(Constants.Venue.venueZipCodeElement); string venueState = (string)venueElement.GetXElement(Constants.Venue.venueStateElement); string venueStreet = (string)venueElement.GetXElement(Constants.Venue.venueStreetElement); SetVenueData(venue, venueID, venueName, venueCode, venueCountry, venueCity, venueZipCode, venueState, venueStreet); return(venue); }
/// <summary> /// Updates the existing database Season on the column name using the /// XML document parsed using the tagName. /// </summary> /// <param name="doc"></param> /// <param name="columnName"></param> /// <param name="tagName"></param> public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { Season updateSeason = Season.GetSeasonFromNode(element); if (updateSeason == null) { continue; } System.Xml.Linq.XElement seasonNode = element.Element(Constants.Season.seasonElement); object newValue = seasonNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateSeason, newValue, columnName); } }
/// <summary> /// Updates the existing database Venue on the column name using the /// XML document parsed using the tagName. /// </summary> /// <param name="doc"></param> /// <param name="columnName"></param> /// <param name="tagName"></param> public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { Venue updateVenue = Venue.GetVenueFromNode(element); if (updateVenue == null) { continue; } System.Xml.Linq.XElement venueNode = element.Element(Constants.Venue.venueElement); object newValue = (string)venueNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateVenue, newValue, columnName); } }
/// <summary> /// Updates the existing database Orchestra on the column name using the /// XML document parsed using the tagName. /// </summary> /// <param name="doc"></param> /// <param name="columnName"></param> /// <param name="tagName"></param> public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { Orchestra updateOrchestra = Orchestra.GetOrchestraFromNode(element); if (updateOrchestra == null) { continue; } System.Xml.Linq.XElement orchestraNode = element.Element(Constants.Orchestra.orchestraElement); object newValue = orchestraNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateOrchestra, newValue, columnName); } }
/// <summary> /// Updates the existing database Project on the column name using the /// XML document parsed using the tagName. /// </summary> /// <param name="doc"></param> /// <param name="columnName"></param> /// <param name="tagName"></param> public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { Project updateProject = Project.GetProjectFromNode(element); if (updateProject == null) { continue; } System.Xml.Linq.XElement projectNode = element.Element(Constants.Project.projectElement); object newValue = projectNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateProject, newValue, columnName); } }
/// <summary> /// Updates the existing database TypeGroup on the column name using the /// XML document parsed using the tagName. /// </summary> /// <param name="doc"></param> /// <param name="columnName"></param> /// <param name="tagName"></param> public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName) { IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement); foreach (System.Xml.Linq.XElement element in eventElements) { EventTypeGroup updateTypeGroup = EventTypeGroup.GetEventTypeGroupFromNode(element); if (updateTypeGroup == null) { continue; } System.Xml.Linq.XElement typeGroupNode = element.Element(Constants.EventTypeGroup.typeGroupElement); object newValue = typeGroupNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateTypeGroup, newValue, columnName); } }
/// <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); }
/// <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); }
/// <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); }