public static void Ajouter(Absance AB) { using (DbNoteEntitie context = new DbNoteEntitie()) { context.Absance.Add(AB); context.SaveChanges(); } }
public static void Retourner_Abs(string Num, string num_Etud, int NB_ABS) { using (DbNoteEntitie context = new DbNoteEntitie()) { var req1 = from a in context.Absance where a.Num_Abs == Num select a; Absance A = req1.SingleOrDefault(); //A.nb_abs = NB_ABS; var req2 = from e in context.Etudient where e.num_Etud == num_Etud select e; context.SaveChanges(); } }
private void btn_add_Abs_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Id_abs.Text)) { MessageBox.Show("saisir L'Identifient de l'Ensignant !"); } else { Absance E = new Absance { Num_Abs = Id_abs.Text, num_Etud = id_Etudient.Text, dateabs = date_abs.Text, absTP = abs_TP.Text, absCours = abs_Cours.Text, }; // Enseignant E1 = AbsanceADO.Recherche_Code(Id_abs.Text); // if (E1 == null) // { // if (!Directory.Exists("img")) // Directory.CreateDirectory("img"); // img_ens.Image.Save("img/" + Id_Ens.Text + ".jpg"); // EnseignantADO.Ajouter(E); // Affiche_Ens(); // img_ens.Image = new PictureBox().Image; // } // else // MessageBox.Show("Cet enseignant existe dejà"); //} } }