public void setStatistiques(string type, DateTime date) { string query = "select TOP (3) * from Hits where type ='" + type + "' and date = '" + date.ToString("yyyy-MM-dd") + "'order by nbRecherche desc;"; try { List <HitsDTO> list = _context.ExecuteQuery <HitsDTO>(query).Select(l => new HitsDTO { IdHits = l.IdHits, Date = l.Date, IdRequete = l.IdRequete, NbRecherche = l.NbRecherche, Type = l.Type }).ToList(); foreach (HitsDTO hit in list) { //insert Stat int count = _context.Statistiques.Count(); Statistique stat = new Statistique(); stat.idStatistiques = count + 1; stat.idRequete = hit.IdRequete; stat.date = hit.Date; stat.nbRecherche = hit.NbRecherche; stat.type = hit.Type; _context.Statistiques.InsertOnSubmit(stat); try { _context.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } } } catch (Exception e) { Console.WriteLine(e.Message + " impossible d'afficher les résultats."); } }
private void detach_Statistiques(Statistique entity) { this.SendPropertyChanging(); entity.Hit = null; }
private void attach_Statistiques(Statistique entity) { this.SendPropertyChanging(); entity.Hit = this; }
partial void DeleteStatistique(Statistique instance);
partial void UpdateStatistique(Statistique instance);
partial void InsertStatistique(Statistique instance);