public async Task <TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <TResponse> next)
        {
            Model.EventLog commandLog = null;

            if (request is ICommandEvent)
            {
                commandLog = Model.EventLog.Create(request);
            }

            var response = await next();

            if (commandLog != null)
            {
                if (response is UploadAudioCommandResult)
                {
                    var rspObj = response as UploadAudioCommandResult;

                    commandLog.AddProfileId(rspObj.ProfileId);
                }

                commandLog.AddResult(response);
                await _queueService.AddMessage(commandLog);
            }

            return(response);
        }
        public async Task <TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <TResponse> next)
        {
            Model.EventLog commandLog = null;

            var response = await next();

            if (request is ICommandEvent)
            {
                commandLog = Model.EventLog.Create(request);
            }

            if (commandLog != null)
            {
                commandLog.AddResult(response);
                await _queueService.AddMessage(commandLog);
            }

            return(response);
        }
        public static void LogEvent(string Action, string Table_name, long?Record_id, string Message, bool Error)
        {
            if (EnableLogging == false)
            {
                return;
            }

            Model.EventLog event_log = new Model.EventLog
            {
                App             = App.Name,
                AppVersion      = App.Version,
                UserName        = Environment.UserName,
                MachineName     = Environment.MachineName,
                IP_Address      = IP_Address,
                TableName       = Table_name,
                RecordID        = Record_id,
                Message         = Message,
                Error           = Error,
                RecordsReturned = null,
                ActionDateTime  = DateTime.Now,
                ActionTaken     = Action
            };
        }