Example #1
0
 /// <summary>
 /// Met à jour un event
 /// </summary>
 /// <param name="idP"></param>
 /// <param name="nameP"></param>
 /// <param name="town"></param>
 /// <param name="latitude"></param>
 /// <param name="longitude"></param>
 /// <param name="idE"></param>
 /// <param name="nameE"></param>
 /// <param name="type"></param>
 /// <param name="date"></param>
 /// <param name="adresse"></param>
 /// <returns></returns>
 public bool get_event(string idP = "", string nameP = "", string town = "", decimal? latitude = 0, decimal? longitude = 0,
     string idE = "", string nameE = "", long type = 0L, DateTime date = new DateTime(), string adresse = "")
 {
     Place XNewPlace = new Place(idP, nameP, town, latitude, longitude);
     Event XNewEvent = new Event(idE, nameE, type, date, XNewPlace, adresse);
     eventsController controller = new eventsController();
     controller.UpdateEvent(XNewEvent);
     return true;
 }
Example #2
0
        public void TestSearchEvent()
        {
            Place PlaceTest = new Place("80", "Place", "Ville", 2, 4);
            Event EventTest = new Event("800", "MyEventTest", 1L, new DateTime(2014, 11, 30), PlaceTest, "adresse test");
            client.Index(EventTest);

            var searchResults = controllerEvent.SimpleSearchEvent("myeventtest", 0, 1); //test de la recherche
            Assert.AreEqual(1, searchResults.Total);
        }
Example #3
0
 public void UpdateEvent(Event _newevent)
 {
     ElasticClient client = YoupElasticSearch.InitializeConnection();
     var response = client.Update<Event, Event>(u => u
         .Index("youp")
         .Id(_newevent.Id)
         .Doc(_newevent)
      );
 }
Example #4
0
        public void TestAddEvent()
        {
            Place PlaceTest = new Place("50", "Place", "Ville", 2, 4);
            Event EventTest = new Event("500", "Event test", 1L, new DateTime(2014, 11, 30), PlaceTest, "adresse test");

            controllerEvent.AddEvent(EventTest); //test de l'ajout

            var searchResults = client.Search<Event>(s => s.Query(q => q.Term(p => p.Id, "500")));
            Assert.AreEqual(1, searchResults.Total);
        }
Example #5
0
        public void TestUpdateEvent()
        {
            Place PlaceTest = new Place("70", "Place test", "Ville", 2, 4);
            Event EventTest = new Event("700", "Event test", 1L, new DateTime(2014, 11, 30), PlaceTest, "adresse");
            Event newEvent = new Event("700", "Event updated", 1L, new DateTime(2014, 11, 30), PlaceTest, "adresse");
            client.Index(EventTest);

            controllerEvent.UpdateEvent(newEvent); //test de la modification

            var searchResults = client.Search<Event>(s => s.Query(q => q.Term(p => p.Id, "700")));
            foreach (Event hit in searchResults.Hits)
                Assert.AreEqual("Event updated", hit.Name);
        }
Example #6
0
 //
 // GET: /Events/
 public void AddEvent(Event _event)
 {
     ElasticClient client = YoupElasticSearch.InitializeConnection();
     var index = client.Index(_event);
     /*
     try
     {
         client.CreateIndex(s => s
             .AddMapping<Event>(f => f
                 .MapFromAttributes()
                 .Properties(p => p
                     .GeoPoint(g => g.Name(n => n.location).IndexLatLon()))));
     }
     catch (Exception e) { }*/
 }
Example #7
0
        //Migration event
        public static bool eventMigration(ElasticClient elastic)
        {
            using (var context = new YoupDEVEntities())
            {
                //Get BASE
                var events = (from e in context.EVE_Evenement
                             select e).ToList<EVE_Evenement>();

                //Translate into LUCENE
                foreach (var _event in events)
                {
                    //Place
                    // Place placeElastic = new Place(place.LieuEvenement_id.ToString(), place.Nom, place.Ville);
                    Place eventPlace = new Place(_event.LieuEvenement_id.ToString(), _event.EVE_LieuEvenement.Nom, _event.EVE_LieuEvenement.Ville,
                                _event.EVE_LieuEvenement.Latitude, _event.EVE_LieuEvenement.Longitude);

                    //Create entity into LUCENE
                    //WARNING -- TImeslot missing --
                    /* 
                    ** public string Timeslot { get; set; } <<<!!!>>>
                    public Event(string _Id, string _Name, long _Type, DateTime _Date, Place _EPlace, string _Adresse, string _Timeslot <<<!!!>>>)*/

                    Event eventElastic = new Event(_event.Evenement_id.ToString(), _event.TitreEvenement, _event.Categorie_id, _event.DateEvenement, eventPlace, _event.EVE_LieuEvenement.Adresse);
                    //Index entity
                    var indexES = elastic.Index(eventElastic);



                }
            }
            return true;
        }