Esempio n. 1
0
 public Mission(int idMission, Entreprise ent, MotifFin motif, Qualification qualif, Niveau niv, Consultant consult, DateTime dateOuv, DateTime? dateFin, decimal? remu, string precis, sbyte? duree)
 {
     IdMission = idMission;
     EntrepriseOffre = ent;
     Motif = motif;
     QualificationDemandee = qualif;
     NiveauDemande = niv;
     Consult = consult;
     DateOuverture = dateOuv;
     DateFin = dateFin;
     RemunerationProposee = remu;
     Precisions = precis;
     Duree = duree;
 }
Esempio n. 2
0
        // Récupération de la liste des missions
        public static List<Mission> GetAllMissions(int idEntre)
        {
            List<Mission> Missions = new List<Mission>();
            using (SqlConnection sqlConnect = GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlConnect;
                    string strsql = "GetAllMissions";
                    sqlCde.CommandType = CommandType.StoredProcedure;
                    sqlCde.CommandText = strsql;
                    SqlParameter p1 = new SqlParameter("@vidEntreprise", SqlDbType.Int);
                    p1.Direction = ParameterDirection.Input;
                    p1.Value = idEntre;
                    sqlCde.Parameters.Add(p1);

                    try
                    {

                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            int idMission = sqlRdr.GetInt32(0);
                            Entreprise ent = new Entreprise() { IdEntreprise = sqlRdr.GetInt32(1) };
                            MotifFin motif = (!sqlRdr.IsDBNull(2)) ? new MotifFin() { IdMotif = (sbyte)sqlRdr.GetByte(2) } : null;
                            Qualification qualif = new Qualification() { IdQualification = sqlRdr.GetInt32(3), LibelleQualification = sqlRdr.GetString(4) };
                            Niveau niv = (!sqlRdr.IsDBNull(5)) ? new Niveau() { IdNiveau = (sbyte)sqlRdr.GetByte(5) } : null;
                            Consultant consult = new Consultant() { IdConsultant = (sbyte)sqlRdr.GetByte(6) };
                            DateTime dateOuv = sqlRdr.GetDateTime(7);
                            DateTime? dateFin = (sqlRdr.IsDBNull(8)) ? (DateTime?)null : sqlRdr.GetDateTime(8);
                            decimal? remu = (sqlRdr.IsDBNull(9)) ? (decimal?)null : sqlRdr.GetDecimal(9);
                            string precis = (!sqlRdr.IsDBNull(10)) ? sqlRdr.GetString(10) : string.Empty;
                            sbyte? duree = (sqlRdr.IsDBNull(11)) ? (sbyte?)null : (sbyte)sqlRdr.GetByte(11);

                            Mission miss = new Mission(idMission, ent, motif, qualif, niv, consult, dateOuv, dateFin, remu, precis, duree);
                            Missions.Add(miss);

                        }
                        sqlRdr.Close();
                        return Missions;
                    }
                    catch (SqlException ex)
                    {
                        throw new DaoExceptionFinApplication("Chargement des missions impossible, l'application va se fermer: \n" + ex.Message, ex);
                    }
                }
            }
        }
Esempio n. 3
0
        // Récupération de la liste des entreprises
        public static List<Entreprise> GetAllEntreprises()
        {
            List<Entreprise> Entreprises = new List<Entreprise>();
            using (SqlConnection sqlConnect = GetConnection())
            {
                using (SqlCommand sqlCde = new SqlCommand())
                {
                    sqlCde.Connection = sqlConnect;
                    string strsql = "GetAllEntreprises";

                    try
                    {
                        sqlCde.CommandType = CommandType.StoredProcedure;
                        sqlCde.CommandText = strsql;
                        SqlDataReader sqlRdr = sqlCde.ExecuteReader();
                        while (sqlRdr.Read())
                        {
                            Entreprise entreprise = new Entreprise()
                            {
                                IdEntreprise = sqlRdr.GetInt32(0),
                                RaisonSociale = sqlRdr.GetString(3)
                            };
                            Entreprises.Add(entreprise);
                        }
                        sqlRdr.Close();
                        return Entreprises;
                    }
                    catch (SqlException ex)
                    {
                        throw new DaoExceptionFinApplication("Chargement des entreprises impossible, l'application va se fermer: \n" + ex.Message, ex);
                    }
                }
            }
        }