Esempio n. 1
0
        /// <summary>
        /// Récupère une Entretien à partir d'un identifiant de client
        /// </summary>
        /// <param name="Identifiant">Identifant de Entretien</param>
        /// <returns>Un Entretien </returns>
        public static Entretien Get(Int32 identifiant)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"SELECT Identifiant, DateDeb, DateFin, Commentaire, IdentifiantPersonne, Expression, DefinitionFonction, ClareteFonction, ClareteObjectif FROM Entretien
                                WHERE Identifiant = @Identifiant";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Identifiant", identifiant);

            //Execution
            connection.Open();
            SqlDataReader dataReader = commande.ExecuteReader();

            dataReader.Read();

            //1 - Création du Entretien
            Entretien entretien = new Entretien();
            entretien.Identifiant = dataReader.GetInt32(0);
            entretien.DateDeb = dataReader.GetDateTime(1);
            entretien.DateFin = dataReader.GetDateTime(2);
            entretien.Commentaire = dataReader.GetString(3);
            entretien.personne.Identifiant = dataReader.GetInt32(4);
            entretien.Expression = dataReader.GetChar(5);
            entretien.DefinitionFonction = dataReader.GetChar(6);
            entretien.ClareteObjectif = dataReader.GetChar(7);
            entretien.ClareteFonction = dataReader.GetChar(8);
            dataReader.Close();
            connection.Close();
            return entretien;
        }
Esempio n. 2
0
        public void EntretienTestCtorRépétition()
        {
            Entretien entretien = new Entretien("1", "Vidange", "8000", "8000", "", "", "0", "1");

            Assert.AreEqual("1", entretien.IdMaintenance);
            Assert.AreEqual("Vidange", entretien.Description);
            Assert.AreEqual("8000", entretien.FreqKm);
            Assert.AreEqual("", entretien.KmPremiereMaintenance);
            Assert.AreEqual("", entretien.KmDerniereMaintenance);
            Assert.AreEqual(new DateTime(), entretien.DateDerniereMaintenance);
            Assert.AreEqual(false, entretien.Fait);
            Assert.AreEqual("1", entretien.IdVehicule);
        }
Esempio n. 3
0
        public RendezVousDto PlanifierUnEntretien(CreneauDto creneau, CandidatDto candidat)
        {
            var availableConsultantRecruteur = _consultantRecruteurRepository.GetAvailableConsultantRecruteurForDate(creneau.StartDate);
            var salles    = _salleRepository.Get(creneau.StartDate);
            var entretien = new Entretien(creneau, candidat)
                            .Schedule(availableConsultantRecruteur);

            return(new RendezVousDto
            {
                Salle = (SalleDto) new SalleAggregate().Match(salles, creneau).Salle,
                Entretien = (EntretienDto)entretien,
            });
        }
Esempio n. 4
0
        public void createEntretient()
        {
            entretient_control entretient_Control = new entretient_control();
            List <Recruiter>   recruiters         = entretient_Control.GetRecruteurs().ToList();
            Candidate          candidate          = entretient_Control.GetCandidatByName("MEYER", "Alexandre");
            Creneau            creneau            = entretient_Control.getCreneauInAnyRoom(new DateTime(2019, 4, 22, 16, 00, 00), new DateTime(2019, 4, 22, 18, 00, 00));
            Entretien          entretien          = entretient_Control.CreateEntretient(recruiters, candidate, creneau);

            Assert.IsNotNull(entretien);
            Assert.AreEqual(entretien.creneau.heureDebut, new DateTime(2019, 4, 22, 16, 00, 00));
            Assert.AreEqual(entretien.creneau.HeureFin, new DateTime(2019, 4, 22, 18, 00, 00));
            Assert.AreEqual(entretien.recruiter[1].firstname, recruiters[1].firstname);
        }
Esempio n. 5
0
        public void Un_entretien_devrait_etre_annuler()
        {
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            sut.Annuler(new RaisonDto {
                raison = "Une raison d'annullation"
            });
            Assert.That(sut.statut, Is.EqualTo(EntretienStatut.Annuler));
        }
Esempio n. 6
0
        public void Un_entretien_devrait_etre_replanifier()
        {
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            sut.Replanifier(new CreneauDto {
                date = new DateTime(2020, 10, 10, 9, 0, 0), duree = TimeSpan.FromHours(2)
            });
            Assert.That(sut.statut, Is.EqualTo(EntretienStatut.Replanifier));
            Assert.That(sut.creneau, Is.Not.EqualTo(creneau));
        }
Esempio n. 7
0
        public void Un_entretien_devrait_etre_confimer()
        {
            // When
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            sut.Confirmer();

            // Then
            Assert.That(sut.statut, Is.EqualTo(EntretienStatut.Confirmer));
        }
Esempio n. 8
0
        public void Deux_entretiens_du_même_creneau_ne_peuvent_pas_être_passer_dans_la_même_salle()
        {
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);
            Entretien autreEntretien = new Entretien(
                3,
                creneau,
                statut,
                new Candidat("Louis", Specialite.java, TimeSpan.FromDays(500)),
                new Recruteur("Candice", Specialite.java, TimeSpan.FromDays(700)),
                salle1);

            Assert.That(sut.PeutSePlanifierParRapport(autreEntretien), Is.False);
        }
Esempio n. 9
0
        ///////--------------------------------- Validation de l'entretien -----------------------------//////

        private void validation(object sender, RoutedEventArgs e)
        {
            string connectString = $@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename={System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\ProjetBDD.mdf;Integrated Security=True;Connect Timeout=30";
            // initialitation de la preimiere fenetre et tout ce qui doit apparaitre en premier ...

            DataClasses1DataContext db = new DataClasses1DataContext(connectString);


            //-------------------------------  Creation du Profil de l'entretien--------------------------
            if (expe.Text != "" && Q1.Text != "" && evQ1.Text != "" && Q2.Text != "" && evQ2.Text != "" && statu.Text != "" && etape.Text != "" && comnt.Text != "" && Salaire.Text != "" && date_et.SelectedDate != null)
            {
                Entretien personne = new Entretien();
                personne.matricule   = this.identifant;
                personne.exp         = expe.Text;
                personne.Q1          = Q1.Text;
                personne.evaQ1       = Convert.ToInt32(evQ1.Text);
                personne.Q2          = Q2.Text;
                personne.evaQ2       = Convert.ToInt32(evQ2.Text);
                personne.date        = (DateTime)date_et.SelectedDate;
                personne.salaire_des = Convert.ToInt32(Salaire.Text);
                personne.statut      = statu.Text;
                personne.etape_suiv  = etape.Text;
                personne.comment     = comnt.Text;
                db.Entretien.InsertOnSubmit(personne);
                db.SubmitChanges();
                alert_text.Text = "Bien ajouté";
                alert.IsOpen    = true;

                //----- Supprimer la date de l'entretien apres evaluation
                Recrutement rec = (from recup in db.Recrutement
                                   where recup.matricule == identifant
                                   select recup).FirstOrDefault();
                rec.date_ent_ = null;
                db.SubmitChanges();
                this.Close();
            }
            else
            {
                alert_text.Text = "Fiche incomplète";
                alert.IsOpen    = true;
            }
        }
Esempio n. 10
0
        public void Un_Recruteur_ne_peut_pas_passer_deux_entretien_en_même_temps()
        {
            Entretien entretien = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            Entretien sut = new Entretien(
                3,
                creneau,
                statut,
                new Candidat("Leeroy", Specialite.csharp, TimeSpan.FromDays(2)),
                recruteurCsharpExperimenter,
                salle2);

            Assert.That(sut.PeutSePlanifierParRapport(entretien), Is.False);
        }
Esempio n. 11
0
        public void ConsultantNonDisponible()
        {
            Planification  planification = new Planification();
            MockingFactory mockFactory   = new MockingFactory();
            IProspection   prospection   = Mock.Of <IProspection>();

            Mock.Get(prospection).Setup(p => p.GetCandidats()).Returns(mockFactory.Candidats);

            IBaseSalariale baseSalariale = Mock.Of <IBaseSalariale>();

            Mock.Get(baseSalariale).Setup(b => b.GetConsultantRecruteurs()).Returns(mockFactory.ConsultantRecruteurs);


            Candidat candidat = prospection.GetCandidats().FirstOrDefault();

            planification.BaseSalariale = baseSalariale;
            Entretien entretien = planification.PlanifierEntretien(candidat, new DateTime(2019, 02, 22, 13, 30, 00), 60);

            Assert.Null(entretien);
        }
Esempio n. 12
0
        public void NormalProcess()
        {
            Planification  planification = new Planification();
            MockingFactory mockFactory   = new MockingFactory();
            IProspection   prospection   = Mock.Of <IProspection>();

            Mock.Get(prospection).Setup(p => p.GetCandidats()).Returns(mockFactory.Candidats);

            IBaseSalariale baseSalariale = Mock.Of <IBaseSalariale>();

            Mock.Get(baseSalariale).Setup(b => b.GetConsultantRecruteurs()).Returns(mockFactory.ConsultantRecruteurs);


            Candidat candidat = prospection.GetCandidats().FirstOrDefault();

            planification.BaseSalariale = baseSalariale;
            Entretien entretien = planification.PlanifierEntretien(candidat, new DateTime(2019, 02, 24, 08, 00, 00), 60);

            Assert.Equal("Planifié", entretien.Statut);
        }
Esempio n. 13
0
        public void ConsultantNonCompetent()
        {
            Planification  planification = new Planification();
            MockingFactory mockFactory   = new MockingFactory();
            IProspection   prospection   = Mock.Of <IProspection>();

            Mock.Get(prospection).Setup(p => p.GetCandidats()).Returns(mockFactory.Candidats);

            IBaseSalariale baseSalariale = Mock.Of <IBaseSalariale>();

            Mock.Get(baseSalariale).Setup(b => b.GetConsultantRecruteurs()).Returns(mockFactory.ConsultantRecruteurs);


            Candidat candidat = prospection.GetCandidats().First(c => c.Profil.Competences.Where(p => p.Key.Nom == "php").First());

            planification.BaseSalariale = baseSalariale;
            Entretien entretien = planification.PlanifierEntretien(candidat, new DateTime(2019, 02, 24, 08, 00, 00), 60);

            Assert.Null(entretien);
        }
Esempio n. 14
0
        public void Deux_Recruteur_peuvent_faire_passer_deux_entretien_dans_le_même_creneau()
        {
            Entretien entretien = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            Entretien sut = new Entretien(
                3,
                creneau,
                statut,
                new Candidat("Hamza", Specialite.c, TimeSpan.FromDays(200)),
                new Recruteur("Robin", Specialite.c, TimeSpan.FromDays(700)),
                salle2);

            Assert.That(sut.PeutSePlanifierParRapport(entretien), Is.EqualTo(true));
        }
Esempio n. 15
0
        public void Un_entretien_ne_devrait_pas_etre_egale_a_un_autre_entretien()
        {
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            Entretien autreEntretien = new Entretien(
                4,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle2);

            Assert.That(sut, Is.Not.EqualTo(autreEntretien));
        }
Esempio n. 16
0
        private Entretien GetEntretient(int id)

        {
            Entretien retour = null;

            using (SQLiteCommand command = new SQLiteCommand(@"SELECT 
                                                                candidat_id,
                                                                message,
                                                                creneau_id
                                                            FROM entretient
                                                            where id=" + id + "; ", m_dbConnection))
            {
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        reader.Read();
                        try
                        {
                            retour = new Entretien(id,
                                                   null,
                                                   new Candidate(reader.GetInt32(0), null, null, null),
                                                   new Creneau(reader.GetInt32(2), new DateTime(), DateTime.Now, null, 0),
                                                   reader.GetString(1));
                        }
                        catch (InvalidCastException)
                        {
                            retour = new Entretien(id,
                                                   null,
                                                   new Candidate(reader.GetInt32(0), null, null, null),
                                                   new Creneau(int.Parse(reader.GetString(2)), new DateTime(), DateTime.Now, null, 0),
                                                   reader.GetString(1));
                        }
                    }
                }
            }
            retour.recruiter = GetRecruteurForEntretient(id).ToList();
            retour.creneau   = getCreneau(retour.creneau.id);
            retour.candidate = GetCandidat(retour.candidate.id);
            return(retour);
        }
Esempio n. 17
0
        public void Un_entretien_peut_suivre_un_autre_entretien_avec_un_même_candidat()
        {
            Entretien entretien = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            Creneau   justeAprèsLautreCreneau = new Creneau(entretien.creneau.fin, TimeSpan.FromHours(2));
            Entretien sut = new Entretien(
                3,
                justeAprèsLautreCreneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle2);

            Assert.That(entretien.PeutSuivre(sut), Is.EqualTo(true));
        }
Esempio n. 18
0
        public void Un_entretien_peut_precede_un_autre_entretien_avec_un_même_candidat()
        {
            Entretien entretien = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            DateTime  deuxheuresAvantEntretien = entretien.creneau.debut - TimeSpan.FromHours(2);
            Creneau   justeAvantLautreCreneau  = new Creneau(deuxheuresAvantEntretien, TimeSpan.FromHours(2));
            Entretien sut = new Entretien(
                3,
                justeAvantLautreCreneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle2);

            Assert.That(entretien.PeutPreceder(sut), Is.EqualTo(true));
        }
Esempio n. 19
0
        public void Deux_entretien_ne_doivent_pas_se_chevaucher_avec_un_même_candidat()
        {
            Entretien sut = new Entretien(
                2,
                creneau,
                statut,
                candidatCsharp,
                recruteurCsharpExperimenter,
                salle1);

            Entretien autreEntretien = new Entretien(
                3,
                creneau,
                statut,
                candidatCsharp,
                new Recruteur("Felix", Specialite.csharp, TimeSpan.FromDays(1200)),
                salle2);

            Assert.That(sut.PeutSuivre(autreEntretien), Is.EqualTo(false));
            Assert.That(sut.PeutPreceder(autreEntretien), Is.EqualTo(false));
            Assert.That(sut.PeutSePlanifierParRapport(autreEntretien), Is.EqualTo(false));
        }
Esempio n. 20
0
        public static void Insert(Entretien Entretien)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"INSERT INTO Entretien (DateDeb, DateFin, Commentaire, IdentifiantPersonne, Expression, DefinitionFonction, ClareteFonction, ClareteObjectif)
                                VALUES (@DateDeb, @DateFin, @Commentaire, @IdentifiantPersonne, @Expression, @DefinitionFonction, @ClareteFonction, @ClareteObjectif)";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("DateDeb", Entretien.DateDeb);
            commande.Parameters.AddWithValue("DateFin", Entretien.DateFin);
            commande.Parameters.AddWithValue("Commentaire", Entretien.Commentaire);
            commande.Parameters.AddWithValue("IdentifiantPersonne", Entretien.personne.Identifiant);
            commande.Parameters.AddWithValue("Expression", Entretien.Expression);
            commande.Parameters.AddWithValue("DefinitionFonction", Entretien.DefinitionFonction);
            commande.Parameters.AddWithValue("ClareteFonction", Entretien.ClareteFonction);
            commande.Parameters.AddWithValue("ClareteObjectif", Entretien.ClareteObjectif);
            //Execution
            connection.Open();
            commande.ExecuteNonQuery();
            connection.Close();
        }
 public void Executer(Entretien entretien, string raison)
 {
     Planification.AnnulerEntretien(entretien, raison);
 }
Esempio n. 22
0
 public async Task <int> add(Entretien entretien)
 {
     return(await entretienRepository.add(entretien));
 }
Esempio n. 23
0
        public async Task <ActionResult <Entretien> > PostEntretien(Entretien entretien)
        {
            await entretienService.add(entretien);

            return(CreatedAtAction(nameof(GetEntretiens), new { id = entretien.id }, entretien));
        }
Esempio n. 24
0
        public static void Update(Entretien Entretien)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"UPDATE Entretien
                               SET DateDeb = @DateDeb, DateFin = @DateFin, Commentaire = @Commentaire , IdentifiantPersonne = @IdentifiantPersonne , Expression = @Expression, DefinitionFonction = @DefinitionFonction, ClareteFonction = @ClareteFonction, ClareteObjectif = @ClareteObjectif
                               WHERE Identifiant = @Identifiant";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("DateDeb", Entretien.DateDeb);
            commande.Parameters.AddWithValue("DateFin", Entretien.DateFin);
            commande.Parameters.AddWithValue("Commentaire", Entretien.Commentaire);
            commande.Parameters.AddWithValue("IdentifiantPersonne", Entretien.personne.Identifiant);
            commande.Parameters.AddWithValue("Expression", Entretien.Expression);
            commande.Parameters.AddWithValue("DefinitionFonction", Entretien.DefinitionFonction);
            commande.Parameters.AddWithValue("ClareteFonction", Entretien.ClareteFonction);
            commande.Parameters.AddWithValue("ClareteObjectif", Entretien.ClareteObjectif);
            commande.Parameters.AddWithValue("Identifiant", Entretien.Identifiant);
            //Execution
            connection.Open();
            commande.ExecuteNonQuery();
            connection.Close();
        }
Esempio n. 25
0
 public async Task <IActionResult> PutEntretien(int id, Entretien entretien)
 {
     return(await entretienService.update(id, entretien));
 }
Esempio n. 26
0
        public Entretien CreateEntretient(List <Recruiter> recruiters, Candidate candidate, Creneau creneau, string message = null)
        {
            using (SQLiteCommand command = new SQLiteCommand(@"INSERT INTO Entretient (
                                                                    candidat_id,
                                                                    message,
                                                                    creneau_id                                                                )
                                                                VALUES(
                                                                    '" + candidate.id + @"',
                                                                    '" + message + @"',
                                                                    '" + creneau.id + @"');", m_dbConnection))
            {
                command.ExecuteNonQuery();
            }
            Entretien newEntretien = null;

            using (SQLiteCommand command = new SQLiteCommand("select id,message,candidat_id,creneau_id from entretient order by id desc", m_dbConnection))
            {
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        reader.Read();

                        newEntretien = new Entretien(reader.GetInt32(0),
                                                     new List <Recruiter>(),
                                                     new Candidate(reader.GetInt32(2), null, null, null),
                                                     new Creneau(int.Parse(reader.GetString(3)), new DateTime(), DateTime.Now, null,
                                                                 0),
                                                     reader.GetString(1));
                    }
                }
            }
            newEntretien.candidate = GetCandidat(newEntretien.candidate.id);
            newEntretien.creneau   = getCreneau(newEntretien.creneau.id);
            foreach (var item in recruiters)
            {
                using (SQLiteCommand command = new SQLiteCommand(@"INSERT INTO entretient_recruteur (
                                                                    entretient_id,
                                                                    recruteur_id)
                                                                VALUES(
                                                                    " + newEntretien.id + @",
                                                                    " + item.id + @");", m_dbConnection))
                {
                    command.ExecuteNonQuery();
                }
            }
            using (SQLiteCommand command = new SQLiteCommand("select * from entretient_recruteur where entretient_id=" + newEntretien.id, m_dbConnection))
            {
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            newEntretien.recruiter.Add(new Recruiter(reader.GetInt32(1), null, null, null, null));
                        }
                    }
                }
            }
            for (int i = 0; i < newEntretien.recruiter.Count; i++)
            {
                newEntretien.recruiter[i] = GetRecruteur(newEntretien.recruiter[i].id);
            }
            return(newEntretien);
        }
 public void Executer(Entretien entretien, DateTime date, int duree)
 {
     Planification.ReplanifierEntretien(entretien, date, duree);
 }
Esempio n. 28
0
 public async Task <IActionResult> update(int id, Entretien entretien)
 {
     return(await entretienRepository.update(id, entretien));
 }
Esempio n. 29
0
        /// <summary>
        /// Récupère une liste de Entretien à partir de la base de données
        /// </summary>
        /// <returns>Une liste de client</returns>
        public static List<Entretien> List()
        {
            //Récupération de la chaine de connexion
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = "SELECT Identifiant, DateDeb, DateFin, Commentaire, IdentifiantPersonne, Expression, DefinitionFonction, ClareteFonction,ClareteObjectif FROM Entretien";
            connection.Open();
            SqlCommand commande = new SqlCommand(requete, connection);
            //execution

            SqlDataReader dataReader = commande.ExecuteReader();

            List<Entretien> list = new List<Entretien>();
            while (dataReader.Read())
            {

                //1 - Créer un Entretien à partir des donner de la ligne du dataReader
                Entretien entretien = new Entretien();
                entretien.Identifiant = dataReader.GetInt32(0);
                entretien.DateDeb = dataReader.GetDateTime(1);
                entretien.DateFin = dataReader.GetDateTime(2);
                entretien.Commentaire = dataReader.GetString(3);
                entretien.personne.Identifiant = dataReader.GetInt32(4);
                entretien.Expression = dataReader.GetChar(5);
                entretien.DefinitionFonction = dataReader.GetChar(6);
                entretien.ClareteObjectif = dataReader.GetChar(7);
                entretien.ClareteFonction = dataReader.GetChar(8);

                //2 - Ajouter ce Entretien à la list de client
                list.Add(entretien);
            }
            dataReader.Close();
            connection.Close();
            return list;
        }