private void com_societe_SelectedIndexChanged(object sender, EventArgs e) { societe = societes[com_societe.SelectedIndex]; if (users.AccesMultiAgence) { agences = AgenceBLL.List("select * from yvs_agences where societe = " + societe.Id); } else { agences.Add(users.Agence); } if (agences.Count > 0) { agence = agences[0]; LoadAgence(agences); } }
private void LoadAgence() { agences = AgenceBLL.List("select * from yvs_agences where societe = " + Constantes.SOCIETE.Id); agences.Insert(0, new Agence(0, "---")); try { cbox_agence.Items.Clear(); for (int i = 0; i < agences.Count; i++) { cbox_agence.Items.Add(agences[i].Name); cbox_agence.AutoCompleteCustomSource.Add(agences[i].Name); } cbox_agence.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cbox_agence.AutoCompleteSource = AutoCompleteSource.CustomSource; } catch (Exception ex) { Messages.Exception("Form_Setting (LoadAgence)", ex); cbox_agence.Items.Clear(); } }