private async Task RefreshEntryNames() { if (comboBox1.SelectedIndex > -1) { string table_name = (string)comboBox1.SelectedItem; UseWaitCursor = true; foreach (Control ctl in Controls) { ctl.Enabled = false; } UInt64[] uids = await DatabaseManager.GetUIDs(dbconnprop, table_name); string[] descriptions = await DatabaseManager.GetDescriptions(dbconnprop, table_name); ComboName[] combos = new ComboName[uids.Length]; for (int index_counter = 0; index_counter < uids.Length; index_counter++) { combos[index_counter] = new ComboName(descriptions[index_counter], uids[index_counter]); } listBox1.DataSource = null; listBox1.DataSource = combos; foreach (Control ctl in Controls) { ctl.Enabled = true; } UseWaitCursor = false; } }
public OleDbDataReader GetCombo(ComboName combo, int ordercolumn) { OleDbConnection connCombo = new OleDbConnection(ConfigurationManager.ConnectionStrings["TransManager"].ToString()); connCombo.Open(); _command = "Select * from " + GetTableName(combo); if (ordercolumn > 0) { _command += " order by " + ordercolumn.ToString() + " ASC"; } OleDbCommand cmd = new OleDbCommand(); OleDbDataReader dr; cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = _command; cmd.Connection = connCombo; Log.WriteCommand(cmd); dr = cmd.ExecuteReader(); return(dr); }
private string GetTableName(ComboName comboname) { string str = ""; switch (comboname) { case ComboName.Attributes: str = "Attributes"; break; case ComboName.Title: str = "Title"; break; case ComboName.CarsAll: str = "comboCars"; break; case ComboName.CarMake: str = "CarMake"; break; case ComboName.CarType: str = "CarType"; break; case ComboName.Clients: str = "comboClients"; break; case ComboName.Destination: str = "comboDestination"; break; case ComboName.DestinationCategory: str = "DestinationCategory"; break; case ComboName.DestinationType: str = "DestinationType"; break; case ComboName.Drivers: str = "comboDrivers"; break; case ComboName.Hours: str = "comboHours"; break; case ComboName.InsuranceExpiry: str = "comboInsuranceExpiry"; break; case ComboName.Jobs: str = "comboJobs"; break; case ComboName.JobStatus: str = "JobStatus"; break; case ComboName.LicenceExpiry: str = "comboLicenceExpiry"; break; case ComboName.Minutes: str = "comboMinutes"; break; case ComboName.UserAccess: str = "UserAccessLevel"; break; case ComboName.Users: str = "Users"; break; case ComboName.Venue: str = "Venue"; break; } return(str); }