private void UpdateData(BusinessClass.For @for) { dataGridView1.DataSource = BusinessClass.DataOutPut(@for); PresentationLayerClass.AddItemsToComboBox(comboBox1, BusinessClass.For.Groupe); PresentationLayerClass.AddItemsToComboBox(comboBox2, BusinessClass.For.Hostel); PresentationLayerClass.AddItemsToComboBox(comboBox3, BusinessClass.For.Room); }
public static void AddItemsToComboBox(ComboBox parent, BusinessClass.For @for) { //List<ComboboxItem> Ilist = new List<ComboboxItem>(); DataTable dataTable; if (@for == BusinessClass.For.Groupe) { dataTable = BusinessClass.DataOutPut(@for); parent.Items.Clear(); for (int i = 0; i < dataTable.Rows.Count; i++) { parent.Items.Add(Convert.ToString(dataTable.Rows[i][1])); } } else if (@for == BusinessClass.For.Hostel) { dataTable = BusinessClass.DataOutPut(@for); parent.Items.Clear(); for (int i = 0; i < dataTable.Rows.Count; i++) { parent.Items.Add(Convert.ToString(dataTable.Rows[i][1])); } } else if (@for == BusinessClass.For.Room) { dataTable = BusinessClass.DataOutPut(@for); parent.Items.Clear(); for (int i = 0; i < dataTable.Rows.Count; i++) { parent.Items.Add(Convert.ToString(dataTable.Rows[i][2])); } } { //ComboboxItem item = new ComboboxItem(); //item.Gnumber = Convert.ToString(dataTable.Rows[i][3]); //Ilist.Add(item); //return Ilist } }
private void UpdateData(BusinessClass.For @for) { dataGridView1.DataSource = BusinessClass.DataOutPut(@for); }