public void initDonne() { loadDGV(); //Remplire Combobox Hotel foreach (Hotel unHotel in DAOHotel.getAllHotels()) { cSHotel.Add(unHotel.IdHotel, unHotel.Name); } cBoxHotel.DataSource = new BindingSource(cSHotel, null); cBoxHotel.DisplayMember = "Value"; cBoxHotel.ValueMember = "Key"; //Remplire Combobox Participant foreach (Participant unParticipant in DAOParticipants.getAllParticipants()) { cSParticipant.Add(unParticipant.IdParticipant, unParticipant.ToStringName()); } cBoxParticipant.DataSource = new BindingSource(cSParticipant, null); cBoxParticipant.DisplayMember = "Value"; cBoxParticipant.ValueMember = "Key"; }
public void initParticipants() { //Participant unPart = new Participant(1, "m2l", "mtrp"); dgvParticipants.DataSource = null; dgvParticipants.DataSource = DAOParticipants.getAllParticipants(); dgvParticipants.Columns["idType"].Visible = false; // on redimensionne automatiquement la largeur des colonnes du datagridview dgvParticipants.AutoResizeColumns(); }
private void BtnEdit_Click(object sender, EventArgs e) { Int32 key = ((KeyValuePair <int, String>)cBoxType.SelectedItem).Key; DAOParticipants.editParticipant(Convert.ToInt32(dgvParticipants.CurrentRow.Cells[0].Value), txtBoxNom.Text, txtBoxPrenom.Text, key); dgvParticipants.DataSource = null; dgvParticipants.DataSource = DAOParticipants.getAllParticipants(); }
public void initTypeParticipant() { foreach (TypeParticipant unType in DAOParticipants.getAllTypePartcipant()) { cSTypeParticipant.Add(unType.IdTypeParticipant, unType.Libelle); } cBoxType.DataSource = new BindingSource(cSTypeParticipant, null); cBoxType.DisplayMember = "Value"; cBoxType.ValueMember = "Key"; }
private void btnAddParticipants_Click_1(object sender, EventArgs e) { if (txtBoxNom.Text == "Nom Participant" || txtBoxPrenom.Text == "Prénom Participant") { MessageBox.Show("Vous devez écrir dans les champs"); } else { Int32 key = ((KeyValuePair <int, String>)cBoxType.SelectedItem).Key; DAOParticipants.addParticipant(txtBoxNom.Text, txtBoxPrenom.Text, key); dgvParticipants.DataSource = null; dgvParticipants.DataSource = DAOParticipants.getAllParticipants(); txtBoxNom.Text = "Nom Participant"; txtBoxPrenom.Text = "Prénom Participant"; } }
private void btnDeleteParticipants_Click(object sender, EventArgs e) { DAOParticipants.delParticipant(Convert.ToInt32(dgvParticipants.CurrentRow.Cells[0].Value)); dgvParticipants.DataSource = null; dgvParticipants.DataSource = DAOParticipants.getAllParticipants(); }