public AccountController(
     IAccountCommand accountCommand,
     IAccountQuery accountQuery)
 {
     _accountCommand = accountCommand;
     _accountQuery   = accountQuery;
 }
Beispiel #2
0
 public AccountsController(IAccountQuery accountQuery, ICreateAccountAction updateAccountAction, ITransactionsForAccountQuery transactionQuery, IAccountByNameQuery accountByNameQuery)
 {
     _accountQuery        = accountQuery;
     _updateAccountAction = updateAccountAction;
     _transactionQuery    = transactionQuery;
     _accountByNameQuery  = accountByNameQuery;
 }
Beispiel #3
0
 public AccountController(IContextService contextService, IAuthenticationService authenticationService, IQuery query, IAccountFacade accountFacade, IAccountQuery accountQuery)
 {
     this._context = contextService;
     this._authenticationService = authenticationService;
     this._query         = query;
     this._accountFacade = accountFacade;
     this._accountQuery  = accountQuery;
 }
Beispiel #4
0
        public ClaimsTransformer(IAccountQuery query,
                                 ILogger <ClaimsTransformer> logger)
        {
            Ensure.Any.IsNotNull(query, nameof(query));
            Ensure.Any.IsNotNull(logger, nameof(logger));

            _query  = query;
            _logger = logger;
        }
        public void DoAccountQuery()
        {
            bool             sessionBegun   = false;
            bool             connectionOpen = false;
            QBSessionManager sessionManager = null;
            QBSessionMgr     QBMgr          = null;

            try
            {
                //Create the session Manager object
                QBMgr = new QBSessionMgr();
                QBMgr.CreateQBSession(out sessionManager);

                // Get the RequestMsgSet based on the correct QB Version
                IMsgSetRequest requestMsgSet = QBMgr.getLatestMsgSetRequest(sessionManager);

                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

                // BuildAccountQueryRq(requestMsgSet);

                IAccountQuery AccountQueryRq = requestMsgSet.AppendAccountQueryRq();

                // Uncomment the following to view and save the request and response XML
                // string requestXML = requestSet.ToXMLString();
                // MessageBox.Show(requestXML);

                //Send the request and get the response from QuickBooks
                IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

                string responseXML = responseMsgSet.ToXMLString();
                //MessageBox.Show(responseXML);

                WalkAccountQueryRs(responseMsgSet);

                //End the session and close the connection to QuickBooks
                //Close the session and connection with QuickBooks
                QBMgr.CloseQBConnection(sessionManager);
            }
            catch (Exception ex)
            {
                // MessageBox.Show(e.Message, "Error");
                // MessageBox.Show(ex.Message.ToString() + "\nStack Trace: \n" + ex.StackTrace + "\nExiting the application");
                if (sessionBegun)
                {
                    sessionManager.EndSession();
                }
                if (connectionOpen)
                {
                    sessionManager.CloseConnection();
                }
            }
            finally
            {
                QBMgr.CloseQBConnection(sessionManager);
            }
        }
Beispiel #6
0
        public IList <ChartOfAccount> GetAllChartOfAccount()
        {
            requestMsgSet.ClearRequests();
            IAccountQuery AccountQueryRq = requestMsgSet.AppendAccountQueryRq();

            //Set field value for ActiveStatus
            AccountQueryRq.ORAccountListQuery.AccountListFilter.ActiveStatus.SetValue(ENActiveStatus.asActiveOnly);
            AccountQueryRq.ORAccountListQuery.AccountListFilter.AccountTypeList.Add(ENAccountType.atBank);
            responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            return(WalkChartOfAccountQuery(responseMsgSet));
        }
Beispiel #7
0
        public IResponseList GetQBAccountInfo(QBSessionManager sessionManager)
        {
            //bool sessionBegun = false;
            //bool connectionOpen = false;
            QBSession     QBMgr        = null;
            IResponseList responseList = null;

            try
            {
                QBMgr = new QBSession();
                if (sessionManager == null)
                {
                    //Create the session Manager object
                    QBMgr.CreateQBSession(out sessionManager);
                }

                // Get the RequestMsgSet based on the correct QB Version
                IMsgSetRequest requestMsgSet = QBMgr.getLatestMsgSetRequest(sessionManager);

                requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

                // BuildAccountQueryRq(requestMsgSet);

                IAccountQuery AccountQueryRq = requestMsgSet.AppendAccountQueryRq();

                //Send the request and get the response from QuickBooks
                IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

                if (responseMsgSet == null)
                {
                    return(null);
                }
                responseList = responseMsgSet.ResponseList;
                if (responseList == null)
                {
                    return(null);
                }


                //WalkAccountQueryRs(responseMsgSet);

                //End the session and close the connection to QuickBooks
                //Close the session and connection with QuickBooks
                //QBMgr.CloseQBConnection(sessionManager);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return(responseList);
        }
Beispiel #8
0
        ///<summary>Adds an account query to the request message.  A QB connection must be open before calling this method. Requires connection with version 8.0</summary>
        private static void QueryListOfAccounts()
        {
            if (!ConnectionOpen)
            {
                return;
            }
            //Build the account query add append it to the request message.
            IAccountQuery AccountQueryRq = RequestMsgSet.AppendAccountQueryRq();

            //Filters
            AccountQueryRq.ORAccountListQuery.AccountListFilter.ActiveStatus.SetValue(ENActiveStatus.asActiveOnly);
        }
Beispiel #9
0
        public AccountManager(ICredentialAuthentication credentialAuthentication,
                              IBackgroundOperationScheduler backgroundProcessor,
                              IContextVerifier contextVerifier,
                              ISettingsManager settingsManager,
                              IUserAuthorization accessManager,
                              IPersistenceCommands pcommands,
                              IAppUrlProvider apiProvider,
                              IReferralManager refManager,
                              IUserContext userContext,
                              IUserNotifier notifier,
                              //IEmailPush messagePush,
                              IBlobStore blobStore,
                              IAccountQuery query)
        {
            ThrowNullArguments(() => userContext,
                               () => query,
                               () => credentialAuthentication,
                               () => backgroundProcessor,
                               () => contextVerifier,
                               () => accessManager,
                               () => blobStore,
                               //() => messagePush,
                               () => pcommands,
                               () => settingsManager,
                               () => apiProvider,
                               () => refManager,
                               () => notifier);

            UserContext      = userContext;
            _query           = query;
            _credentialAuth  = credentialAuthentication;
            _contextVerifier = contextVerifier;
            _authorizer      = accessManager;
            _blobStore       = blobStore;
            //_messagePush = messagePush;
            _settingsManager     = settingsManager;
            _apiProvider         = apiProvider;
            _refManager          = refManager;
            _pcommand            = pcommands;
            _notifier            = notifier;
            _backgroundProcessor = backgroundProcessor;
        }
Beispiel #10
0
        /// <summary>
        /// Obtain a list of all QuickBooks accounts.
        /// </summary>
        /// <returns>a list of quickbooks accounts</returns>
        private List <QuickbooksAccount> getAccounts(ENAccountType type)
        {
            List <QuickbooksAccount> account    = new List <QuickbooksAccount>();
            IMsgSetRequest           msgRequest = qbMgr.CreateMsgSetRequest("US", 4, 0);

            msgRequest.Attributes.OnError = ENRqOnError.roeStop;
            IAccountQuery query = msgRequest.AppendAccountQueryRq();

            query.ORAccountListQuery.AccountListFilter.AccountTypeList.Add(type);
            IMsgSetResponse response   = qbMgr.DoRequests(msgRequest);
            IAccountRetList qbAccounts = (IAccountRetList)response.ResponseList.GetAt(0).Detail;


            for (int i = 0; qbAccounts != null && i < qbAccounts.Count; i++)
            {
                account.Add(new QuickbooksAccount()
                {
                    Name = qbAccounts.GetAt(i).FullName.GetValue()
                });
            }

            return(account);
        }
Beispiel #11
0
        void BuildAccountQueryRq(IMsgSetRequest requestMsgSet)
        {
            IAccountQuery AccountQueryRq = requestMsgSet.AppendAccountQueryRq();

            //Set attributes
            //Set field value for metaData
            AccountQueryRq.metaData.SetValue(ENmetaData.mdMetaDataAndResponseData); //"IQBENmetaDataType"
            string ORAccountListQueryElementType433 = "ListIDList";

            if (ORAccountListQueryElementType433 == "ListIDList")
            {
                //Set field value for ListIDList
                //May create more than one of these if needed
                // AccountQueryRq.ORAccountListQuery.ListIDList.Add("80000002-1552559344");
            }
            if (ORAccountListQueryElementType433 == "FullNameList")
            {
                //Set field value for FullNameList
                //May create more than one of these if needed
                // AccountQueryRq.ORAccountListQuery.FullNameList.Add("CML01");
            }
            if (ORAccountListQueryElementType433 == "AccountListFilter")
            {
                //Set field value for MaxReturned
                AccountQueryRq.ORAccountListQuery.AccountListFilter.MaxReturned.SetValue(6);
                //Set field value for ActiveStatus
                AccountQueryRq.ORAccountListQuery.AccountListFilter.ActiveStatus.SetValue(ENActiveStatus.asActiveOnly);
                //Set field value for FromModifiedDate
                AccountQueryRq.ORAccountListQuery.AccountListFilter.FromModifiedDate.SetValue(DateTime.Now, false);
                //Set field value for ToModifiedDate
                AccountQueryRq.ORAccountListQuery.AccountListFilter.ToModifiedDate.SetValue(DateTime.Now, false);
                string ORNameFilterElementType434 = "NameFilter";
                if (ORNameFilterElementType434 == "NameFilter")
                {
                    //Set field value for MatchCriterion
                    // AccountQueryRq.ORAccountListQuery.AccountListFilter.ORNameFilter.NameFilter.MatchCriterion.SetValue(ENMatchCriterion.mcStartsWith);
                    //Set field value for Name
                    //AccountQueryRq.ORAccountListQuery.AccountListFilter.ORNameFilter.NameFilter.Name.SetValue("CML01");
                }
                if (ORNameFilterElementType434 == "NameRangeFilter")
                {
                    //Set field value for FromName
                    // AccountQueryRq.ORAccountListQuery.AccountListFilter.ORNameFilter.NameRangeFilter.FromName.SetValue("CML01");
                    //Set field value for ToName
                    //AccountQueryRq.ORAccountListQuery.AccountListFilter.ORNameFilter.NameRangeFilter.ToName.SetValue("CML01");
                }
                //Set field value for AccountTypeList
                //May create more than one of these if needed
                AccountQueryRq.ORAccountListQuery.AccountListFilter.AccountTypeList.Add(ENAccountType.atAccountsReceivable); //ENAccountTypeList.atlAccountsPayable
                string ORCurrencyFilterElementType435 = "ListIDList";
                if (ORCurrencyFilterElementType435 == "ListIDList")
                {
                    //Set field value for ListIDList
                    //May create more than one of these if needed
                    // AccountQueryRq.ORAccountListQuery.AccountListFilter.CurrencyFilter.ORCurrencyFilter.ListIDList.Add("200000-1011023419");
                }
                if (ORCurrencyFilterElementType435 == "FullNameList")
                {
                    //Set field value for FullNameList
                    //May create more than one of these if needed
                    //AccountQueryRq.ORAccountListQuery.AccountListFilter.CurrencyFilter.ORCurrencyFilter.FullNameList.Add("CML01");
                }
            }
            //Set field value for IncludeRetElementList
            //May create more than one of these if needed
            //AccountQueryRq.IncludeRetElementList.Add("CML01");
            //Set field value for OwnerIDList
            //May create more than one of these if needed
            //AccountQueryRq.OwnerIDList.Add(Guid.NewGuid().ToString("B"));
        }
Beispiel #12
0
 public TradeDataQuery(IAccountQuery accountQuery)
 {
     _accountQuery = accountQuery;
 }
Beispiel #13
0
 public SalesController(IAccountQuery accountQuery, ICurrentPriceQuery currentPriceQuery, ICreateTransactionAction storeTransactionAction)
 {
     _accountQuery           = accountQuery;
     _currentPriceQuery      = currentPriceQuery;
     _storeTransactionAction = storeTransactionAction;
 }
 public CreateTransactionCommand(ITransactionRepository transactionRepository, IAccountRepository accountRepository, IAccountQuery accountQuery)
 {
     _transactionRepository = transactionRepository;
     _accountRepository     = accountRepository;
     _accountQuery          = accountQuery;
 }
Beispiel #15
0
 public AccountsController(IAccountCommand repositoryCommand, IAccountQuery repositoryQuery)
 {
     _repositoryCommand = repositoryCommand;
     _repositoryQuery   = repositoryQuery;
 }
Beispiel #16
0
 public TransactionsController(ITransactionRepository transactionRepository, IAccountRepository accountRepository, IAccountQuery accountQuery)
 {
     _transactionRepository = transactionRepository;
     _accountRepository     = accountRepository;
     _accountQuery          = accountQuery;
 }
Beispiel #17
0
        public async Task <IActionResult> GetAccountAsync(int accountId, [FromServices] IAccountQuery query)
        {
            var response = await query.RunAsync(accountId);

            return(response == null ? (IActionResult)NotFound() : Ok(response));
        }