コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <summary>
        /// Get a TypeGroup object based off given id.
        /// </summary>
        /// <param name="typeGroupID"></param>
        /// <remarks>
        /// Takes a TypeGroup id and checks to see if it already exists. If so return it.
        /// Otherwise create a new TypeGroup object and return it.
        /// </remarks>
        /// <returns></returns>
        internal static EventTypeGroup GetTypeGroupByID(int typeGroupID)
        {
            EventTypeGroup typeGroup = BsoArchiveEntities.Current.EventTypeGroups.FirstOrDefault(t => t.TypeGroupID == typeGroupID) ??
                                       EventTypeGroup.NewEventTypeGroup();

            return(typeGroup);
        }
コード例 #3
0
        /// <summary>
        /// Set variables for TypeGroup object
        /// </summary>
        /// <param name="typeGroupID"></param>
        /// <param name="typeGroup"></param>
        /// <param name="typeGroupName"></param>
        /// <param name="typeGroupName2"></param>
        /// <remarks>
        /// Takes a TypeGroup object along with variables and assigns the
        /// given variables to the parameters of the TypeGroup object.
        /// </remarks>
        /// <returns></returns>
        private static EventTypeGroup SetTypeGroupData(int typeGroupID, EventTypeGroup typeGroup, string typeGroupName, string typeGroupName2)
        {
            typeGroup.TypeGroupID         = typeGroupID;
            typeGroup.EventTypeGroupName  = typeGroupName;
            typeGroup.EventTypeGroupName2 = typeGroupName2;

            return(typeGroup);
        }
コード例 #4
0
        /// <summary>
        /// Create EventTypeGroup object
        /// </summary>
        /// <param name="eventItem"></param>
        /// <remarks>
        /// Takes an Event object along with an XElement node and returns
        /// an EventTypeGroup item based on the Event object and the TypeGroup
        /// object created from the given node.
        /// </remarks>
        /// <param name="node"></param>
        public EventTypeGroup AddEventTypeGroup(Event eventItem, XElement node)
        {
            Log.Debug("Started adding event type group.");
            EventTypeGroup typeGroupItem = EventTypeGroup.GetEventTypeGroupFromNode(node);

            if (typeGroupItem != null && typeGroupItem.TypeGroupID != 0)
            {
                eventItem.EventTypeGroup = typeGroupItem;
            }

            Log.Debug("Finished adding event type group.");
            return(typeGroupItem);
        }
コード例 #5
0
        /// <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);
            }
        }
コード例 #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the EventTypeGroups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEventTypeGroups(EventTypeGroup eventTypeGroup)
 {
     base.AddObject("EventTypeGroups", eventTypeGroup);
 }
コード例 #7
0
 /// <summary>
 /// Create a new EventTypeGroup object.
 /// </summary>
 /// <param name="typeGroupID">Initial value of the TypeGroupID property.</param>
 /// <param name="eventTypeGroupName">Initial value of the EventTypeGroupName property.</param>
 /// <param name="eventTypeGroupName2">Initial value of the EventTypeGroupName2 property.</param>
 /// <param name="createdOn">Initial value of the CreatedOn property.</param>
 /// <param name="modifiedOn">Initial value of the ModifiedOn property.</param>
 /// <param name="stamp">Initial value of the Stamp property.</param>
 /// <param name="active">Initial value of the Active property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 public static EventTypeGroup CreateEventTypeGroup(global::System.Int32 typeGroupID, global::System.String eventTypeGroupName, global::System.String eventTypeGroupName2, global::System.DateTime createdOn, global::System.DateTime modifiedOn, global::System.Byte[] stamp, global::System.Boolean active, global::System.Int32 createdBy, global::System.Int32 modifiedBy)
 {
     EventTypeGroup eventTypeGroup = new EventTypeGroup();
     eventTypeGroup.TypeGroupID = typeGroupID;
     eventTypeGroup.EventTypeGroupName = eventTypeGroupName;
     eventTypeGroup.EventTypeGroupName2 = eventTypeGroupName2;
     eventTypeGroup.CreatedOn = createdOn;
     eventTypeGroup.ModifiedOn = modifiedOn;
     eventTypeGroup.Stamp = stamp;
     eventTypeGroup.Active = active;
     eventTypeGroup.CreatedBy = createdBy;
     eventTypeGroup.ModifiedBy = modifiedBy;
     return eventTypeGroup;
 }
コード例 #8
0
        /// <summary>
        /// Update OPAS Data
        /// </summary>
        public void UpdateOPASData(XDocument loadDocument)
        {
            var recordsToUpdate = BsoArchiveEntities.Current.OPASUpdates.Where(d => !d.HasBeenUpdated);
            var entitesToUpdate = recordsToUpdate.GroupBy(d => d.TableName);

            foreach (var entity in entitesToUpdate)
            {
                Log.Debug(string.Format("Started update processing of entity: {0}", entity.Key));
                string columnName = entity.FirstOrDefault().ColumnName;
                string tagName    = entity.FirstOrDefault().TagName;
                switch ((Table)Enum.Parse(typeof(Table), entity.Key.ToUpper()))
                {
                case Table.EVENT:
                    opasData = Event.NewEvent();
                    break;

                case Table.ARTIST:
                    opasData = Artist.NewArtist();
                    break;

                case Table.EVENTTYPE:
                    opasData = EventType.NewEventType();
                    break;

                case Table.CONDUCTOR:
                    opasData = Conductor.NewConductor();
                    break;

                case Table.ORCHESTRA:
                    opasData = Orchestra.NewOrchestra();
                    break;

                case Table.PARTICIPANT:
                    opasData = Participant.NewParticipant();
                    break;

                case Table.PROJECT:
                    opasData = Project.NewProject();
                    break;

                case Table.SEASON:
                    opasData = Season.NewSeason();
                    break;

                case Table.EVENTTYPEGROUP:
                    opasData = EventTypeGroup.NewEventTypeGroup();
                    break;

                case Table.VENUE:
                    opasData = Venue.NewVenue();
                    break;

                case Table.WORK:
                    opasData = Work.NewWork();
                    break;

                case Table.WORKARTIST:
                    opasData = WorkArtist.NewWorkArtist();
                    break;
                }
                opasData.UpdateData(loadDocument, columnName, tagName);
                entity.FirstOrDefault().HasBeenUpdated = true;
                BsoArchiveEntities.Current.Detach(opasData);

                Log.Debug(string.Format("Finished update processing of entity: {0}", entity.Key));
            }
            BsoArchiveEntities.Current.Save();
        }
コード例 #9
0
        public static EventTypeGroup NewEventTypeGroup()
        {
            EventTypeGroup newObject = new EventTypeGroup();

            BsoArchiveEntities.Current.AddToEventTypeGroups(newObject);
            BsoArchiveEntities.SetDefaultValue(newObject);
            return newObject;
        }
コード例 #10
0
        /// <summary>
        /// Set variables for TypeGroup object
        /// </summary>
        /// <param name="typeGroupID"></param>
        /// <param name="typeGroup"></param>
        /// <param name="typeGroupName"></param>
        /// <param name="typeGroupName2"></param>
        /// <remarks>
        /// Takes a TypeGroup object along with variables and assigns the
        /// given variables to the parameters of the TypeGroup object.
        /// </remarks>
        /// <returns></returns>
        private static EventTypeGroup SetTypeGroupData(int typeGroupID, EventTypeGroup typeGroup, string typeGroupName, string typeGroupName2)
        {
            typeGroup.TypeGroupID = typeGroupID;
            typeGroup.EventTypeGroupName = typeGroupName;
            typeGroup.EventTypeGroupName2 = typeGroupName2;

            return typeGroup;
        }