public Form_Modifier_Echantillon(int idMedicament, int idRapport, int qte) { InitializeComponent(); using (DataGSB bdd = new DataGSB()) { // Récupération du medicament var requeteMedicament = from med in bdd.medicaments where (med.id_medicament == idMedicament) select med; foreach (medicament med in requeteMedicament) { _medicament = med; } // Récupération de la famille du medicament var requeteFamille = from fam in bdd.familles where (fam.id_famille == _medicament.id_famille) select fam; foreach (famille fam in requeteFamille) { _famille = fam; } } _idRapport = idRapport; // Remplissage des textBoxes tb_Famille.Text = _famille.lib_famille; tb_Medicament.Text = _medicament.nom_commercial; tb_qte.Text = qte.ToString(); }
private void cb_medicament_SelectedIndexChanged(object sender, EventArgs e) { lb_deja_enregistre.Visible = false; if (cb_medicament.SelectedIndex != 0) { ListBoxMedicamentItem selectedMedicament = (ListBoxMedicamentItem)cb_medicament.SelectedItem; _selectedMedicament = (medicament)selectedMedicament.Value; tb_qte.Clear(); tb_qte.Enabled = true; } else { tb_qte.Clear(); tb_qte.Enabled = false; } }
private bool dejaOffert(medicament ceMedicament) { bool reponse = false; using (DataGSB bdd = new DataGSB()) { var requete = from off in bdd.offrirs where (off.id_rapport == _rapport.id_rapport && off.id_medicament == ceMedicament.id_medicament) select off; foreach (offrir off in requete) { reponse = true; } } return(reponse); }