public async Task <IHttpActionResult> PostEvent([FromBody] TicketEvent tEvent)
        {
            var error   = "";
            var handler = HandlersFactory.GetProfilerHandler(TheSettingService, TheLoggerService);

            handler.Start(LOG_TAG, "PostEvent", GetServiceProperties());

            try
            {
                TicketEvent.Validate(tEvent);

                IDataStoreService dataService = ServiceFactory.GetInstance().GetDataStoreService(TheSettingService, TheLoggerService);
                var id = await dataService.CreateEvent(tEvent);

                return(Ok(await dataService.GetEventById(id)));
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(BadRequest(ex.Message));
            }
            finally
            {
                handler.Stop(error);
            }
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            _datageneratorservice = new DataGeneratorService();
            _datastoreservice     = new DataStoreService();

            await Init();

            try
            {
                Console.WriteLine("Truncating sensors table before start pushing data");
                _datastoreservice.TruncateRealtimeSensorRecordTable();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error truncating table: " + e.Message);
            }

            Console.WriteLine($"Starting writing realtime records with {PushTimeInterval} millisecond interval to database...");

            while (true)
            {
                if (!BlockedDataGeneration)
                {
                    var records = _datageneratorservice.GenerateRealTimeSensorRecords(StopWake);
                    Console.WriteLine($"[{DateTime.Now}] Writing records to db.");
                    _datastoreservice.WriteSensorRecordsToDB(records);
                }
                await Task.Delay(PushTimeInterval);
            }
        }
Ejemplo n.º 3
0
 public ExchangeDataController(IConfiguration configuration, IDataGovRuService dataGovRuService,
                               IFileService fileService, ITextFileParser parser, IDataStoreService dataService)
 {
     _configuration    = configuration;
     _dataGovRuService = dataGovRuService;
     _fileService      = fileService;
     _dataService      = dataService;
     _parser           = parser;
 }
Ejemplo n.º 4
0
        public LookupPickerPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService, IDataStoreService dataStoreService)
            : base(navigationService, pageDialogService)
        {
            _dataStoreService = dataStoreService;
            //_dataStoreService.SyncCodeValueLookup();
            //_dataStoreService.SyncAccessionLookup();
            _restClient = new RestClient();

            SearchTextCommand = new DelegateCommand(OnSearchTextCommandExecuted);
            ItemTappedCommand = new DelegateCommand <object>(OnItemTappedCommandExecuted);
        }
Ejemplo n.º 5
0
        public FilePayloadUploadProvider(IFileDownloadDatabaseService fileDownloadDatabaseService,
                                         IDataStoreServiceFactory dataStoreServiceFactory,
                                         IFileValidationService fileValidationService)
        {
            this.fileDownloadDatabaseService = fileDownloadDatabaseService
                                               ?? throw new ArgumentNullException(nameof(fileDownloadDatabaseService));
            this.fileValidationService =
                fileValidationService ?? throw new ArgumentNullException(nameof(fileValidationService));

            dataStoreService = dataStoreServiceFactory?.Create()
                               ?? throw new ArgumentNullException(nameof(dataStoreService));
        }
        public StatsDownloadApiDataStoreProvider(IDataStoreServiceFactory dataStoreServiceFactory,
                                                 IStatsDownloadApiDatabaseService databaseService,
                                                 IFileValidationService fileValidationService,
                                                 IFilePayloadApiSettingsService filePayloadApiSettingsService,
                                                 ILoggingService loggingService)
        {
            dataStoreService = dataStoreServiceFactory.Create();

            this.databaseService               = databaseService;
            this.fileValidationService         = fileValidationService;
            this.filePayloadApiSettingsService = filePayloadApiSettingsService;
            this.loggingService = loggingService;
        }
Ejemplo n.º 7
0
        public async Task <IHttpActionResult> GetOrdersByUserName(string username)
        {
            var error   = "";
            var handler = HandlersFactory.GetProfilerHandler(TheSettingService, TheLoggerService);

            handler.Start(LOG_TAG, "GetOrdersByUserName", GetServiceProperties());

            try
            {
                IDataStoreService dataService = ServiceFactory.GetInstance().GetDataStoreService(TheSettingService, TheLoggerService);
                return(Ok(await dataService.GetOrdersByUserName(username)));
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(BadRequest(ex.Message));
            }
            finally
            {
                handler.Stop(error);
            }
        }
        public async Task <IHttpActionResult> GetEvents()
        {
            var error   = "";
            var handler = HandlersFactory.GetProfilerHandler(TheSettingService, TheLoggerService);

            handler.Start(LOG_TAG, "GetEvents", GetServiceProperties());

            try
            {
                IDataStoreService dataService = ServiceFactory.GetInstance().GetDataStoreService(TheSettingService, TheLoggerService);
                var itemsList = await dataService.GetEvents();

                return(Ok(itemsList.OrderBy(p => p.EndDate).ToList()));
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(BadRequest(ex.Message));
            }
            finally
            {
                handler.Stop(error);
            }
        }
Ejemplo n.º 9
0
        public FileDownloadProvider(IFileDownloadDatabaseService fileDownloadDatabaseService,
                                    IFileDownloadLoggingService loggingService, IDownloadService downloadService,
                                    IFilePayloadSettingsService filePayloadSettingsService,
                                    IResourceCleanupService resourceCleanupService,
                                    IFileDownloadMinimumWaitTimeService fileDownloadMinimumWaitTimeService,
                                    IDateTimeService dateTimeService,
                                    IFilePayloadUploadService filePayloadUploadService,
                                    IFileDownloadEmailService fileDownloadEmailService,
                                    IDataStoreServiceFactory dataStoreServiceFactory)
        {
            this.fileDownloadDatabaseService = fileDownloadDatabaseService;
            this.loggingService                     = loggingService;
            this.downloadService                    = downloadService;
            this.filePayloadSettingsService         = filePayloadSettingsService;
            this.resourceCleanupService             = resourceCleanupService;
            this.fileDownloadMinimumWaitTimeService = fileDownloadMinimumWaitTimeService;
            this.dateTimeService                    = dateTimeService;
            this.filePayloadUploadService           = filePayloadUploadService;
            this.fileDownloadEmailService           = fileDownloadEmailService;

            dataStoreService = dataStoreServiceFactory?.Create();

            ValidateCtorArgs();
        }
Ejemplo n.º 10
0
        public async Task <IHttpActionResult> DeleteAllLogMessges()
        {
            var error   = "";
            var handler = HandlersFactory.GetProfilerHandler(TheSettingService, TheLoggerService);

            handler.Start(LOG_TAG, "DeleteAllLogMessges", GetServiceProperties());

            try
            {
                IDataStoreService dataService = ServiceFactory.GetInstance().GetDataStoreService(TheSettingService, TheLoggerService);
                await dataService.DeleteAllLogMessages();

                return(Ok("Done"));
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(BadRequest(ex.Message));
            }
            finally
            {
                handler.Stop(error);
            }
        }
Ejemplo n.º 11
0
 public OtherViewModel(IDataStoreService <Item> dataStoreService)
 {
     dataStoreService = _dataStoreService;
     GetData();
 }
Ejemplo n.º 12
0
 public AuthController(IDataStoreService dataStore)
 {
     _dataStore = dataStore;
 }
Ejemplo n.º 13
0
 public List<Authorization> Test_GetUsersAuthentications(IDataStoreService store, string username, List<Role> usersRoles)
 {
     return this.GetUsersAuthentications(store, username, usersRoles);
 }
Ejemplo n.º 14
0
 public PropertiesController(IDataRetrieveService dataRetrieveService, IDataStoreService dataStoreService)
 {
     this.dataRetrieveService = dataRetrieveService;
     this.dataStoreService    = dataStoreService;
 }
Ejemplo n.º 15
0
 public ContactsController(IDataStoreService dataStoreService)
 {
     _DataStoreService = dataStoreService;
 }
Ejemplo n.º 16
0
 public AuthIdentityTestService(string username, IDataStoreService store)
     : base(username, new DataStoreFactory(store))
 {
 }
Ejemplo n.º 17
0
 public DataStore()
 {
     _service = LemonTransform.Container.Resolve <IDataStoreService>();
 }
Ejemplo n.º 18
0
        protected List<Role> GetUsersRolesRecursive(IDataStoreService ctx, string username, Dictionary<RoleKey, List<Role>> roleMemberLookup)
        {
            // get a list of roles the member is directly a member of
            var directRoles = ctx.Roles.Where(f => f.Users.Any(g => g.User.Username == username)).AsEnumerable().Select(f => new RoleKey(f.Name, f.OrganizationId));

            return roleMemberLookup.Where(f => directRoles.Any(g => g.Name == f.Key.Name && g.OrgId == f.Key.OrgId)).SelectMany(f => f.Value).Distinct().ToList();
        }
Ejemplo n.º 19
0
 public AccountService(IDataStoreService dataStoreService, IConfigurationService configurationService, ICalculationService calculationService)
 {
     _dataStoreService   = dataStoreService;
     _calculationService = calculationService;
     _dataStoreType      = configurationService.GetAppSettingForKey(Constants.DataStoreTypeKey);
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     By applying dependency injection we make the purpose of the service more clear and segment the additional
 ///     responsitibilities
 ///     into injectable components
 /// </summary>
 public PaymentService(IDataStoreService dataStoreService, ILogService logService, IRulesService rulesService)
 {
     DataStoreService = dataStoreService;
     LogService       = logService;
     RulesService     = rulesService;
 }
Ejemplo n.º 21
0
 public DialUpController(IDataStoreService dataStoreService)
 {
     _DataStoreService = dataStoreService;
 }
Ejemplo n.º 22
0
 public DataStoreFactory(IDataStoreService service)
 {
     this.sharedInstance = service;
 }
Ejemplo n.º 23
0
 public ViewModelBase()
 {
     NavigationService = ViewModelLocator.Instance.Resolve <INavigationService>();
     DataStoreService  = ViewModelLocator.Instance.Resolve <IDataStoreService>();
 }
Ejemplo n.º 24
0
 protected Dictionary<RoleKey, List<Role>> GetRoleMemberLookup(IDataStoreService store)
 {
     var roleMap = store.Roles.IncludePaths("MemberOfRoles", "Organization").ToList();
     return roleMap.ToDictionary(f => new RoleKey(f.Name, f.OrganizationId), f => f.Flatten().Distinct().ToList());
 }
Ejemplo n.º 25
0
        public async Task <IHttpActionResult> UpdateServiceHealthState(UpdateHealthRequest request)
        {
            var error   = "";
            var handler = HandlersFactory.GetProfilerHandler(TheSettingService, TheLoggerService);

            handler.Start(LOG_TAG, "UpdateServiceHealthState", GetServiceProperties());

            try
            {
                UpdateHealthRequest.Validate(request);

                int ticketOrderServices           = 0;
                int ticketOrderActors             = 0;
                int eventActors                   = 0;
                ServiceLocationService locator    = new ServiceLocationService();
                UriBuilderService      builder    = new UriBuilderService(Constants.ContosoEventsApplicationInstance, Constants.ContosoEventsTicketOrderServiceName);
                ServicePartitionList   partitions = await _fabricClient.QueryManager.GetPartitionListAsync(builder.ToUri());

                foreach (Partition p in partitions)
                {
                    long minKey = (p.PartitionInformation as Int64RangePartitionInformation).LowKey;
                    ITicketOrderService dispenderService = locator.Create <ITicketOrderService>(builder.ToUri());
                    await dispenderService.UpdateHealthState(GetHealthStateFromString(request.State), request.Message);

                    ticketOrderServices++;
                }

                ActorLocationService actorLocator         = new ActorLocationService();
                UriBuilderService    orderActorBuilder    = new UriBuilderService(Constants.ContosoEventsApplicationInstance, Constants.ContosoEventsTicketOrderActorName);
                ServicePartitionList orderActorPartitions = await _fabricClient.QueryManager.GetPartitionListAsync(orderActorBuilder.ToUri());

                foreach (Partition p in orderActorPartitions)
                {
                    string            minKey = (p.PartitionInformation as Int64RangePartitionInformation).Id.ToString();
                    ITicketOrderActor actor  = actorLocator.Create <ITicketOrderActor>(new ActorId(minKey), Constants.ContosoEventsApplicationName);
                    await actor.UpdateHealthState(GetHealthStateFromString(request.State), request.Message);

                    ticketOrderActors++;
                    // May require contiunuation
                }

                IDataStoreService  dataService = ServiceFactory.GetInstance().GetDataStoreService(TheSettingService, TheLoggerService);
                List <TicketEvent> events      = await dataService.GetEvents();

                UriBuilderService eventActorBuilder = new UriBuilderService(Constants.ContosoEventsApplicationInstance, Constants.ContosoEventsEventActorName);
                foreach (var tEvent in events)
                {
                    IEventActor actor = actorLocator.Create <IEventActor>(new ActorId(tEvent.Id), Constants.ContosoEventsApplicationName);
                    await actor.UpdateHealthState(GetHealthStateFromString(request.State), request.Message);

                    eventActors++;
                    // May require contiunuation
                }

                return(Ok("Done: " + ticketOrderServices + "|" + ticketOrderActors + "|" + eventActors));
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(BadRequest(ex.Message));
            }
            finally
            {
                handler.Stop(error);
            }
        }
Ejemplo n.º 26
0
        protected List<Authorization> GetUsersAuthentications(IDataStoreService store, string username, List<Role> usersRoles)
        {
            var roleAuths = store.Authorization.Where(f => f.RoleId != null);

            var authList = (from have in usersRoles join granted in roleAuths on have.Id equals granted.RoleId select granted).ToList();

            authList.AddRange(store.Authorization.Where(f => f.UserName == username));

            return authList;
        }
Ejemplo n.º 27
0
 public DefaultKuKey(IDataStoreService dataSrv, IEncryptService encryptSrv)
 {
     DataStoreService = dataSrv;
     EncryptService   = encryptSrv;
 }
 /// <summary>
 /// constructor injection of the date store service was used here,
 /// to make the service available to all controller requests
 /// </summary>
 /// <param name="dataSvc">data store service instance</param>
 public VendingMachineService(IDataStoreService <CoffeeModel> dataSvc)
 {
     _dataSvc = dataSvc;
 }
Ejemplo n.º 29
0
 public AccountService(IDataStoreService dataStoreService)
 {
     // See constructor test case GetAccountEmpty()
     _dataStoreService   = dataStoreService;
     _dataStoreConfigKey = GetAppSettingForKey("DataStoreType");
 }
 public NotificationService(ISettingService setting, ILoggerService logger, IDataStoreService dataStore)
 {
     _settingService   = setting;
     _loggerService    = logger;
     _dataStoreService = dataStore;
 }
Ejemplo n.º 31
0
 public TestsController(IDataStoreService <Test> testDataStoreService)
 {
     _testDataStoreService = testDataStoreService;
 }
Ejemplo n.º 32
0
 public Dictionary<RoleKey, List<Role>> Test_GetRoleMemberLookup(IDataStoreService store)
 {
     return this.GetRoleMemberLookup(store);
 }
Ejemplo n.º 33
0
 public PaymentService(IDataStoreService IDataStoreService, INotificationService INotificationService)
 {
     _IDataStoreService    = IDataStoreService;
     _INotificationService = INotificationService;
 }
Ejemplo n.º 34
0
 public List<Role> Test_GetUsersRolesRecursive(IDataStoreService ctx, string username, Dictionary<RoleKey, List<Role>> roleMemberLookup)
 {
     return this.GetUsersRolesRecursive(ctx, username, roleMemberLookup);
 }
Ejemplo n.º 35
0
 public ProductService(IDataStoreService dataStoreService)
 {
     _dataStoreService = dataStoreService;
 }
Ejemplo n.º 36
0
 public DataStore()
 {
     _service = LemonTransform.Container.Resolve<IDataStoreService>();
 }
Ejemplo n.º 37
0
 public TestChildrenController(ITestChildrenDataStoreService testChildrenDataStoreService, IDataStoreService <Test> testDataStoreService)
 {
     _testChildrenDataStoreService = testChildrenDataStoreService;
     _testDataStoreService         = testDataStoreService;
 }
 public INotificationService GetNotificationService(ISettingService setting, ILoggerService logger, IDataStoreService dataStore)
 {
     return(new NotificationService(setting, logger, dataStore));
 }
Ejemplo n.º 39
0
 public DefaultKuKey(string databasePath, string masterPassword)
 {
     DataStoreService = new SQLiteDataStoreService(databasePath);
     EncryptService   = new AESEncryptService(masterPassword);
 }