private void okbtn_Click(object sender, EventArgs e) { string vendor = comboBox1.Text; mDatabaseController = new DatabaseController(); List <VendorsTable> vends = mDatabaseController.GetVendors(); for (int i = 0; i < vends.Count; i++) { if (vends[i].vendor.ToLower() == vendor.ToLower()) { MessageBox.Show("The database already contains '" + vendor + "' and blocked the duplicate entry.", "Duplicate Object Blocked"); return; } } bool valid = true; if (null == vendor || "" == vendor) { valid = false; } if (valid) { Submit(vendor); this.Close(); } else { MessageBox.Show("Data Error"); } }
public AddVendorForm() { InitializeComponent(); connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\Receiving and current inventory\Inventory.mdb; Persist Security Info=False;"; mDatabaseController = new DatabaseController(); List <VendorsTable> vends = mDatabaseController.GetVendors(); FillCombo(vends); }
private void fillVendorComboBox() { vendorcmb.Items.Clear(); List <VendorsTable> vendors = mDatabaseController.GetVendors(); for (int i = 0; i < vendors.Count; i++) { if (!vendorcmb.Items.Contains(vendors[i].vendor)) { vendorcmb.Items.Add(vendors[i].vendor); } } }
public AddColorForm() { InitializeComponent(); connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\Receiving and current inventory\Inventory.mdb; Persist Security Info=False;"; // fill vendors List <VendorsTable> vendors = mDatabaseController.GetVendors(); for (int i = 0; i < vendors.Count; i++) { vendorcmb.Items.Add(vendors[i].vendor); } // fill colors List <ColorTable> colors = mDatabaseController.GetColor(); List <string> ColorList = new List <string>(); List <string> TypeList = new List <string>(); for (int i = 0; i < colors.Count; i++) { string color = colors[i].color; string type = colors[i].type; if (!ColorList.Contains(color)) { ColorList.Add(color); colorcmb.Items.Add(colors[i].color); } if (!TypeList.Contains(type)) { TypeList.Add(type); typecmb.Items.Add(colors[i].type); } } vendorcmb.Sorted = true; colorcmb.Sorted = true; typecmb.Sorted = true; }