Exemple #1
0
            public EventRow AddEventRow(int EventID, int VenueID, string EventName, string EventDescription, byte[] EventPhoto, System.DateTime EventDate, decimal GoldPackagePrice, decimal SilverPackagePrice, decimal BronzePackagePrice, decimal GoldPackageTrueCost, decimal SilverPackageTrueCost, decimal BronzePackageTrueCost, decimal EventTotalCost, string EventTypeName, string VenueName)
            {
                EventRow rowEventRow = ((EventRow)(this.NewRow()));

                object[] columnValuesArray = new object[] {
                    EventID,
                    VenueID,
                    EventName,
                    EventDescription,
                    EventPhoto,
                    EventDate,
                    GoldPackagePrice,
                    SilverPackagePrice,
                    BronzePackagePrice,
                    GoldPackageTrueCost,
                    SilverPackageTrueCost,
                    BronzePackageTrueCost,
                    EventTotalCost,
                    EventTypeName,
                    VenueName
                };
                rowEventRow.ItemArray = columnValuesArray;
                this.Rows.Add(rowEventRow);
                return(rowEventRow);
            }
Exemple #2
0
        private static void LoadEventSentEmail(EventRow eventRow, EventDataTable systemEvent, int sentEmailID)
        {
            BulkLoader bulkLoader;
            DataTable  eventSentEmailTable;

            using (AdoDataConnection connection = new AdoDataConnection(s_dbAdapterContainer.Connection, typeof(SqlDataAdapter), false))
            {
                // Query an empty table with matching schema --
                // union table to itself to eliminate unique key constraints
                eventSentEmailTable           = connection.RetrieveData("SELECT * FROM EventSentEmail WHERE 1 IS NULL UNION ALL SELECT * FROM EventSentEmail WHERE 1 IS NULL");
                eventSentEmailTable.TableName = "EventSentEmail";
            }

            foreach (MeterData.EventRow evt in systemEvent)
            {
                if (eventRow.LineID == evt.LineID)
                {
                    eventSentEmailTable.Rows.Add(0, evt.ID, sentEmailID);
                }
            }

            bulkLoader                = new BulkLoader();
            bulkLoader.Connection     = s_dbAdapterContainer.Connection;
            bulkLoader.CommandTimeout = s_dbAdapterContainer.CommandTimeout;
            bulkLoader.Load(eventSentEmailTable);
        }
Exemple #3
0
 public void AddEventRow(EventRow eventrowToAdd)
 {
     executeQuery("INSERT INTO EventRow VALUES (" +
                 eventrowToAdd.numRow + "," +
                 eventrowToAdd.eventId + "," +
                 eventrowToAdd.type.id + ")");
 }
        private EventRow ParseEventEnd(EventRow @event, IEventData data)
        {
            if (@event == null)
            {
                this.error.AppendLine("No event");
                return(@event);
            }

            if (string.IsNullOrEmpty(@event.Id))
            {
                this.error.AppendLine("Invalid event id");
                return(@event);
            }

            var start = $"[{@event.Id}]";
            var end   = this.Event;

            if (!start.Equals(end))
            {
                this.error.AppendLine("Mismatched event start and end tokens");
                return(@event);
            }

            data.AddEvent(@event);
            return(null);
        }
        private EventRow ParseEventStart(IEventData data, EventRow @event, int row)
        {
            var id = this.Event;

            if (!this.idRegex.IsMatch(id))
            {
                this.error.AppendLine($"Event id must only contain characters in {IdCharRange}. Current value: {this.Event}");
                return(null);
            }

            if (@event != null && [email protected](id))
            {
                this.error.AppendLine($"Event `{@event.Id}` must end before starting a new one");
                return(@event);
            }

            if (!this.Stage.TryParse(out var invokeType))
            {
                this.error.AppendLine(string.Format("Invoke type can only be either empty, {0}, {1}, or {2}",
                                                    InvokeTypeExtensions.ALL,
                                                    InvokeTypeExtensions.START_TO_CURRENT,
                                                    InvokeTypeExtensions.ONLY_CURRENT));
                return(null);
            }

            if (data.Events.ContainsKey(id))
            {
                Debug.LogWarning($"Vsq row {row}: Event id has already existed");
            }

            return(new EventRow(row, id, invokeType));
        }
        private void ParseStage(EventRow @event, CommandParser commandParser)
        {
            var stage = 0;

            if (this.HasStage &&
                !int.TryParse(this.Stage, out stage))
            {
                this.error.AppendLine($"Cannot convert stage value to integer. Current value: {this.Stage}");
                return;
            }

            if (stage < 0)
            {
                this.error.AppendLine($"State value must be positive (stage >= 0). Current value: {stage}");
                return;
            }

            if (@event.ContainsStage(stage))
            {
                this.error.AppendLine($"Stage {stage} has already existed");
                return;
            }

            var maxConstraint = this.MaxConstraint ?? -1;
            var command       = commandParser.Parse(this.Commands, this.error);

            if (this.IsError)
            {
                return;
            }

            @event.AddStage(stage, command, maxConstraint);
        }
Exemple #7
0
 public override void FromRawData(byte [] buff, int offs, int numRows)
 {
     for (int i = numRows; --i >= 0;)
     {
         Row row = new EventRow(this);
         row.FromRawData(buff, offs);
         Add(row);
         offs += EventRow.LogicalSize;
     }
 }
Exemple #8
0
        void ReadEvents()
        {
            if (!m_tHeap.HasTable(EventTable.RId))
            {
                m_events = new EventDefinition [0];
                return;
            }

            EventTable    evtTable  = m_tableReader.GetEventTable();
            EventMapTable emapTable = m_tableReader.GetEventMapTable();

            m_events = new EventDefinition [evtTable.Rows.Count];
            for (int i = 0; i < emapTable.Rows.Count; i++)
            {
                EventMapRow emapRow = emapTable [i];
                if (emapRow.Parent == 0)
                {
                    continue;
                }

                TypeDefinition owner   = GetTypeDefAt(emapRow.Parent);
                GenericContext context = new GenericContext(owner);

                int start = (int)emapRow.EventList, last = evtTable.Rows.Count + 1, end;
                if (i < (emapTable.Rows.Count - 1))
                {
                    end = (int)emapTable [i + 1].EventList;
                }
                else
                {
                    end = last;
                }

                if (end > last)
                {
                    end = last;
                }

                for (int j = start; j < end; j++)
                {
                    EventRow        erow = evtTable [j - 1];
                    EventDefinition edef = new EventDefinition(
                        m_root.Streams.StringsHeap [erow.Name],
                        GetTypeDefOrRef(erow.EventType, context), erow.EventFlags);
                    edef.MetadataToken = MetadataToken.FromMetadataRow(TokenType.Event, j - 1);

                    if (!IsDeleted(edef))
                    {
                        owner.Events.Add(edef);
                    }

                    m_events [j - 1] = edef;
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Reads the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="result">The result.</param>
        public void Read(TokenTypes token, out EventRow result)
        {
            if ((token & TokenTypes.TableMask) != TokenTypes.Event)
            {
                throw new ArgumentException("Invalid token type for EventRow.", "token");
            }

            using (BinaryReader reader = CreateReaderForToken(token))
            {
                result = new EventRow((EventAttributes)reader.ReadUInt16(), ReadIndexValue(reader, IndexType.StringHeap), ReadIndexValue(reader, IndexType.TypeDefOrRef));
            }
        }
            public EventRow AddEventRow(int EventId, string SourceName, string EventName)
            {
                EventRow rowEventRow = ((EventRow)(this.NewRow()));

                object[] columnValuesArray = new object[] {
                    EventId,
                    SourceName,
                    EventName
                };
                rowEventRow.ItemArray = columnValuesArray;
                this.Rows.Add(rowEventRow);
                return(rowEventRow);
            }
Exemple #11
0
        private EventElement CreateEventGUI(VisualElement root, EventRow @event)
        {
            var eventElem = new EventElement {
                text = @event.Id
            };

            var stagesContainer = new StagesContainer();

            eventElem.Content.Add(new InvokeTypeElement {
                value = @event.InvokeType.ToKeyword()
            });
            eventElem.Content.Add(stagesContainer);

            foreach (var stage in @event.Stages)
            {
                var stageContainer = new StageContainer();
                stagesContainer.Add(stageContainer);

                stageContainer.Add(new StageElement {
                    value = $"{stage.Index}"
                });

                if (stage.MaxConstraint >= 0)
                {
                    stageContainer.Add(new StageElement {
                        value = $"<{stage.MaxConstraint}>"
                    });
                }

                var commandContainer = new CommandContainer();
                stageContainer.Add(commandContainer);

                foreach (var command in stage.Commands)
                {
                    commandContainer.Add(new CommandElement {
                        value = command.Id
                    });
                }
            }

            root.Add(eventElem);
            return(eventElem);
        }
Exemple #12
0
        private async Task <EventInformation> From(EventRow eventRow)
        {
            var eventInformation = new EventInformation {
                Id            = Guid.Parse(eventRow.RowKey),
                IsStarted     = eventRow.IsStarted,
                IsDone        = eventRow.IsDone,
                IsSuccessful  = eventRow.IsSuccessful,
                ExecutionDate = eventRow.ExecutionDate,
                Type          = eventRow.Type
            };

            if (string.IsNullOrEmpty(eventRow.Actions))
            {
                return(eventInformation);
            }
            var actionIdentifiers = eventRow.GetActionIdentifiers(_jsonConverter);

            if (actionIdentifiers.Any())
            {
                eventInformation.CommandInformations = (await GetCommandInformation(actionIdentifiers)).ToArray();
            }
            return(eventInformation);
        }
        public EventRow Parse(IEventData data, EventRow @event, CommandParser commandParser, int row)
        {
            this.error.Clear();

            if (!this.IsEmpty)
            {
                if (this.IsEventStart)
                {
                    return(ParseEventStart(data, @event, row));
                }

                if (this.IsEventEnd)
                {
                    return(ParseEventEnd(@event, data));
                }

                if (this.HasStage)
                {
                    ParseStage(@event, commandParser);
                }
            }

            return(@event);
        }
        private EventAsset Parse(Parser <VseRow> parser, string csvData, EventAsset asset)
        {
            var enumerator = parser.Parse(csvData).GetEnumerator();
            var row        = 0;
            var error      = string.Empty;

            EventRow @event = null;

            while (enumerator.MoveNext())
            {
                if (!enumerator.Current.IsValid)
                {
                    error = enumerator.Current.Error.ToString();
                    break;
                }

                var vseRow = enumerator.Current.Result;
                row = enumerator.Current.RowIndex + 1;

                @event = vseRow.Parse(asset, @event, this.commandParser, row);

                if (vseRow.IsError)
                {
                    error = vseRow.Error;
                    break;
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                Debug.LogError($"Vse row {row}: {error}");
                return(null);
            }

            return(asset);
        }
Exemple #15
0
 public EventRowChangeEvent(EventRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
 public void AddEventRow(EventRow row)
 {
     this.Rows.Add(row);
 }
Exemple #17
0
 public void DeleteEventRow(EventRow eventrowToDelete)
 {
     executeQuery("DELETE FROM EventRow WHERE numrow = " +
                 eventrowToDelete.numRow + " AND eventId = " +
                 eventrowToDelete.eventId + ";");
 }
 public virtual void VisitEventRow(EventRow row)
 {
 }
Exemple #19
0
        public List<EventRow> GetAllEventRows(int selectedEventId)
        {
            String sql = "SELECT * FROM EventRow WHERE eventId = " + selectedEventId + " ORDER BY eventId, numrow";
            List<List<String>> result = GetAllData(new String[] { "eventId", "numrow", "type" }, sql);
            List<EventRow> eventrows = new List<EventRow>();
            EventRow eventrow;

            foreach (List<String> row in result)
            {
                eventrow = new EventRow(
                    Convert.ToInt32(row[1]),
                    selectedEventId,
                    eventTypeClass.GetEventTypeById(Convert.ToInt32(row[2])));
                eventrows.Add(eventrow);
                Console.WriteLine(row[2] + " -> " + eventTypeClass.GetEventTypeById(Convert.ToInt32(row[2])));
            }

            return eventrows;
        }
Exemple #20
0
        void IMetadataProvider.Read(TokenTypes token, out EventRow result)
        {
            TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables];

            theap.Read(token, out result);
        }
 public void RemoveEventRow(EventRow row)
 {
     this.Rows.Remove(row);
 }
 public virtual void VisitEventRow(EventRow row)
 {
 }
 private EventKey CreateEventKey(EventRow evt)
 {
     return(Tuple.Create(evt.LineID, evt.StartTime, evt.EndTime));
 }
        private static void LoadEventSentEmail(EventRow eventRow, EventDataTable systemEvent, int sentEmailID)
        {
            BulkLoader bulkLoader;
            DataTable eventSentEmailTable;

            using (AdoDataConnection connection = new AdoDataConnection(s_dbAdapterContainer.Connection, typeof(SqlDataAdapter), false))
            {
                // Query an empty table with matching schema --
                // union table to itself to eliminate unique key constraints
                eventSentEmailTable = connection.RetrieveData("SELECT * FROM EventSentEmail WHERE 1 IS NULL UNION ALL SELECT * FROM EventSentEmail WHERE 1 IS NULL");
                eventSentEmailTable.TableName = "EventSentEmail";
            }

            foreach (MeterData.EventRow evt in systemEvent)
            {
                if (eventRow.LineID == evt.LineID)
                    eventSentEmailTable.Rows.Add(0, evt.ID, sentEmailID);
            }

            bulkLoader = new BulkLoader();
            bulkLoader.Connection = s_dbAdapterContainer.Connection;
            bulkLoader.CommandTimeout = s_dbAdapterContainer.CommandTimeout;
            bulkLoader.Load(eventSentEmailTable);
        }