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 AddDataToTextBox(Control parent, BusinessClass.For @for, int RowIndex) { //int i = 0; //MessageBox.Show(RowIndex); DataTable dataTable = BusinessClass.OpenDataForEdit(@for, RowIndex); if (dataTable != null) { foreach (Control c in parent.Controls) { if (c.GetType() == typeof(TextBox)) { TextBox textBox = new TextBox(); textBox = (TextBox)c; textBox.Text = Convert.ToString(dataTable.Rows[0][textBox.TabIndex - 1]); } } } }
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); }