// GET: FinancialAccount
        public ActionResult Index()
        {
            var query    = new GetAllFinancialAccountsQuery();
            var accounts = _queryProcessor.Execute(query);

            return(View(accounts));
        }
Ejemplo n.º 2
0
        public void Initialise()
        {
            DailyOHLCVs = _queryProcessor.Execute(new GetDailyOHLCVsQuery(_baseCurrency, _quoteCurrency));

            var newDailyOHLCVs = _queryProcessor.Execute(new FetchDailyOHLCVFromAPIQuery(_baseCurrency, _quoteCurrency, LastDailyOHLCVTime));

            _commandProcessor.Send(new SaveDailyOHLCVCommand(newDailyOHLCVs));

            // todo account for configuration changing over time and for different currencies
            _configuration = _queryProcessor.Execute(new GetPercentageOfChangeConfigurationQuery(_baseCurrency, _quoteCurrency));
        }
Ejemplo n.º 3
0
        // GET: FinancialTransaction
        public ActionResult Index(Guid?accountId)
        {
            if (accountId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewBag.AccountId = accountId;
            var query        = new GetFinancialTransactionsByAccountIdQuery(accountId.Value);
            var transactions = _queryProcessor.Execute(query);

            return(View(transactions));
        }
Ejemplo n.º 4
0
        public async Task <ContentResult> GetTestQti(String professor_id, String test_id)
        {
            GetTestQtiQuery knowledgeSpaceGetAllQuery = new GetTestQtiQuery();

            knowledgeSpaceGetAllQuery.TestId = int.Parse(test_id);
            GetTestQtiQueryResult response = (GetTestQtiQueryResult)await _queryProcessor.Execute(knowledgeSpaceGetAllQuery, _httpContext);

            return(new ContentResult
            {
                ContentType = "application/xml",
                Content = response.File,
                StatusCode = 200
            });
        }
Ejemplo n.º 5
0
        public string CreateTestAndReturnName(string testName)
        {
            if (AuthCheck.NewCheck().MustBeInRole("Dev").IsNotSatisfiedBy(_currentUserFactory.GetCurrentUser()))
            {
                throw new UserNotAuthorisedException();
            }

            Guid            newTestId = Guid.NewGuid();
            TestSaveCommand cmd       = new TestSaveCommand()
            {
                Id       = newTestId,
                TestName = testName
            };

            _commandProcessor.Execute(cmd);


            TestQuery qry = new TestQuery()
            {
                Id = newTestId
            };

            Test domainEntity = _queryProcessor.Execute(qry);

            if (domainEntity != null)
            {
                return(domainEntity.TestName);
            }
            else
            {
                throw new Exception("Couldn't get test from database.");
            }
        }
Ejemplo n.º 6
0
        public void ExecutesQueries()
        {
            // Arrange
            var id      = Guid.NewGuid();
            var handler = new TestQueryHandler();

            _handlerRegistry.Register <TestQueryA, Guid, TestQueryHandler>();
            _handlerFactory.Setup(x => x.Create(typeof(TestQueryHandler))).Returns(handler);

            // Act
            var result = _queryProcessor.Execute(new TestQueryA(id));

            // Assert
            result.ShouldBe(id);
            handler.Context.ShouldNotBeNull();
            handler.Context.Bag.ShouldContainKeyAndValue("id", id);
            _handlerFactory.Verify(x => x.Release(handler), Times.Once);
        }
        public TResult Execute <TResult>(IQuery <TResult> query)
        {
            if (!(query is QueryBase <TResult> queryBase))
            {
                return(_decoratee.Execute(query));
            }

            if (!(queryBase is ISkipLogging))
            {
                _commandQueryLogger.LogQuery(query);
            }

            if (queryBase.UserId == default)
            {
                queryBase.UserId = _userIdProvider.Get();
            }

            return(_decoratee.Execute(queryBase));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Authenticate(AuthenticateQuery query)
        {
            var response = await _queryProcessor.Execute(query, _httpContext);

            if (response == null)
            {
                return(BadRequest(new { message = "Username or password is incorrect" }));
            }

            return(Ok(response));
        }
Ejemplo n.º 9
0
    public IEnumerable <MyApiModel> Get
        ([FromUri] string queryParam1, int queryParam2)
    {
        var query = new MyQueryObject     // this DTO implements IQuery<TResult>
        {
            QueryParam1 = queryParam1,
            QueryParam2 = queryParam2,
        };
        var results = _queryProcessor.Execute(query);

        return(Mapper.Map <IEnumerable <MyApiModel> >(results));
    }
    public ViewResult Index(string queryParam1, int queryParam2)
    {
        var query = new MyQueryObject     // this DTO implements IQuery<TResult>
        {
            QueryParam1 = queryParam1,
            QueryParam2 = queryParam2,
        };
        var results = _queryProcessor.Execute(query);
        var models  = Mapper.Map <IEnumerable <MyViewModel> >(results);

        return(View(models));
    }
Ejemplo n.º 11
0
        public Device[] GetCoveredItems(int QuoteID)
        {
            QuoteQuery quotequery = new QuoteQuery()
            {
                ID = QuoteID
            };

            EWS.Domain.Data.DataModel.Quote quote = _queryProcessor.Execute(quotequery);

            DeviceQuery devicequery = new DeviceQuery()
            {
                DeviceID = quote.DeviceID
            };

            EWS.Domain.Model.Device device = _queryProcessor.Execute(devicequery);

            return(new Device[1] {
                device
            });                                 //Todo finish this so it returns the individual components
        }
Ejemplo n.º 12
0
 public void BasicSyncQuery()
 {
     _queryProcessor.Execute(new BasicSyncQuery());
 }
Ejemplo n.º 13
0
        private Customer GetCustomer_Model(int CustomerID)
        {
            CustomerQuery query = new CustomerQuery()
            {
                ID = CustomerID
            };

            Domain.Data.DataModel.Customer customer = _queryProcessor.Execute(query);

            if (customer == null)
            {
                return(null);
            }
            else
            {
                return new Customer()
                       {
                           Id             = CustomerID,
                           CustomerName   = customer.CustomerNameFriendly,
                           Locality       = customer.CustomerLocality.CustomerLocalityName,
                           RegistrationNo = customer.RegistrationNo
                       }
            };
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> GetAllTests()
        {
            var result = await _queryProcessor.Execute(new StudentGetAllTestsQuery(), _httpContext);

            return(Ok(result));
        }
Ejemplo n.º 15
0
        public EWS.Domain.Data.DataModel.ContractInclusion[] GetContractInclusionsList()
        {
            ContractInclusionsQuery qry = new ContractInclusionsQuery();

            return(_queryProcessor.Execute(qry).ToArray());
        }
Ejemplo n.º 16
0
 public IActionResult GetOnlineUsersAsync()
 {
     return(Ok(_queryProcessor.Execute(GetOnlineUsersQuery.Default)));
 }