private void btnLoadCustomers_Click(object sender, EventArgs e) { List <Customer> _customers = new List <Customer>(); CustomersHelper customerHelper = new CustomersHelper(SessionManager.NewQBSession()); _customers = customerHelper.getAllCustomers(); _customers = _customers.OrderBy(c => c.AccountNumber).ToList(); Settings.Default.CachedCustomers = _customers; Settings.Default.Save(); dgCustomers.DataSource = _customers; }
private async void btnHostConnection_Click(object sender, EventArgs e) { if (Settings.Default.CachedItems == null) { InventoryHelper2 inventoryHelper = new InventoryHelper2(SessionManager.NewQBSession()); _items = inventoryHelper.getAllItems(); Settings.Default.CachedItems = _items; Settings.Default.Save(); } if (Settings.Default.CachedCustomers == null) { CustomersHelper customerHelper = new CustomersHelper(SessionManager.NewQBSession()); _customers = customerHelper.getAllCustomers(); Settings.Default.CachedCustomers = _customers; Settings.Default.Save(); } await Task.Run(() => this.StartListening()); }