Exemplo n.º 1
0
        public List <Offre> RetrieveOffresBySelection(string idSociete, string idRegion, string idPoste, string idContrat, string nbrJour)
        {
            OffreDataAccess dataAccess = new OffreDataAccess();

            List <Offre> offres      = new List <Offre>();
            DataTable    schemaTable = dataAccess.SelectBySelection(Convert.ToInt32(idSociete), Convert.ToInt32(idRegion), Convert.ToInt32(idPoste), Convert.ToInt32(idContrat), Convert.ToInt32(nbrJour));

            foreach (DataRow row in schemaTable.Rows)
            {
                Offre offre = new Offre
                {
                    Id = Convert.ToInt32(row["ID_OFFRE"]),
                    DatePublication = Convert.ToDateTime(row["DATE_PUBLICATION"]),
                    Description     = row["DESCRIPTION"].ToString(),
                    LienAnnonce     = row["LIEN_ANNONCE"].ToString()
                };
                offre.MySelection.MySociete.Id  = Convert.ToInt32(row["ID_SOCIETE"]);
                offre.MySelection.MySociete.Nom = row["NOM_SOCIETE"].ToString();
                offre.MySelection.MyContrat.Id  = Convert.ToInt32(row["ID_CONTRAT"]);
                offre.MySelection.MyContrat.Nom = row["TYPE_CONTRAT"].ToString();
                offre.MySelection.MyRegion.Id   = Convert.ToInt32(row["ID_REGION"]);
                offre.MySelection.MyRegion.Nom  = row["NOM_REGION"].ToString();
                offre.MySelection.MyPoste.Id    = Convert.ToInt32(row["ID_POSTE"]);
                offre.MySelection.MyPoste.Nom   = row["TYPE_POSTE"].ToString();

                offres.Add(offre);
            }
            offres.Sort();
            return(offres);
        }
Exemplo n.º 2
0
        public static bool Delete(this OffreManager offreManager, Offre offre)
        {
            OffreDataAccess dataAccess = new OffreDataAccess();
            int             rowCount   = 0;

            try
            {
                rowCount = dataAccess.Delete(offre);
            }
            catch (ExceptionDataAccess e)
            {
                MessageBox.Show($"Erreur dans la récupérations des données, {e.Message}", "ERREUR", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
            }
            return(rowCount > 0);
        }
Exemplo n.º 3
0
        public static int Create(this OffreManager offreManager, Offre offre)
        {
            OffreDataAccess dataAccess = new OffreDataAccess();
            int             idSociete  = 0;

            try
            {
                idSociete = dataAccess.Insert(offre);
            }
            catch (Exception e)
            {
                MessageBox.Show($"Erreur dans la récupérations des données, {e.Message}", "ERREUR", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
            }
            return(idSociete);
        }