public void selection_arret() { if (dataGridViewnonidentifie.CurrentRow.Index != -1) { model_non_identifie.id = Convert.ToInt32(dataGridViewnonidentifie.CurrentRow.Cells["id_non_identifié"].Value); using (arrets_non_identifiés db = new arrets_non_identifiés()) { model_non_identifie = db.machine_1_arrets.Where(x => x.id == model_non_identifie.id).FirstOrDefault(); selected_arret = model_non_identifie.arret; selected_arret_duree = (int)model_non_identifie.duree; } metroTilepause.Visible = true; metroTilearret.Visible = true; } }
public static void insert_db_arret() // inserer nouvelle ligne dans machine_1_arret where : - date time: currenttime - OF=of - arret= arret non identifié - durée= count_arret; { machine_1_arrets model_machine_arrets = new machine_1_arrets(); model_machine_arrets.of_1 = Calcul_TRS.OF_1; model_machine_arrets.of_2 = Calcul_TRS.OF_2; model_machine_arrets.arret = "arret non identifié"; model_machine_arrets.type_arret = "arret non plannifé"; model_machine_arrets.duree = count_arret; model_machine_arrets.date = (DateTime.Now).ToShortDateString(); model_machine_arrets.debut = t_production; model_machine_arrets.fin = DateTime.Now; using (arrets_non_identifiés db = new arrets_non_identifiés()) { db.machine_1_arrets.Add(model_machine_arrets); db.SaveChanges(); } last_id = model_machine_arrets.id; }