public TrackerMain() { InitializeComponent(); if (Process.GetProcessesByName("ozbargaintracker").Length > 1) { Environment.Exit(-1); } _logWriter = new Logger(Log_box, Dispatcher, logFileName: "debug.log", prependLogType: true); _logWriter.Log("Booting up...", LogType.DebugLog); _trayIcon.Text = @"OzBargainTracker"; _trayIcon.Icon = Properties.Resources.Icon; _trayIcon.Click += _trayIcon_Click; _logWriter.Log("GUI Set up Done", LogType.DebugLog); Icon = Properties.Resources.IconPng.ToBitmapImage(); Settings = new AppSettings(this); if (Settings.Debug) { _logWriter.WriteDebugToLog = true; } AccountsWindow = new AccountsSetup(this); SettingsWindow = new MoreWindow(this); new Task(() => { MailManager = new EmailManager(this); }).Start(); _logWriter.Log("Initializing...", LogType.DebugLog); Init(); _logWriter.Log("Finished Setup.", LogType.DebugLog); }
public async Task Setup(AccountsSetup setup) { for (int i = 0; i < setup.Accounts.Length; i += 10000) { var portion = setup.Accounts.Skip(i).Take(10000).ToArray(); var request = mapper.Map<SetupRequest>(new AccountsSetup { Accounts = portion }); await accountsWriteClient.SetupAppendAsync(request, HttpContext.CreateHeadersWithFlowId()); } }
public async Task Setup(AccountsSetup setup) { for (int i = 0; i < setup.Accounts.Length; i += 10000) { var portion = setup.Accounts.Skip(i).Take(10000).ToArray(); var request = mapper.Map <SetupRequest>(new AccountsSetup { Accounts = portion }); await accountClient.SetupAppendAsync(request); } }
public Task Setup(AccountsSetup setup) { for (int i = 0; i < setup.Accounts.Length; i += 10000) { var portion = setup.Accounts.Skip(i).Take(10000).ToArray(); var accountsEvent = new SetupAppendAccountsEvent { Accounts = portion.Select(a => mapper.Map <Account>(a)).ToArray() }; this.publishingRouter.Publish(Queues.Accounts, accountsEvent, null); } return(Task.CompletedTask); }
public void Perform() { var setup = File.ReadAllText("setup.json"); var response = httpClient.PostAsync($"setup/setup", new StringContent(setup, Encoding.UTF8, "application/json")).Result; if (!response.IsSuccessStatusCode) { logger.Information("Cannot setup system."); return; } logger.Information("General setup done."); if (File.Exists("accounts.json")) { var accounts = JsonConvert.DeserializeObject <AccountsSetup>(File.ReadAllText("accounts.json")).Accounts; for (int i = 0; i < accounts.Length; i += 10000) { var portion = accounts.Skip(i).Take(10000); var accountsSetup = new AccountsSetup { Accounts = portion.ToArray() }; try { var result = httpClient.PostAsync("http://localhost:5000/account/setup", new StringContent(JsonConvert.SerializeObject(accountsSetup), Encoding.UTF8, "application/json")).Result; } catch (Exception e) { int asd = 5; } logger.Information("Accounts portion setup done."); } } if (File.Exists("transactions.json")) { var transactions = JsonConvert.DeserializeObject <TransactionsSetup>(File.ReadAllText("transactions.json")).Transactions; for (int i = 0; i < transactions.Length; i += 10000) { var portion = transactions.Skip(i).Take(10000); var transactionsSetp = new TransactionsSetup { Transactions = portion.ToArray() }; var result = httpClient.PostAsync("transaction/setup", new StringContent(JsonConvert.SerializeObject(transactionsSetp), Encoding.UTF8, "application/json")).Result; logger.Information("Transactions portion setup done."); } } if (File.Exists("payments.json")) { var payments = JsonConvert.DeserializeObject <PaymentsSetup>(File.ReadAllText("payments.json")).Payments; for (int i = 0; i < payments.Length; i += 10000) { var portion = payments.Skip(i).Take(10000); var paymentsSetup = new PaymentsSetup { Payments = portion.ToArray() }; var result = httpClient.PostAsync("payment/setup", new StringContent(JsonConvert.SerializeObject(paymentsSetup), Encoding.UTF8, "application/json")).Result; logger.Information("Payments portion setup done."); } } if (File.Exists("loans.json")) { var loans = JsonConvert.DeserializeObject <LoansSetup>(File.ReadAllText("loans.json")).Loans; for (int i = 0; i < loans.Length; i += 10000) { var portion = loans.Skip(i).Take(10000); var loansSetup = new LoansSetup { Loans = portion.ToArray() }; var result = httpClient.PostAsync("loan/setup", new StringContent(JsonConvert.SerializeObject(loansSetup), Encoding.UTF8, "application/json")).Result; logger.Information("Loans portion setup done."); } } logger.Information("Setup all done."); }
private void accountsMenuBtn_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AccountsSetup fm = new AccountsSetup(); fm.Show(); }