private void button1_Click(object sender, EventArgs e) { try { DateTime datecelebr; datecelebr = Convert.ToDateTime(recptTxt.Text); PrevisionBapteme prev = new PrevisionBapteme(); if (datecelebr < DateTime.Today || membreCombo.Text == "") { MessageBox.Show("Champs vide ou date inférieur", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else if (UserSession.GetInstance().Fonction == "Secrétaire" || UserSession.GetInstance().Fonction == "SA") { prev.Id = idPrev; prev.RefMembre = dn.retourId(membreCombo.Text, "@design", "GET_ID_MEMBRE"); prev.RefBapteme = dn.retourIdWithDate(recptTxt.Text, "@design", "GET_ID_BAPTEME"); prev.SaveDatas(prev); MessageBox.Show(membreCombo.Text + " ajouter à la liste de bapteme du " + recptTxt.Text, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); Initialiser(); ChargementDatas(new PrevisionBapteme()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Research(PrevisionBapteme prev) { try { dgBapt.DataSource = prev.Research(serchTxt.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void ChargementDatas(PrevisionBapteme prev) { dgBapt.DataSource = prev.ListOfPrevisions(); }