コード例 #1
0
        public bool InsererSeance(EmploiObj seance)
        {
            using (var dbContext = new emploiEntities())
            {
                emploi emp = new emploi();

                emp.id_enseignant = seance.id_en;
                emp.id_creneau    = seance.id_creaneau;
                emp.id_salle      = seance.salle;
                emp.groupe        = seance.group;
                emp.section       = seance.section;
                emp.id_module     = seance.id_module;
                emp.est_supp      = seance.est_supp;
                dbContext.emplois.Add(emp);


                int changed = dbContext.SaveChanges();



                if (changed == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
コード例 #2
0
        public bool InsererEmploi(List <EmploiObj> emplois)
        {
            using (var dbContext = new emploiEntities())
            {
                dbContext.Database.ExecuteSqlCommand("delete from emploi");
                foreach (var item in emplois)
                {
                    emploi emp = new emploi();

                    emp.id_enseignant = item.id_en;
                    emp.id_creneau    = item.id_creaneau;
                    emp.id_salle      = item.salle;
                    emp.groupe        = item.group;
                    emp.section       = item.section;
                    emp.id_module     = item.id_module;
                    emp.est_supp      = 0;
                    dbContext.emplois.Add(emp);
                }

                int changed = dbContext.SaveChanges();



                if (changed == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
コード例 #3
0
        public bool Maj_Seance(int id_seance, int id_creneau, int id_salle)
        {
            using (var dbContext = new emploiEntities())
            {
                emploi seance = dbContext.emplois.Where(m => m.id_seance == id_seance).FirstOrDefault();

                seance.id_creneau = id_creneau;
                seance.id_salle   = id_salle;

                int changed = dbContext.SaveChanges();



                if (changed == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }