Beispiel #1
0
        public List <Offre> GetAllOffres(FiltersOffreRequest filtre)
        {
            List <Offre> offres = new List <Offre>();

            string query = "SELECT * FROM OFFRE";

            var parameters = new List <SqlParameter>();

            query = AddFilterQuery <int?>(query, "REG_ID", "@REG_ID", "=", filtre.region?.Id, parameters);

            query = AddFilterQuery(query, "CON_ID", "@CON_ID", "=", filtre.contrat?.Id, parameters);

            query = AddFilterQuery(query, "POS_ID", "@POS_ID", "=", filtre.poste?.Id, parameters);

            query = AddFilterQuery(query, "CREATION", "@CREATIONSTART", ">=", filtre.intervalle?.Start, parameters);

            query = AddFilterQuery(query, "CREATION", "@CREATIONDEND", "<=", filtre.intervalle?.End, parameters);

            DataSet dataSet = SQLManager.ExcecuteQuery(query, parameters);

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                Region  r   = Configuration.ConfigDAL.regionDAO.FindRegionByID((int)row["REG_ID"]);
                Contrat c   = Configuration.ConfigDAL.contratDAO.FindContratByID((int)row["CON_ID"]);
                Poste   p   = Configuration.ConfigDAL.posteDAO.FindPosteByID((int)row["POS_ID"]);
                Offre   off = new Offre(row, p, c, r);
                offres.Add(off);
            }
            return(offres);
        }
Beispiel #2
0
 public List <Offre> GetOffresFiltrer(FiltersOffreRequest filtre)
 {
     if (filtre == null)
     {
         return(controllerS.GetOffres());
     }
     else
     {
         return(controllerS.GetOffres(filtre));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Récupère la liste des Offres affilié a un filtre passée en paramètre
        /// </summary>
        /// <param name="filtersOffre"></param>
        /// <returns></returns>
        public async Task <List <Offre> > GetOffres(FiltersOffreRequest filtersOffre)
        {
            List <Offre> listOffre = null;
            RestRequest  request   = new RestRequest("offresFiltrer", Method.POST);

            request.AddJsonBody(ParseJson(filtersOffre));

            if (token != null && token.Token.CanBeCanceled)
            {
                token.Cancel();
            }
            token = new CancellationTokenSource();
            Task <IRestResponse <List <Offre> > > restResponse = objClient.ExecuteAsync <List <Offre> >(request, token.Token);

            await restResponse;

            if (restResponse.Result.StatusCode == HttpStatusCode.OK)
            {
                listOffre = restResponse.Result.Data;
            }
            return(listOffre);
        }
Beispiel #4
0
        public async Task <IEnumerable <OffreM> > getOffrebyRegion(RegionM region = null, bool favori = false)
        {
            List <OffreM> offres    = new List <OffreM>();
            List <Offre>  response  = new List <Offre>();
            List <int>    favorites = getFavorites();

            if (region != null)
            {
                FiltersOffreRequest filter = new FiltersOffreRequest();

                filter.region = new Region(region.Id, region.Nom);

                response = await controleur.GetOffres(filter);
            }
            else
            {
                response = controleur.GetOffres();
            }

            // Lambda Fonction
            response.ForEach(o => {
                OffreM om = new OffreM(o);

                om.isFavorite = favorites.Contains(o.Id.Value);
                if (favori && om.isFavorite)
                {
                    offres.Add(om);
                }
                else if (!favori)
                {
                    offres.Add(om);
                }
            });

            return(offres);
        }
Beispiel #5
0
 public List <Offre> GetOffres(FiltersOffreRequest filtre)
 {
     return(ConfigDAL.offreDAO.GetAllOffres(filtre));
 }