Пример #1
0
        static void Main(string[] args)
        {
            Logger            logger   = new Logger(log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
            TradeSimDbContext database = new TradeSimDbContext();

            //repo
            AccountTableRepository       accountTableRepository       = new AccountTableRepository(database);
            ClientsTableRepository       clientsTableRepository       = new ClientsTableRepository(database);
            StockPriceTableRepository    stockPriceTableRepository    = new StockPriceTableRepository(database);
            HistoryTableRepository       historyTableRepository       = new HistoryTableRepository(database);
            StockOfClientTableRepository stockOfClientTableRepository = new StockOfClientTableRepository(database);

            ClientsService    clientService     = new ClientsService(clientsTableRepository, accountTableRepository, stockPriceTableRepository, stockOfClientTableRepository, logger);
            TradingService    tradingService    = new TradingService(accountTableRepository, stockPriceTableRepository, historyTableRepository, stockOfClientTableRepository, logger);
            ShowDbInfoService showDbInfoService = new ShowDbInfoService(clientsTableRepository, accountTableRepository, stockPriceTableRepository, historyTableRepository, stockOfClientTableRepository);

            IPhraseProvider   phraseProvider    = new JsonPhraseProvider();
            IInputOutput      inputOutputModule = new ConsoleIO();
            ISettingsProvider settingsProvider  = new SettingsProvider();

            App app = new App(phraseProvider, inputOutputModule, settingsProvider, clientService, tradingService, showDbInfoService);

            using (database)
            {
                app.Run();
            };
        }
Пример #2
0
        public App(IPhraseProvider phraseProvider, IInputOutput inputOutputModule, ISettingsProvider settingsProvider,
                   ClientsService clientsService, TradingService tradingService, ShowDbInfoService showDbInfoService)
        {
            this.phraseProvider    = phraseProvider;
            this.inputOutputModule = inputOutputModule;

            this.clientsService    = clientsService;
            this.tradingService    = tradingService;
            this.showDbInfoService = showDbInfoService;

            try
            {
                this.gameSettings = settingsProvider.GetGameSettings();
            }
            catch (ArgumentException ex)
            {
                inputOutputModule.WriteOutput(ex.Message);
                this.gameSettings = null;
                return;
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            Logger            logger   = new Logger(log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
            TradeSimDbContext database = new TradeSimDbContext();

            //repo
            AccountTableRepository       accountTableRepository       = new AccountTableRepository(database);
            ClientsTableRepository       clientsTableRepository       = new ClientsTableRepository(database);
            StockPriceTableRepository    stockPriceTableRepository    = new StockPriceTableRepository(database);
            HistoryTableRepository       historyTableRepository       = new HistoryTableRepository(database);
            StockOfClientTableRepository stockOfClientTableRepository = new StockOfClientTableRepository(database);

            ClientsService    clientService     = new ClientsService(clientsTableRepository, accountTableRepository, stockPriceTableRepository, stockOfClientTableRepository, logger);
            TradingService    tradingService    = new TradingService(accountTableRepository, stockPriceTableRepository, historyTableRepository, stockOfClientTableRepository, logger);
            ShowDbInfoService showDbInfoService = new ShowDbInfoService(clientsTableRepository, accountTableRepository, stockPriceTableRepository, historyTableRepository, stockOfClientTableRepository);

            AutoTrading autoTrading = new AutoTrading(tradingService, showDbInfoService);

            using (database)
            {
                autoTrading.Run();
            };
        }
Пример #4
0
 public TransactionHistoryController(ShowDbInfoService showDbInfoService)
 {
     this.showDbInfoService = showDbInfoService;
 }
Пример #5
0
 public BalanceController(ShowDbInfoService showDbInfoService)
 {
     this.showDbInfoService = showDbInfoService;
 }
Пример #6
0
 public ClientsController(ClientsService clientsService, ShowDbInfoService showDbInfoService)
 {
     this.clientsService    = clientsService;
     this.showDbInfoService = showDbInfoService;
 }
Пример #7
0
 public AutoTrading(TradingService tradingService, ShowDbInfoService showDbInfoService)
 {
     this.tradingService    = tradingService;
     this.showDbInfoService = showDbInfoService;
 }