Ejemplo n.º 1
0
        public async Task HandleCommandAsync(CreateEventCommand command)
        {
            var work    = new UnitOfWork(_repository);
            var newNote = new Domain.Event(command.AggregateId, command.EventDate, command.CustomerId, command.SiteId, command.EventType, command.EventState, command.EventData);

            work.Add(newNote);

            await work.CommitAsync();
        }
Ejemplo n.º 2
0
        private async Task SendEventToSubscribers(Domain.Event result)
        {
            var eventHubConnection = _hubConnectionBuilder
                                     .WithUrl($"{Request.Scheme}://{Request.Host}/{EventsHub.HubPath}")
                                     .Build();
            await eventHubConnection.StartAsync();

            await eventHubConnection.SendAsync("Send", result);

            await eventHubConnection.DisposeAsync();
        }
Ejemplo n.º 3
0
        private void HandleEvent(Domain.Event e)
        {
            switch (e.Name)
            {
            case EventName.ContestantRegistered:
                var contestants = _client.GetContestants();
                AddContestantsToGrid(contestantsGrid, contestants);
                searchByTeamButton_Click(null, null);
                AddAllRaces();
                break;

            case EventName.TeamAdded:
                AddAllTeams();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
        public Event getEventsInfo(int eventId)
        {
            var myEvent = new Domain.Event();

            try
            {
                SqlConnection conn = DBManager.getSqlConnection();
                conn.Open();
                string sql = "select E.id,E.ownerUserId,E.eventName,E.eventLocation,E.eventDateFrom,E.eventDateTo,E.status " +
                             " from event_info E where E.id=" + eventId;//get the event Id
                SqlCommand cmd = new SqlCommand(sql, conn);
                // Start a local transaction.
                SqlDataReader dr = cmd.ExecuteReader();
                //Timeline.AppCode.Domain.Event event = new Domain.Event();


                if (dr.Read())
                {
                    myEvent.id = dr.GetInt32(0);
                    User owner = new User();
                    owner.loadSelf();
                    myEvent.owner        = owner;
                    myEvent.name         = dr.GetString(2);
                    myEvent.location     = dr.GetString(3);
                    myEvent.from         = dr.GetDateTime(4);
                    myEvent.to           = dr.GetDateTime(5);
                    myEvent.status       = dr.GetString(6);
                    myEvent.participants = this.getParticipants(myEvent.id);
                }

                dr.Close();
                conn.Close();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(@"Commit Exception Type: {0}", ex.GetType());
                System.Diagnostics.Debug.WriteLine(@"Message: {0}", ex.Message);
                throw ex;
            }

            return(myEvent);
        }
Ejemplo n.º 5
0
        private async Task SendEventToSubscribers(Domain.Event result)
        {
            try
            {
                string token = GetTokenFromHeaders();
                var    eventHubConnection = _hubConnectionBuilder
                                            .WithAccessToken(() => token)
                                            .WithUrl($"{Request.Scheme}://{Request.Host}{EventsHub.HubPath}")
                                            .Build();
                await eventHubConnection.StartAsync();

                await eventHubConnection.SendAsync("Send", result);

                await eventHubConnection.DisposeAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Encountered exception when attempting to send posted event to SignalR subscribers.", new object[] { });
            }
        }
Ejemplo n.º 6
0
        private async Task SendEventToSubscribers(Domain.Event result)
        {
            var url = $"http://localhost:{Request.Host.Port}{EventsHub.HubPath}";

            try
            {
                string token = GetTokenFromHeaders();
                var    eventHubConnection = _hubConnectionBuilder
                                            .WithAccessToken(() => token)
                                            .WithUrl(url)
                                            .Build();
                await eventHubConnection.StartAsync();

                await eventHubConnection.SendAsync("Send", result);

                await eventHubConnection.DisposeAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Encountered exception when attempting to send posted event to SignalR subscribers, url: {url}");
            }
        }
Ejemplo n.º 7
0
 private static Event GetProtobufEvent(Domain.Event eventt)
 {
     if (eventt == Domain.Event.NONE)
     {
         return(Event.None);
     }
     if (eventt == Domain.Event.E50M)
     {
         return(Event.E50M);
     }
     if (eventt == Domain.Event.E100M)
     {
         return(Event.E100M);
     }
     if (eventt == Domain.Event.E1000M)
     {
         return(Event.E1000M);
     }
     if (eventt == Domain.Event.E1500M)
     {
         return(Event.E1500M);
     }
     return(Event.None);
 }
Ejemplo n.º 8
0
 bool IFilterByMatch <Domain.Event> .IsMatchFor(Domain.Event toCompare)
 => IsMatchFor(Mapper.Map <Data.Incidents.Models.Event>(toCompare));