Пример #1
0
        private static EventResponse LogPayload(EventRequest eventRequest)
        {
            var resp = new EventResponse();

            var userName = AuthIntegration.HasClaims() ? AuthIntegration.GetOperator().UserName : null;

            if (string.IsNullOrEmpty(userName))
            {
                return(resp);
            }

            //[DATE TIME] [SEVERITY] [APPLICATION] [METHOD] DETAIL
            try
            {
                //LogManager.SetLogicalContextProperty(LogProperties.ApplicationName, $"{eventRequest.Source}");

                foreach (var payload in eventRequest.Payload)
                {
                    logger.Info(Environment.NewLine + payload.Data);
                }
            }
            catch
            {
                throw new Exception("Event could not be logged");
            }

            return(resp);
        }
Пример #2
0
        private static EventResponse Log(EventRequest eventRequest)
        {
            var resp = new EventResponse();

            var userName = AuthIntegration.HasClaims() ? AuthIntegration.GetOperator().UserName : null;

            if (string.IsNullOrEmpty(userName))
            {
                return(resp);
            }

            //[DATE TIME] [SEVERITY] [APPLICATION] [METHOD] DETAIL
            try
            {
                //LogManager.SetLogicalContextProperty(LogProperties.ApplicationName, $"{eventRequest.Source}");
                var jsonString = JsonProcessor.SerializeObject(eventRequest.Payload);
                var strLog     = $"Msg='{jsonString}'";

                logger.Info(strLog);
            }
            catch
            {
                throw new Exception("Event could not be logged");
            }

            return(resp);
        }
Пример #3
0
        public static BusinessMetadata SetResponseProperties(int?flags, DataSource dataSource)
        {
            var businessMetadata = new BusinessMetadata();

            if (flags != null)
            {
                // Delete cache for Countries, States, Currencies, Industries.
                // Re fetch data causing cache of new data.

                // removed usage of code tables for country, subdivision, currency, and industry.
                // we should no longer react to its changes
//                businessMetadata.CodeTablesChanged = (flags & 1) != 0 || (flags & 16) != 0;

                //Delete CacheKeys.AUTHCLAIMS, CacheKeys.AGENTPROFILECLAIMS, CacheKeys.AGENTPROFILEKEY from cache
                businessMetadata.ProfileChanged = (flags & 2) != 0;
            }

            businessMetadata.ServicesEnvironment = GetServicesEnvironment();
            businessMetadata.ApiCodeVersion      = AwVersion.Api;
            businessMetadata.AcVersion           = AwVersion.Ac;

            var authOperator = AuthIntegration.GetOperator();
            var agent        = AuthIntegration.GetAgent();

            businessMetadata.OperatorLanguage = authOperator.Language;
            businessMetadata.AgentId          = agent.AgentId;
            businessMetadata.PosNum           = agent.AgentSequence;
            businessMetadata.UnitProfileId    = agent.UnitProfileId.ToString();
            businessMetadata.DataSource       = dataSource;

            return(businessMetadata);
        }
Пример #4
0
        //Following is placeholder code
        public ApiResponse <Operator, ApiData> GetOperator()
        {
            var respVm = AuthIntegration.GetOperator();

            var apiResp = new ApiResponse <Operator, ApiData>
            {
                BusinessMetadata = MapperHelper.SetResponseProperties(null, DataSource.Operator),
                ResponseData     = respVm
            };

            return(apiResp);
        }