protected void LogException(Exception ex)
        {
            object actionArguments = null, userId = null;

            HttpContext.Items.TryGetValue("ActionRquestData", out actionArguments);
            HttpContext.Items.TryGetValue("ControllerName", out object controllerName);
            HttpContext.Items.TryGetValue("ActionName", out object actionName);

            LogHandler.Logger _logger = HttpContext.RequestServices.GetService <LogHandler.Logger>();

            if (ex is GenericCustomException || ex is NotFoundCustomException || ex is UnauthorizedCustomException)
            {
                _logger.WarningLog(ex.Message, actionArguments, errorCode: ErrorCode(ex), identity: Convert.ToString(userId), fileName: $"{controllerName}.cs", methodName: Convert.ToString(actionName));
            }
            else
            {
                if (ex.InnerException != null)
                {
                    if (ex.InnerException.GetType() == typeof(GenericCustomException) || ex.InnerException.GetType() == typeof(NotFoundCustomException) || ex.InnerException.GetType() == typeof(UnauthorizedCustomException))
                    {
                        _logger.WarningLog(ex.Message, actionArguments, errorCode: ErrorCode(ex), identity: Convert.ToString(userId), fileName: $"{controllerName}.cs", methodName: Convert.ToString(actionName));
                    }
                    else
                    {
                        _logger.ErrorLog(ex.InnerException.Message, ex, actionArguments, errorCode: ErrorCode(ex), identity: Convert.ToString(userId), fileName: $"{controllerName}.cs", methodName: Convert.ToString(actionName));
                    }
                }
                else
                {
                    _logger.ErrorLog(ex.Message, ex, actionArguments, errorCode: ErrorCode(ex), identity: Convert.ToString(userId), fileName: $"{controllerName}.cs", methodName: Convert.ToString(actionName));
                }
            }
        }
Ejemplo n.º 2
0
 public DashboardService(IDashboardRepository dashboardrepository, LogHandler.Logger logManager, IDeviceService deviceService, IEntityService entityService)
 {
     _dashboardrepository = dashboardrepository;
     _logger        = logManager;
     _deviceService = deviceService;
     _entityService = entityService;
 }
Ejemplo n.º 3
0
 public SubscriberHelper(LogHandler.Logger logger)
 {
     _logger           = logger;
     _httpClientHelper = new HttpClientHelper(logger);
     apiBaseURL        = SolutionConfiguration.Configuration.SubscriptionAPI.BaseUrl;
     InitSubscriptionToken();
 }
Ejemplo n.º 4
0
 public DashboardService(ILocationRepository locationRepository, IDashboardRepository dashboardrepository, LogHandler.Logger logManager, IGeneratorService generatorService)
 {
     _locationRepository  = locationRepository;
     _dashboardrepository = dashboardrepository;
     _logger           = logManager;
     _generatorService = generatorService;
 }
 public HardwareKitService(IHardwareKitRepository hardwareKitRepository, IKitTypeAttributeRepository kitTypeAttributeRepository, IKitTypeRepository kitTypeRepository, LogHandler.Logger logManager)
 {
     _hardwareKitRepository      = hardwareKitRepository;
     _kitTypeAttributeRepository = kitTypeAttributeRepository;
     _kitTypeRepository          = kitTypeRepository;
     _logger = logManager;
 }
Ejemplo n.º 6
0
 public NotificationsService(INotificationsRepository notificationsRepository, IKitTypeService kitTypeService, LogHandler.Logger logger)
 {
     _logger = logger;
     _inotificationsrepository = notificationsRepository;
     _kitTypeService           = kitTypeService;
     _iotConnectClient         = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 7
0
 public EntityService(IEntityRepository entityRepository, LogHandler.Logger logger, IDeviceRepository deviceRepository)
 {
     _logger           = logger;
     _entityRepository = entityRepository;
     _deviceRepository = deviceRepository;
     _iotConnectClient = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 8
0
 public RoleService(IRoleRepository userRoleRepository, LogHandler.Logger logger, IUserRepository userRepository)
 {
     _logger           = logger;
     _roleRepository   = userRoleRepository;
     _userRepository   = userRepository;
     _iotConnectClient = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 9
0
        public DeviceRepository(IUnitOfWork unitOfWork, LogHandler.Logger logManager, IWebHostEnvironment env) : base(unitOfWork, logManager)
        {
            logger = logManager;
            _uow   = unitOfWork;

            _env = env;
        }
Ejemplo n.º 10
0
 public LocationService(ILocationRepository locationRepository, LogHandler.Logger logger, IGeneratorRepository generatorRepository, IGeneratorService generatorService)
 {
     _logger              = logger;
     _locationRepository  = locationRepository;
     _generatorRepository = generatorRepository;
     _iotConnectClient    = new IotConnectClient(component.helper.SolutionConfiguration.BearerToken, component.helper.SolutionConfiguration.Configuration.EnvironmentCode, component.helper.SolutionConfiguration.Configuration.SolutionKey);
     _generatorService    = generatorService;
 }
Ejemplo n.º 11
0
 public DeviceService(IDeviceRepository deviceRepository, ILookupService lookupService, IHardwareKitRepository hardwareKitRepository, LogHandler.Logger logger)
 {
     _logger                = logger;
     _deviceRepository      = deviceRepository;
     _lookupService         = lookupService;
     _hardwareKitRepository = hardwareKitRepository;
     _iotConnectClient      = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
 public GreenHouseService(IGreenHouseRepository greenHouseRepository, ICropRepository cropRepository, LogHandler.Logger logger, IDeviceRepository deviceRepository)
 {
     _logger = logger;
     _greenHouseRepository = greenHouseRepository;
     _cropRepository       = cropRepository;
     _deviceRepository     = deviceRepository;
     _iotConnectClient     = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
 public SubscriberService(LogHandler.Logger logger, IHardwareKitRepository hardwareKitRepository, IKitTypeRepository kitTypeRepository, ICompanyRepository companyRepository, IUserRepository userRepository)
 {
     _logger                = logger;
     _subscriberHelper      = new SubscriberHelper(logger);
     _hardwareKitRepository = hardwareKitRepository;
     _companyRepository     = companyRepository;
     _userRepository        = userRepository;
 }
 public SubscriberService(LogHandler.Logger logger, IHardwareKitRepository hardwareKitRepository, IUserRepository userRepository, ICompanyRepository companyRepository)
 {
     _logger = logger;
     _hardwareKitRepository = hardwareKitRepository;
     _companyRepository     = companyRepository;
     _userRepository        = userRepository;
     _subscriberHelper      = new SubscriberHelper(logger);
     _iotConnectClient      = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 15
0
 public DashboardService(IEntityRepository entityRepository, IDashboardRepository dashboardrepository, IDeviceService deviceService, LogHandler.Logger logManager, IUserDashboardWidgetRepository userDashboardWidgetRepository, IMasterWidgetRepository masterWidgetRepository)
 {
     _entityRepository    = entityRepository;
     _dashboardrepository = dashboardrepository;
     _deviceService       = deviceService;
     _logger = logManager;
     _userDashboardWidgetRepository = userDashboardWidgetRepository;
     _masterWidgetRepository        = masterWidgetRepository;
 }
Ejemplo n.º 16
0
        public UnitOfWork(DbContext dbContext, LogHandler.Logger logManager)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DBContext cannot be null.");
            }
            if (logManager == null)
            {
                throw new ArgumentNullException("LogManager cannot be null");
            }

            DbContext = (EF.qagreenhouseContext)dbContext;
            _logger   = logManager;
        }
 public LookupService(LogHandler.Logger logManager, IGeneratorRepository deviceRepository, IkitTypeCommandRepository kitTypeCommandRepository
                      , ILocationRepository locationRepository, IHardwareKitRepository hardwareKitRepository
                      , ICompanyRepository companyRepository
                      , IKitTypeRepository kitTypeRepository, IKitTypeAttributeRepository kitTypeAttributeRepository)
 {
     _logger                     = logManager;
     _deviceRepository           = deviceRepository;
     _kitTypeCommandRepository   = kitTypeCommandRepository;
     _locationRepository         = locationRepository;
     _hardwareKitRepository      = hardwareKitRepository;
     _companyRepository          = companyRepository;
     _kitTypeAttributeRepository = kitTypeAttributeRepository;
     _kitTypeRepository          = kitTypeRepository;
     _iotConnectClient           = new IotConnectClient(component.helper.SolutionConfiguration.BearerToken, component.helper.SolutionConfiguration.Configuration.EnvironmentCode, component.helper.SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 18
0
 public LookupService(LogHandler.Logger logManager, IDeviceRepository deviceRepository, IkitTypeCommandRepository kitTypeCommandRepository
                      , IEntityRepository entityRepository, IHardwareKitRepository hardwareKitRepository
                      , ICompanyRepository companyRepository
                      , IKitTypeRepository kitTypeRepository, IKitTypeAttributeRepository kitTypeAttributeRepository)
 {
     _logger                     = logManager;
     _deviceRepository           = deviceRepository;
     _kitTypeCommandRepository   = kitTypeCommandRepository;
     _entityRepository           = entityRepository;
     _hardwareKitRepository      = hardwareKitRepository;
     _companyRepository          = companyRepository;
     _kitTypeAttributeRepository = kitTypeAttributeRepository;
     _kitTypeRepository          = kitTypeRepository;
     _iotConnectClient           = new IotConnectClient(SolutionConfiguration.BearerToken, SolutionConfiguration.Configuration.EnvironmentCode, SolutionConfiguration.Configuration.SolutionKey);
 }
        public GenericRepository(IUnitOfWork unitOfWork, LogHandler.Logger logger)
        {
            ConnectionString = component.helper.SolutionConfiguration.Configuration.ConnectionString;

            if (unitOfWork == null)
            {
                throw new ArgumentNullException("UnitOfWork cannot be null.");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("LogManager cannot be null");
            }

            _uow    = unitOfWork;
            _logger = logger;
        }
 public EntityRepository(IUnitOfWork unitOfWork, LogHandler.Logger logManager) : base(unitOfWork, logManager)
 {
     logger = logManager;
     _uow   = unitOfWork;
 }
 public GreenHouseRepository(IUnitOfWork unitOfWork, LogHandler.Logger logger) : base(unitOfWork, logger)
 {
     _logger = logger;
     _uow    = unitOfWork;
 }
 public CompanyConfigRepository(IUnitOfWork unitOfWork, LogHandler.Logger logManager) : base(unitOfWork, logManager)
 {
     logger = logManager;
     _uow   = unitOfWork;
 }
 public DatabaseManager(string connectionString, LogHandler.Logger logger)
 {
     _connectionString = connectionString;
     _logger           = logger;
 }
 public UserService(IUserRepository userRepository, LogHandler.Logger logManager)
 {
     _logger           = logManager;
     _userRepository   = userRepository;
     _iotConnectClient = new IotConnectClient(component.helper.SolutionConfiguration.BearerToken, component.helper.SolutionConfiguration.Configuration.EnvironmentCode, component.helper.SolutionConfiguration.Configuration.SolutionKey);
 }
Ejemplo n.º 25
0
 public CompanyRepository(IUnitOfWork unitOfWork, LogHandler.Logger logger) : base(unitOfWork, logger)
 {
     _logger = logger;
     _uow    = unitOfWork;
 }
Ejemplo n.º 26
0
 public AdminRuleService(IAdminRuleRepository adminRuleRepository, LogHandler.Logger logManager)
 {
     _adminRuleRepository = adminRuleRepository;
     _logger = logManager;
 }
Ejemplo n.º 27
0
 public kitTypeCommandRepository(IUnitOfWork unitOfWork, LogHandler.Logger logManager) : base(unitOfWork, logManager)
 {
     logger = logManager;
     _uow   = unitOfWork;
 }
Ejemplo n.º 28
0
 public TopicSubscriber(string serviceBusEndpoint, string serviceBusTopic, string subscriptionName, LogHandler.Logger logger)
 {
     _logger             = logger;
     _subscriptionClient = new SubscriptionClient(serviceBusEndpoint, serviceBusTopic, subscriptionName);
 }
Ejemplo n.º 29
0
 public ChartService(IEntityRepository entityRepository, LogHandler.Logger logger)//, LogHandler.Logger logger)
 {
     _entityRepository = entityRepository;
     _logger           = logger;
 }
 public DashboardService(IDashboardRepository dashboardrepository, LogHandler.Logger logger, IDeviceService deviceService)
 {
     _dashboardrepository = dashboardrepository;
     _logger        = logger;
     _deviceService = deviceService;
 }