Esempio n. 1
0
        //ajout d un recherche a l historique
        protected void addhist(int indexSearch)
        {
            indexSearch += begin;
            Recherche existRecherche = db.Recherche.SingleOrDefault(x => x == recherches[indexSearch]);

            if (existRecherche != null)
            {
                Historique historique = new Historique();
                historique.Recherche = existRecherche;
                historique.DateHist  = DateTime.Now;
                db.Historique.InsertOnSubmit(historique);
                db.SubmitChanges();
            }
        }
Esempio n. 2
0
        //optimiser les resultats du recherche
        protected void optimiser()
        {
            for (int i = 0; i < recherches.Length; i++)
            {
                for (int j = 0; j < recherches.Length; j++)
                {
                    int nbrI = db.Historique.Count(x => x.Recherche == recherches[i]);
                    int nbrJ = db.Historique.Count(x => x.Recherche == recherches[j]);

                    // comparaison pas nombre de fois cliqué
                    if (nbrJ < nbrI)
                    {
                        Recherche tmp = recherches[i];
                        recherches[i] = recherches[j];
                        recherches[j] = tmp;
                    }
                    //comparaison par le plus recent
                    else if (nbrI == nbrJ && nbrI != 0)
                    {
                        //dernier historique
                        Historique histI = new Historique(), histJ = new Historique();
                        foreach (Historique hist in db.Historique)
                        {
                            if (hist.Recherche == recherches[i])
                            {
                                histI = hist;
                            }
                            if (hist.Recherche == recherches[j])
                            {
                                histJ = hist;
                            }
                        }
                        DateTime dt1 = getDate(histI);
                        DateTime dt2 = getDate(histJ);
                        if (DateTime.Compare(dt1, dt2) > 0)
                        {
                            Recherche tmp = recherches[i];
                            recherches[i] = recherches[j];
                            recherches[j] = tmp;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 private void detach_Recherche(Recherche entity)
 {
     this.SendPropertyChanging();
     entity.Lien = null;
 }
Esempio n. 4
0
 private void attach_Recherche(Recherche entity)
 {
     this.SendPropertyChanging();
     entity.Lien = this;
 }
Esempio n. 5
0
 partial void DeleteRecherche(Recherche instance);
Esempio n. 6
0
 partial void UpdateRecherche(Recherche instance);
Esempio n. 7
0
 partial void InsertRecherche(Recherche instance);