コード例 #1
0
ファイル: Service1.svc.cs プロジェクト: RimvydasJ/Application
 public List<Eventas> getCityAllEvents(string city)
 {
     List<Eventas> ListOfAllEvents = new List<Eventas>();
     Eventas event1 = new Eventas();
     try
     {
         using (ProjektasEntities2 database = new ProjektasEntities2())
         {
             foreach (var getevent1 in database.Events)
             {
                 if (getevent1.City.Equals(city))
                 {
                     event1.eventid = getevent1.EventId;
                     event1.eventname = getevent1.EventName;
                     event1.EventTypes = certainEvent(getEventType(getevent1.EventType));
                     event1.latitude = (float)getevent1.Latitude;
                     event1.longitude = (float)getevent1.Longitude;
                     event1.name = getevent1.Name;
                     event1.peoplecount = (int)getevent1.PeopleCount;
                     event1.city = getevent1.City;
                     event1.country = getevent1.Country;
                     event1.description = getevent1.Description;
                     ListOfAllEvents.Add(event1);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     return ListOfAllEvents;
 }
コード例 #2
0
ファイル: Service1.svc.cs プロジェクト: RimvydasJ/Application
 public Eventas getEvent(int id)
 {
     Eventas event1 = new Eventas();
     try
     {
         using (ProjektasEntities2 database = new ProjektasEntities2())
         {
             var getevent1 = database.Events.First((p) => p.EventId == id);
             event1.eventid = getevent1.EventId;
             event1.eventname = getevent1.EventName;
             event1.EventTypes = certainEvent(getEventType(getevent1.EventType));
             event1.latitude = (float)getevent1.Latitude;
             event1.longitude = (float)getevent1.Longitude;
             event1.name = getevent1.Name;
             event1.peoplecount =(int) getevent1.PeopleCount;
             event1.city = getevent1.City;
             event1.country = getevent1.Country;
             event1.description = getevent1.Description;    
         }
     }
     catch(Exception e)
     {
         Console.WriteLine(e.Message);
     }
     return event1;
 }