Esempio n. 1
0
        public static ObservableCollection <EmployeeFormation> ListerEmployeeFormationManquante()
        {
            using (var db = new DBAirAtlantiqueContext())
            {
                ObservableCollection <EmployeeFormation> listerEmployeeFormationDB = new ObservableCollection <EmployeeFormation>();
                IQueryable <Poste> requettePoste = from p in db.Postes select p;

                foreach (Poste poste in requettePoste)
                {
                    var requetteFormationPoste = from f in db.Formations join pf in db.PosteFormation on f.FormationID equals pf.FormationConcerne.FormationID where pf.PosteConcerne.PosteID == poste.PosteID select f;

                    var requetteEmployeePoste = from e in db.Employees where e.PosteAttribuer.PosteID == poste.PosteID select e;

                    foreach (Employee employee in requetteEmployeePoste)
                    {
                        var requetteFormationEmployee = from f in db.Formations join ef in db.EmployeeFormation on f.FormationID equals ef.FormationConcerne.FormationID where ef.EmployeeConcerne.Matricule == employee.Matricule select f;

                        IQueryable <Formation> FormationManquante = requetteFormationPoste.Except(requetteFormationEmployee);
                        foreach (Formation formation in FormationManquante)
                        {
                            EmployeeFormation employeeformation = new EmployeeFormation
                            {
                                FormationConcerne = formation,
                                EmployeeConcerne  = employee,
                            };

                            listerEmployeeFormationDB.Add(employeeformation);
                        }
                    }
                }

                return(listerEmployeeFormationDB);
            }
        }
        private void AjouterEmployeeFormation()
        {
            EmployeeFormation ef = new EmployeeFormation
            {
                EmployeeConcerne  = EmployeeConcerne,
                FormationConcerne = AjouterFormationSelectionner
            };

            DAOEmployeeFormation.AjouterEmployeeFormation(ef);
            EmployeeConcerne = DAOEmploye.ConctructeurEmploye(EmployeeConcerne);
        }
Esempio n. 3
0
        public static void AjouterEmployeeFormation(EmployeeFormation employeeFormationNouveau)
        {
            {
                using (var db = new DBAirAtlantiqueContext())
                {
                    var requetteFormation = from f in db.Formations where f.FormationID == employeeFormationNouveau.FormationConcerne.FormationID select f;
                    var requetteEmployee  = from e in db.Employees where e.Matricule == employeeFormationNouveau.EmployeeConcerne.Matricule select e;

                    employeeFormationNouveau.EmployeeConcerne  = requetteEmployee.First();
                    employeeFormationNouveau.FormationConcerne = requetteFormation.First();

                    db.EmployeeFormation.Add(employeeFormationNouveau);

                    db.SaveChanges();
                }
            }
        }
Esempio n. 4
0
        public static void ValiderSession(Session sessionConcernee)
        {
            using (var db = new DBAirAtlantiqueContext())
            {
                foreach (SessionEmployee employee in sessionConcernee.ListeEmployeeConcernees)
                {
                    var requetteE = from e in db.Employees where e.Matricule == employee.EmployeeConcerne.Matricule select e;
                    var requetteF = from f in db.Formations where f.FormationID == sessionConcernee.OrganismeFomationConcerne.FormationConcerne.FormationID select f;
                    EmployeeFormation employeeFormationNew = new EmployeeFormation
                    {
                        EmployeeConcerne  = requetteE.First(),
                        FormationConcerne = requetteF.First()
                    };

                    db.EmployeeFormation.Add(employeeFormationNew);
                }

                var requetteS = from s in db.Sessions where sessionConcernee.SessionID == s.SessionID select s;
                requetteS.First().SessionValider = true;
                db.SaveChanges();
            }
        }