Exemplo n.º 1
0
        //date d un historique
        protected DateTime getDate(Historique hist)
        {
            int      year  = hist.DateHist.Value.Year;
            int      mois  = hist.DateHist.Value.Month;
            int      day   = hist.DateHist.Value.Day;
            int      heure = hist.DateHist.Value.Hour;
            int      min   = hist.DateHist.Value.Minute;
            int      sec   = hist.DateHist.Value.Second;
            DateTime dt    = new DateTime(year, mois, day, heure, min, sec);

            return(dt);
        }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
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;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void detach_Historique(Historique entity)
 {
     this.SendPropertyChanging();
     entity.Recherche = null;
 }
Exemplo n.º 5
0
 partial void DeleteHistorique(Historique instance);
Exemplo n.º 6
0
 partial void UpdateHistorique(Historique instance);
Exemplo n.º 7
0
 partial void InsertHistorique(Historique instance);