Exemple #1
0
 public GraphUpdaterApplication(IMembershipDifferenceCalculator <AzureADUser> differenceCalculator, IGraphGroupRepository graphGroups, ISyncJobRepository syncJobRepository, ILoggingRepository logging)
 {
     _differenceCalculator = differenceCalculator;
     _graphGroups          = graphGroups;
     _syncJobRepo          = syncJobRepository;
     _log = logging;
 }
Exemple #2
0
 public PhotosController(IPhotoRepository photoRepository, IAlbumRepository albumRepository, IFeedbackRepository feedbackRepository, ILoggingRepository loggingRepository)
 {
     _photoRepository    = photoRepository;
     _albumRepository    = albumRepository;
     _feedbackRepository = feedbackRepository;
     _loggingRepository  = loggingRepository;
 }
        private static void TestRepository()
        {
            ILoggingRepository repo = Core.Factory.GetILoggingRepository();

            var dateTimeStart = new DateTime(2011, 10, 4, 0, 3, 12);
            var user          = repo.GetUserByApiKey("bWFpbEBwZXRlcmdlcnJpdHNlbi5ubA");

            Random rand = new Random();

            var e1Offset  = rand.NextDouble();
            var e2Offset  = rand.NextDouble();
            var gasOffset = rand.NextDouble();

            for (int i = 0; i < 100; i++)
            {
                var logEntry = new LogEntry();
                logEntry.Timestamp            = dateTimeStart.AddMinutes(90 * i);
                logEntry.UserId               = user.UserId;
                logEntry.E1                   = Convert.ToDecimal(e1Offset);
                logEntry.E2                   = Convert.ToDecimal(e2Offset);
                logEntry.GasMeasurementMoment = logEntry.Timestamp;
                logEntry.GasMeasurementValue  = Convert.ToDecimal(gasOffset);

                repo.AddEntry(logEntry);

                e1Offset  += rand.NextDouble();
                e2Offset  += rand.NextDouble();
                gasOffset += rand.NextDouble();

                if (i % 600 == 0)
                {
                    Debug.WriteLine(string.Format("{0} %", i / 600));
                }
            }
        }
Exemple #4
0
 public JobStatusUpdaterFunction(
     ILoggingRepository loggingRepository,
     IGraphUpdaterService graphUpdaterService)
 {
     _loggingRepository   = loggingRepository ?? throw new ArgumentNullException(nameof(loggingRepository));
     _graphUpdaterService = graphUpdaterService ?? throw new ArgumentNullException(nameof(graphUpdaterService));
 }
 public CateApiController(ICardRepository cardRepo, ICateRepository cateRepo, ILoggingRepository log)
     : base(log)
 {
     _cateRepo = cateRepo;
     _cardRepo = cardRepo;
     includeProperties = Expressions.LoadCateNavigations();
 }
Exemple #6
0
        public BaseService(CosDbContext dbContext)
        {
            this.DbContext = dbContext;

            this.MailingAddressRepository   = RepositoryFactory.CreateObj <MailingAddressRepository>(dbContext);
            this.ExchangeRepository         = RepositoryFactory.CreateObj <ExchangeRepository>(dbContext);
            this.ExchangeExamineRepository  = RepositoryFactory.CreateObj <ExchangeExamineRepository>(dbContext);
            this.CooperationRepository      = RepositoryFactory.CreateObj <CooperationRepository>(dbContext);
            this.ImgRepository              = RepositoryFactory.CreateObj <ImgRepository>(dbContext);
            this.ExchangeReplyRepository    = RepositoryFactory.CreateObj <ExchangeReplyRepository>(dbContext);
            this.CooperationReplyRepository = RepositoryFactory.CreateObj <CooperationReplyRepository>(dbContext);
            this.ExchangePersonRepository   = RepositoryFactory.CreateObj <ExchangePersonRepository>(dbContext);
            this.MemberRepository           = RepositoryFactory.CreateObj <MemberRepository>(dbContext);
            this.RechargeRecordRepository   = RepositoryFactory.CreateObj <RechargeRecordRepository>(dbContext);
            this.SysParaRepository          = RepositoryFactory.CreateObj <SysParaRepository>(dbContext);
            this.ExchangeEventRepository    = RepositoryFactory.CreateObj <ExchangeEventRepository>(dbContext);
            this.DepositControlRepository   = RepositoryFactory.CreateObj <DepositControlRepository>(dbContext);
            this.LogisticRepository         = RepositoryFactory.CreateObj <LogisticRepository>(dbContext);
            this.LoginCodeRepository        = RepositoryFactory.CreateObj <LoginCodeRepository>(dbContext);
            this.ShipperCompanyRepository   = RepositoryFactory.CreateObj <ShipperCompanyRepository>(dbContext);
            this.AdminMemberRepository      = RepositoryFactory.CreateObj <AdminMemberRepository>(dbContext);
            this.CooperationClassRepository = RepositoryFactory.CreateObj <CooperationClassRepository>(dbContext);
            this.RefundRepository           = RepositoryFactory.CreateObj <RefundRepository>(dbContext);
            this.QuickNavigationRepository  = RepositoryFactory.CreateObj <QuickNavigationRepository>(dbContext);
            this.PostageRepository          = RepositoryFactory.CreateObj <PostageRepository>(dbContext);
            this.CosFileStatRepository      = RepositoryFactory.CreateObj <CosFileStatRepository>(dbContext);
            this.ExchangeClassRepository    = RepositoryFactory.CreateObj <ExchangeClassRepository>(dbContext);
            this.VoucherRepository          = RepositoryFactory.CreateObj <VoucherRepository>(dbContext);
            this.LoginIpRepository          = RepositoryFactory.CreateObj <LoginIPRepository>(dbContext);
            this.IntegralChangeRepository   = RepositoryFactory.CreateObj <IntegralChangeRepository>(dbContext);
            this.LoggingRepository          = RepositoryFactory.CreateObj <LoggingRepository>(dbContext);
            this.MemberRegisterRepository   = RepositoryFactory.CreateObj <MemberRegisterRepository>(dbContext);
            this.VersionNotesRepository     = RepositoryFactory.CreateObj <VersionNotesRepository>(dbContext);
        }
Exemple #7
0
 public LoggingService(ILogger logger, ILoggingRepository loggingRepository,
                       IChapterRepository chapterRepository)
 {
     _chapterRepository = chapterRepository;
     _logger            = logger;
     _loggingRepository = loggingRepository;
 }
        //// POST api/logentries
        public void Post([FromBody] PostEntry value)
        {
            if (ModelState.IsValid)
            {
                try {
                    var user = repo.GetUserByApiKey(value.ApiKey);
                    if (user == null)
                    {
                        throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                        {
                            Content = new StringContent(string.Format("Invalid API Key: {0}", value.ApiKey))
                        });
                    }

                    DateTime gasMeasurementMoment = value.Timestamp;

                    var hubContext = GlobalHost.ConnectionManager.GetHubContext <UsageHub>();
                    hubContext.Clients.Group(value.ApiKey).newCurrentUsage(value.Timestamp, value.CurrentUsage, value.CurrentRetour);

                    if (!DateTime.TryParseExact("20" + value.GasMeasurementMoment, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.None, out gasMeasurementMoment))
                    {
                        gasMeasurementMoment = value.Timestamp;
                    }


                    var logEntry = new LogEntry()
                    {
                        Timestamp            = value.Timestamp,
                        E1                   = value.E1,
                        E2                   = value.E2,
                        E1Retour             = value.E1Retour,
                        E2Retour             = value.E2Retour,
                        CurrentTariff        = value.CurrentTariff,
                        CurrentUsage         = value.CurrentUsage,
                        CurrentRetour        = value.CurrentRetour,
                        GasMeasurementMoment = gasMeasurementMoment,
                        GasMeasurementValue  = value.GasMeasurementValue,
                        PvCounter            = Convert.ToDecimal(value.PvProductionCounter) / 1000,
                        UserId               = user.UserId
                    };

                    repo.AddEntry(logEntry);

                    return;
                } catch (Exception ex) {
                    repo = Core.Factory.ResetILoggingRepository();

                    new LogEvent(ex.Message).Raise();

                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            else
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content = new StringContent("Invalid data")
                });
            }
        }
 public ApplicationRoleController(ILoggingRepository loggingRepository, IApplicationRoleService appRoleService, IBotDomainService botDomainService, RoleManager <IdentityRole> roleManager)
 {
     _appRoleService    = appRoleService;
     _botDomainService  = botDomainService;
     _roleManager       = roleManager;
     _loggingRepository = loggingRepository;
 }
        async Task IAsyncActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            _loggerRepository = context.HttpContext.RequestServices.GetService <ILoggingRepository>();

            switch (_logType)
            {
            case LogEnum.Info:
                _loggerRepository.LogInfo(_text);
                break;

            case LogEnum.Debug:
                _loggerRepository.LogDebug(_text);
                break;

            case LogEnum.Warn:
                _loggerRepository.LogWarn(_text);
                break;

            case LogEnum.Error:
                break;

            case LogEnum.Fatal:
                _loggerRepository.LogFatal(_text);
                break;

            default:
                break;
            }

            await next();
        }
Exemple #11
0
 public Logger(string categoryName, Func <string, LogLevel, bool> filter, ILoggingRepository loggingRepository, IHttpContextAccessor context)
 {
     this.categoryName      = categoryName;
     this.filter            = filter;
     this.loggingRepository = loggingRepository;
     this.context           = context;
 }
 public static ILoggingRepository GetILoggingRepository()
 {
     if (loggingRepo == null) {
         loggingRepo = new LoggingRepository();
     }
     return loggingRepo;
 }
        //todo: should timestampOfBatch and minLogDaysToKeep be params of the repository???
        public LoggingService(ILoggingRepository loggingRepository, DateTime timestampOfBatch, int logDaysToKeep)
        {
            _loggingRepository = loggingRepository;
            _timeStampOfBatch  = timestampOfBatch;
            _logDaysToKeep     = logDaysToKeep;

            _pureService = new LoggingServicePure();
        }
 public VendorAuthenticationManager(IVendorAuthenticationRepository vendorAuthenticationRepository,
                                    IMessageSenderUtility messageSenderUtility,
                                    ILoggingRepository loggingRepository)
 {
     _vendorAuthenticationRepository = vendorAuthenticationRepository;
     _messageSenderUtility           = messageSenderUtility;
     _loggingRepository = loggingRepository;
 }
 public SlidersController(
     GraduationDbContext context, 
     ILoggingRepository logg, 
     IHostingEnvironment env) :base(logg,context,env)
 {
     AllowedExtensions = new string[] { ".jpg", ".png", ".gif", ".PNG" };
     UploadDestination = env.WebRootPath + "/images/cms/slides";
 }
 public MenuRoleController(ILoggingRepository loggingRepository, IApplicationRoleService appRoleService, RoleManager <IdentityRole> roleManager, UserManager <ApplicationUser> userManager, IMenuRoleService menuRoleService)
 {
     _appRoleService    = appRoleService;
     _roleManager       = roleManager;
     _userManager       = userManager;
     _menuRoleService   = menuRoleService;
     _loggingRepository = loggingRepository;
 }
 public AccountController(IMembershipService membershipService,
                          IUserRepository userRepository,
                          ILoggingRepository _errorRepository)
 {
     _membershipService = membershipService;
     _userRepository    = userRepository;
     _loggingRepository = _errorRepository;
 }
 public AlbumsController(IAuthorizationService authorizationService,
                         IAlbumRepository albumRepository,
                         ILoggingRepository loggingRepository)
 {
     this.authorizationService = authorizationService;
     this.albumRepo            = albumRepository;
     this.loggingRepo          = loggingRepository;
 }
 public GameController(IMembershipService membershipService, IGameRepository gameRepository,
                       IRoundRepository roundRepository, ILoggingRepository _errorRepository)
 {
     _membershipService = membershipService;
     _gameRepository    = gameRepository;
     _roundRepository   = roundRepository;
     _loggingRepository = _errorRepository;
 }
 public AlbumsController(IAuthorizationService authorizationService,
                         IAlbumRepository albumRepository,
                         ILoggingRepository loggingRepository)
 {
     _authorizationService = authorizationService;
     _albumRepository = albumRepository;
     _loggingRepository = loggingRepository;
 }
 public AlbumsController(IAuthorizationService authorizationService,
                         IAlbumRepository albumRepository,
                         ILoggingRepository loggingRepository)
 {
     _authorizationService = authorizationService;
     _albumRepository = albumRepository;
     _loggingRepository = loggingRepository;
 }
 public ViewApiController(
     IViewRepository viewRepo,
     ILoggingRepository loggRepo
     )
 {
     _viewRepo = viewRepo;
     _loggRepo = loggRepo;
 }
 public SyncJobRepository(string connectionString, string syncJobTableName, ILoggingRepository loggingRepository)
 {
     _syncJobsTableName   = syncJobTableName;
     _cloudStorageAccount = CreateStorageAccountFromConnectionString(connectionString);
     _tableClient         = _cloudStorageAccount.CreateCloudTableClient(new TableClientConfiguration());
     _tableClient.GetTableReference(syncJobTableName).CreateIfNotExistsAsync();
     _log = loggingRepository;
 }
Exemple #24
0
 public AuthMiddleware(RequestDelegate next,
                       IMembershipService membershipService,
                       ILoggingRepository loggingRepository)
 {
     _next = next;
     _membershipService = membershipService;
     _loggingRepository = loggingRepository;
 }
Exemple #25
0
 public UsersController(IAuthorizationService authorizationService,
                        IUserRepository userRepository,
                        ILoggingRepository loggingRepository)
 {
     _authorizationService = authorizationService;
     _userRepository       = userRepository;
     _loggingRepository    = loggingRepository;
 }
 public AuthMiddleware(RequestDelegate next,
     IMembershipService membershipService,
     ILoggingRepository loggingRepository)
 {
     _next = next;
     _membershipService = membershipService;
     _loggingRepository = loggingRepository;
 }
 public AccountController(IMembershipService membershipService,
     IUserRepository userRepository,
     ILoggingRepository _errorRepository)
 {
     _membershipService = membershipService;
     _userRepository = userRepository;
     _loggingRepository = _errorRepository;
 }
 public static ILoggingRepository GetILoggingRepository()
 {
     if (loggingRepo == null)
     {
         loggingRepo = new LoggingRepository();
     }
     return(loggingRepo);
 }
Exemple #29
0
        public void TestInitialize()
        {
            _loggingRepository = Substitute.For <ILoggingRepository>();

            _timeStampOfBatch = DateTime.Now;
            _logDaysToKeep    = 30;

            _loggingService = ServiceFactory.CreateLoggingService(_loggingRepository, _timeStampOfBatch, _logDaysToKeep);
        }
Exemple #30
0
 public AzureUserReaderService(
     IStorageAccountSecret storageAccountSecret,
     ILoggingRepository loggingRepository,
     IBlobClientFactory blobClientFactory)
 {
     _storageAccountSecret = storageAccountSecret ?? throw new ArgumentNullException(nameof(storageAccountSecret));
     _loggingRepository    = loggingRepository ?? throw new ArgumentNullException(nameof(loggingRepository));
     _blobClientFactory    = blobClientFactory ?? throw new ArgumentNullException(nameof(blobClientFactory));
 }
Exemple #31
0
        public void InitTestFixture()
        {
            var optionsBuilder = new DbContextOptionsBuilder <LoggingDatabaseContext>();

            optionsBuilder.UseNpgsql(TestConnectionString);
            _testDbContext     = new TestDatabaseContext(optionsBuilder.Options);
            _loggingRepository = new LoggingRepository(_testDbContext);
            _npgLogger         = new NpgLogger(_loggingRepository, LogLevel.All);
        }
Exemple #32
0
 public UserController(IUserRepository userRepository, ILoggingRepository loggingRepository,
                       IChatRepository chatRepository, IChatUserRepository chatUserRepository, IFriendsSearcher friendsSearcher)
 {
     _chatUserRepository = chatUserRepository;
     _chatRepository     = chatRepository;
     _userRepository     = userRepository;
     _loggingRepository  = loggingRepository;
     _friendsSearcher    = friendsSearcher;
 }
Exemple #33
0
        public StudentsController()
        {
            var context = new ApplicationDbContext();

            _repository        = new StudentRepository(context);
            _loggingRepository = new LoggingRepository(context);
            _store             = new CustomUserStore(context);
            _roleStore         = new CustomRoleStore(context);
        }
 public FeedsController(
     IConnectionManager signalRConnectionManager, ICustomerService customerService, IWechatService wechatService, ISessionService sessionService, ILoggingRepository loggingRepository)
     : base(signalRConnectionManager)
 {
     this._customerService   = customerService;
     this._wechatService     = wechatService;
     this._sessionService    = sessionService;
     this._loggingRepository = loggingRepository;
 }
Exemple #35
0
 public AccountController(IAuthorizationService authorizationService, IMembershipService membershipService,
                          IUserRepository userRepository,
                          ILoggingRepository _errorRepository)
 {
     _authorizationService = authorizationService;
     _membershipService    = membershipService;
     _userRepository       = userRepository;
     _loggingRepository    = _errorRepository;
 }
Exemple #36
0
 public OfferController(IAuthorizationService authorizationService,
                        IOfferRepository offerRepository,
                        ILoggingRepository loggingRepository,
                        IOfferService offerService)
 {
     _authorizationService = authorizationService;
     _offerRepository      = offerRepository;
     _loggingRepository    = loggingRepository;
     _offerService         = offerService;
 }
Exemple #37
0
 public PhotosController(IPhotoRepository photoRepository, ILoggingRepository loggingRepository, IHostingEnvironment environment,
                         IAlbumRepository albumRepository, IUserRepository userRepository
                         )
 {
     _environment       = environment;
     _photoRepository   = photoRepository;
     _loggingRepository = loggingRepository;
     _albumRepository   = albumRepository;
     _userRepository    = userRepository;
 }
 public CardsController(
     ILoggingRepository logging,
     GraduationDbContext context, 
     IHostingEnvironment env,
     ICateRepository cateRepo)
     :base(logging,context,env)
 {
     _cateRepo = cateRepo;
     AllowedExtensions = new string[] { ".jpg", ".png", ".gif", ".PNG" };
     UploadDestination = env.WebRootPath + "/images/cms/news";
 }
 public BaseController(
     ILoggingRepository logging,
     GraduationDbContext context,
     IHostingEnvironment env
     )
 {
     _logging = logging;
     _context = context;
     this.hostingEnv = env;
      _context = context;
 }
 public HomeController(
     IViewRepository viewRepo,
     ILoggingRepository loggRepo,
     UserManager<ApplicationUser> userManager,
     SignInManager<ApplicationUser> signInManager
     )
     : base(loggRepo)
 {
     _userManager = userManager;
     _signInManager = signInManager;
     _viewRepo = viewRepo;
 }
        //// POST api/logentries
        public void Post([FromBody]PostEntry value)
        {
            if (ModelState.IsValid) {
                try {
                    var user = repo.GetUserByApiKey(value.ApiKey);
                    if (user == null)
                        throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent(string.Format("Invalid API Key: {0}", value.ApiKey)) });

                    DateTime gasMeasurementMoment = value.Timestamp;

                    var hubContext = GlobalHost.ConnectionManager.GetHubContext<UsageHub>();
                    hubContext.Clients.Group(value.ApiKey).newCurrentUsage(value.Timestamp, value.CurrentUsage, value.CurrentRetour);

                    if (!DateTime.TryParseExact("20" + value.GasMeasurementMoment, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.None, out gasMeasurementMoment))
                        gasMeasurementMoment = value.Timestamp;

                    var logEntry = new LogEntry() {
                        Timestamp = value.Timestamp,
                        E1 = value.E1,
                        E2 = value.E2,
                        E1Retour = value.E1Retour,
                        E2Retour = value.E2Retour,
                        CurrentTariff = value.CurrentTariff,
                        CurrentUsage = value.CurrentUsage,
                        CurrentRetour = value.CurrentRetour,
                        GasMeasurementMoment = gasMeasurementMoment,
                        GasMeasurementValue = value.GasMeasurementValue,
                        PvCounter = Convert.ToDecimal(value.PvProductionCounter) / 1000,
                        UserId = user.UserId
                    };

                    repo.AddEntry(logEntry);

                    return;
                } catch (Exception ex) {
                    repo = Core.Factory.ResetILoggingRepository();

                    new LogEvent(ex.Message).Raise();

                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            } else {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("Invalid data") });
            }
        }
        public CardApiController(
            ICateRepository cateRepo,
            ICardRepository cardRepo,
            UserManager<ApplicationUser> userManager,
            ILoggingRepository logRepo,
            GraduationDbContext context,
            SignInManager<ApplicationUser> signInManager) : base(logRepo)
        {
            _userManager = userManager;
            _signInManager = signInManager;
            _context = context;
            includeProperties = Expressions.LoadCardNavigations();
            _cardRepo = cardRepo;
            _cateRepo = cateRepo;

            itemsPerPage = 3;
            pageInit = 6;
        }
 public AccountApiController(
             UserManager<ApplicationUser> userManager,
             SignInManager<ApplicationUser> signInManager,
             IEmailSender emailSender,
             ISmsSender smsSender,
             ILoggerFactory loggerFactory,
             ILoggingRepository _errorRepository,
             GraduationDbContext context,
             ILoggingRepository logging
             ):base(logging)
 {
     _userManager = userManager;
     _signInManager = signInManager;
     _emailSender = emailSender;
     _smsSender = smsSender;
     _logger = loggerFactory.CreateLogger<AccountController>();
     _loggingRepository = _errorRepository;
     _context = context;
 }
 public RequestResponseTraceHandler(HttpMessageHandler innerHandler, ILoggingRepository repository)
     : base(innerHandler)
 {
     _repository = repository;
 }
 public RequestResponseTraceHandler(ILoggingRepository repository)
 {
     _repository = repository;
 }
 public LogEntriesController()
 {
     repo = Core.Factory.GetILoggingRepository();
 }
 public BaseController(ILoggingRepository logRepo)
 {
     _logRepo = logRepo;
 }
 public PhotosController(IPhotoRepository photoRepository, ILoggingRepository loggingRepository)
 {
     _photoRepository = photoRepository;
     _loggingRepository = loggingRepository;
 }
 public LoggingService(ILoggingRepository repository)
 {
 }
 public static ILoggingRepository ResetILoggingRepository()
 {
     loggingRepo = new LoggingRepository();
     return loggingRepo;
 }
 public SlideapiController(ISliderRepository slideRepo,ILoggingRepository logg)
     : base(logg)
 {
     _slideRepo = slideRepo;
 }
Exemple #52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Log" /> class.
 /// </summary>
 /// <param name="repository">The repository.</param>
 /// <param name="settings">The settings.</param>
 public Log(ILoggingRepository repository, ApplicationSettings settings)
 {
     _repository = repository;
     _settings = settings;
 }
		public LoggingHandler(ILoggingRepository repository)
		{
			_repository = repository;
		}
		public LoggingHandler(HttpMessageHandler innerHandler, ILoggingRepository repository)
			: base(innerHandler)
		{
			_repository = repository;
		}