/// <summary> /// Called to refresh the information displayed on the users tab /// </summary> protected void RefreshTab() { // First clear the existing data held in the DataSource this.suppliersDataSet.Clear(); // ...read the users defined in the database SuppliersDAO lwDataAccess = new SuppliersDAO(); DataTable supplierTable = lwDataAccess.EnumerateSuppliers(); // ...add these to the DataSource for the Users explorer bar foreach (DataRow thisRow in supplierTable.Rows) { // Create the supplier object Supplier thisSupplier = new Supplier(thisRow); // Skip the default supplier if (thisSupplier.SupplierID == 1) { continue; } // otherwise add to our data set UpdateDataSet(thisSupplier); } }
/// <summary> /// Initialize the supplier tab /// </summary> public void LoadSuppliers(int supplierID, string supplierName) { SuppliersDAO lwDataAccess = new SuppliersDAO(); DataTable suppliersTable = lwDataAccess.EnumerateSuppliers(); cbSuppliers.Items.Clear(); // Add these to our combo box foreach (DataRow row in suppliersTable.Rows) { this.cbSuppliers.Items.Add(new Supplier(row)); } // Select the 'current' supplier or the first if none int index = 0; if (supplierID > 1) { index = cbSuppliers.FindStringExact(supplierName); } if (index == -1) { index = 0; } cbSuppliers.SelectedIndex = index; }
/// <summary> /// Initialize the supplier tab /// </summary> private void InitializeSupplierTab() { SuppliersDAO lwDataAccess = new SuppliersDAO(); DataTable suppliersTable = lwDataAccess.EnumerateSuppliers(); // Add these to our combo box foreach (DataRow row in suppliersTable.Rows) { this.cbSuppliers.Items.Add(new Supplier(row)); } // Select the 'current' supplier or the first if none int index = 0; if (_applicationLicense.SupplierID > 1) { index = cbSuppliers.FindStringExact(_applicationLicense.SupplierName); } if (index == -1) { index = 0; } cbSuppliers.SelectedIndex = index; }