예제 #1
0
        /// <summary>
        /// Méthode de récupération des candidats d'un candidat.
        /// </summary>
        /// <returns>Est retourné la liste des candidats.</returns>
        public static List <Metier.Candidat> GetAllCandidats()
        {
            List <Metier.Candidat> listeCandidats = new List <Metier.Candidat>();

            using (SqlConnection sqlCo = DaoConnection.GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlCo;
                    String strCo = "GetAllCandidats";
                    sqlCde.CommandType = CommandType.StoredProcedure;
                    sqlCde.CommandText = strCo;
                    try
                    {
                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            listeCandidats.Add(new Metier.Candidat(sqlRdr.GetInt32(9), sqlRdr.GetString(2), sqlRdr.GetString(3), sqlRdr.GetDateTime(4), sqlRdr.GetString(5), sqlRdr.GetString(6), sqlRdr.GetBoolean(7), sqlRdr.GetBoolean(8), new Metier.SituationFamiliale((sbyte)sqlRdr.GetByte(0)), new Metier.PoleEmbauche(sqlRdr.GetInt32(1))));
                        }
                        sqlRdr.Close();
                    }
                    catch (SqlException se)
                    {
                        throw new Exceptions.DaoException.DAOExceptionFinApplication("Lecture  des candidats impossible: \n" + se.Message, se);
                    }
                }
            }
            return(listeCandidats);
        }
예제 #2
0
        /// <summary>
        /// Méthode de récupération des qualifications.
        /// </summary>
        /// <returns>Est retourné la liste des qualifications.</returns>
        public static List <Metier.Qualification> GetAllQualifications()
        {
            List <Metier.Qualification> Qualifications = new List <Metier.Qualification>();

            using (SqlConnection sqlCo = DaoConnection.GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlCo;
                    String strCo = "GetAllQualifications";
                    sqlCde.CommandType = CommandType.StoredProcedure;
                    sqlCde.CommandText = strCo;
                    try
                    {
                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            Metier.Qualification Qual = new Metier.Qualification(sqlRdr.GetInt32(0));
                            Qual.LibelleQualification = sqlRdr.GetString(1);
                            Qualifications.Add(Qual);
                        }
                        sqlRdr.Close();
                    }
                    catch (SqlException se)
                    {
                        throw new Exceptions.DaoException.DAOExceptionFinApplication("Lecture  des candidats impossible: \n" + se.Message, se);
                    }
                }
            }
            return(Qualifications);
        }
예제 #3
0
        /// <summary>
        /// Ajout d'une expérience dans la base de données.
        /// </summary>
        /// <param name="exp">expérience ajoutée.</param>
        /// <returns>booléen indiquant si l'ajout c'est fait.</returns>
        public static bool AddExperience(Metier.Experience exp)
        {
            SqlConnection sqlConnect = DaoConnection.GetConnection();
            SqlCommand    sqlCde     = new SqlCommand();

            sqlCde.CommandType = CommandType.StoredProcedure;
            sqlCde.CommandText = "AddExperience";
            sqlCde.Connection  = sqlConnect;
            sqlCde.Parameters.AddWithValue("@idQualification", exp.LaQualif.IdQualification);
            sqlCde.Parameters.AddWithValue("@idCandidat", exp.IdCandidat);
            sqlCde.Parameters.AddWithNullableValue("@idEntreprise", exp.Lentreprise.IdEntreprise);
            sqlCde.Parameters.AddWithValue("@DateDebut", exp.DateDebut);
            sqlCde.Parameters.AddWithNullableValue("@DateFin", exp.DateFin);
            sqlCde.Parameters.AddWithNullableValue("@Commentaire", exp.Commentaire);
            SqlParameter p = new SqlParameter("@idExperience", SqlDbType.Int);

            p.Direction = ParameterDirection.Output;
            sqlCde.Parameters.Add(p);
            int l       = sqlCde.ExecuteNonQuery();
            int expcode = (int)sqlCde.Parameters[6].Value;

            exp.IdExperience = expcode;
            sqlConnect.Close();
            if (l == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// Modification d'une expérience dans la base de données.
        /// </summary>
        /// <param name="exp">expérience modifiée.</param>
        /// <returns>booléen indiquant si la modification c'est faite.</returns>
        public static bool UpdExperience(Metier.Experience exp)
        {
            SqlConnection sqlConnect = DaoConnection.GetConnection();
            SqlCommand    sqlCde     = new SqlCommand();

            sqlCde.CommandType = CommandType.StoredProcedure;
            sqlCde.CommandText = "UpdExperience";
            sqlCde.Connection  = sqlConnect;
            sqlCde.Parameters.AddWithValue("@IdExperience", exp.IdExperience);
            sqlCde.Parameters.AddWithValue("@idQualification", exp.LaQualif.IdQualification);
            sqlCde.Parameters.AddWithNullableValue("@idEntreprise", exp.Lentreprise.IdEntreprise);
            sqlCde.Parameters.AddWithValue("@DateDebut", exp.DateDebut);
            sqlCde.Parameters.AddWithNullableValue("@DateFin", exp.DateFin);
            sqlCde.Parameters.AddWithNullableValue("@Commentaire", exp.Commentaire);
            int l = sqlCde.ExecuteNonQuery();

            sqlConnect.Close();
            if (l == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        /// <summary>
        /// Méthode de récupération des expériences d'un candidat.
        /// </summary>
        /// <param name="Candidat">Le Candidat à qui ont récupère les expériences.</param>
        /// <returns>Est retourné la liste des expériences du candidat.</returns>
        public static List <Metier.Experience> GetAllExperiences(Metier.Candidat Candidat)
        {
            List <Metier.Experience> Experiences = new List <Metier.Experience>();

            using (SqlConnection sqlCo = DaoConnection.GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlCo;
                    String strCo = "GetAllExperiences";
                    sqlCde.CommandType = CommandType.StoredProcedure;
                    sqlCde.CommandText = strCo;
                    sqlCde.Parameters.Add(new SqlParameter("@IdCandidat", SqlDbType.Int)).Value = Candidat.IdCandidat;
                    try
                    {
                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            //Experiences.Add(new Metier.Experience(sqlRdr.GetInt32(0), sqlRdr.GetInt32(2), sqlRdr.GetDateTime(4), sqlRdr.GetDateTime(5), sqlRdr.GetString(6), new Metier.Qualification(sqlRdr.GetInt32(1)), new Metier.Entreprise(sqlRdr.GetInt32(3))));
                            Metier.Experience Exp = new Metier.Experience();
                            Exp.IdExperience = sqlRdr.GetInt32(0);
                            Exp.IdCandidat   = sqlRdr.GetInt32(2);
                            Exp.LaQualif     = new Metier.Qualification(sqlRdr.GetInt32(1));
                            if (!sqlRdr.IsDBNull(3))
                            {
                                Exp.Lentreprise = new Metier.Entreprise(sqlRdr.GetInt32(3));
                            }
                            Exp.DateDebut = sqlRdr.GetDateTime(4);
                            if (!sqlRdr.IsDBNull(5))
                            {
                                Exp.DateFin = sqlRdr.GetDateTime(5);
                            }
                            if (!sqlRdr.IsDBNull(6))
                            {
                                Exp.Commentaire = sqlRdr.GetString(6);
                            }
                            Experiences.Add(Exp);
                        }
                        sqlRdr.Close();
                    }
                    catch (SqlException se)
                    {
                        throw new Exceptions.DaoException.DAOExceptionFinApplication("Lecture  des candidats impossible: \n" + se.Message, se);
                    }
                }
            }
            return(Experiences);
        }
예제 #6
0
        /// <summary>
        /// Suppression d'une expérience dans la base de données.
        /// </summary>
        /// <param name="exp">expérience supprimée.</param>
        /// <returns>booléen indiquant si la suppression c'est faite.</returns>
        public static bool DelExperience(Metier.Experience exp)
        {
            SqlConnection sqlConnect = DaoConnection.GetConnection();
            SqlCommand    sqlCde     = new SqlCommand();

            sqlCde.CommandType = CommandType.StoredProcedure;
            sqlCde.CommandText = "DelExperience";
            sqlCde.Connection  = sqlConnect;
            sqlCde.Parameters.AddWithValue("@idExperience", exp.IdExperience);
            int l = sqlCde.ExecuteNonQuery();

            sqlConnect.Close();
            if (l == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #7
0
        /// <summary>
        /// Méthode de récupération des entreprises d'un candidat.
        /// </summary>
        /// <returns>Est retourné la liste des entreprises.</returns>
        public static List <Metier.Entreprise> GetAllEntreprises()
        {
            List <Metier.Entreprise> Entreprises = new List <Metier.Entreprise>();

            using (SqlConnection sqlCo = DaoConnection.GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlCo;
                    String strCo = "GetAllEntreprises";
                    sqlCde.CommandType = CommandType.StoredProcedure;
                    sqlCde.CommandText = strCo;
                    try
                    {
                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            Metier.Entreprise Ent = new Metier.Entreprise();
                            Ent.IdEntreprise     = sqlRdr.GetInt32(0);
                            Ent.SecteurActivite  = new Metier.Activite((sbyte)sqlRdr.GetByte(1));
                            Ent.PoleRattachement = new Metier.PoleEmbauche();
                            if (!sqlRdr.IsDBNull(2))
                            {
                                Ent.PoleRattachement.IdPole = sqlRdr.GetInt32(2);
                            }
                            Ent.RaisonSociale = sqlRdr.GetString(3);
                            Ent.Adresse1Ent   = sqlRdr.GetString(4);
                            if (!sqlRdr.IsDBNull(5))
                            {
                                Ent.Adresse2Ent = sqlRdr.GetString(5);
                            }
                            Ent.CpEnt    = sqlRdr.GetString(6);
                            Ent.VilleEnt = sqlRdr.GetString(7);
                            Ent.Cliente  = sqlRdr.GetBoolean(8);
                            if (!sqlRdr.IsDBNull(9))
                            {
                                Ent.Contact = sqlRdr.GetString(9);
                            }
                            if (!sqlRdr.IsDBNull(10))
                            {
                                Ent.TelContact = sqlRdr.GetString(10);
                            }
                            if (!sqlRdr.IsDBNull(11))
                            {
                                Ent.MailContact = sqlRdr.GetString(11);
                            }
                            Ent.DateCreation = sqlRdr.GetDateTime(12);
                            Entreprises.Add(Ent);
                        }
                        sqlRdr.Close();
                    }
                    catch (SqlException se)
                    {
                        throw new Exceptions.DaoException.DAOExceptionFinApplication("Lecture  des candidats impossible: \n" + se.Message, se);
                    }
                }
            }
            Metier.Entreprise Entn = new Metier.Entreprise();
            Entn.IdEntreprise  = 0;
            Entn.RaisonSociale = "Aucune";
            Entreprises.Add(Entn);
            return(Entreprises);
        }