Esempio n. 1
0
        // ****************************
        // **THIS CURRENTLY GETS ALL EVENTS FROM DB. WILL NEED TO UPDATE IN FRONT END TO GET EVENTS NEAR USER.
        public static List<Event> GetNearbyEvents(int Id)
        {
            List<Event> list = new List<Event>();

            DataProvider.ExecuteCmd(GetConnection, "dbo.Event_Select"
               , inputParamMapper: delegate (SqlParameterCollection paramCollection)

               {  }

               , map: delegate (IDataReader reader, short set)
               {
                   int startingIndex = 0;
                   Event e = new Event();

                   e.Id = reader.GetSafeInt32(startingIndex++);
                   e.Name = reader.GetSafeString(startingIndex++);
                   e.Organization = reader.GetSafeString(startingIndex++);
                   e.CategoryId = reader.GetSafeInt32(startingIndex++);
                   e.Address = reader.GetSafeString(startingIndex++);
                   e.Description = reader.GetSafeString(startingIndex++);

                   if (list == null)
                   {
                       list = new List<Event>();
                   }

                   list.Add(e);

               }
               );

            return list;
        }
Esempio n. 2
0
        public static Event GetEventById(int Id)
        {
            Event e = new Event();

            DataProvider.ExecuteCmd(GetConnection, "dbo.Event_SelectById"
               , inputParamMapper: delegate (SqlParameterCollection paramCollection)

               { paramCollection.AddWithValue("@Id", Id); }

               , map: delegate (IDataReader reader, short set)
               {
                   int startingIndex = 0;

                   e.Id = reader.GetSafeInt32(startingIndex++);
                   e.Name = reader.GetSafeString(startingIndex++);
                   e.Organization = reader.GetSafeString(startingIndex++);
                   e.CategoryId = reader.GetSafeInt32(startingIndex++);
                   e.Address = reader.GetSafeString(startingIndex++);
                   e.Description = reader.GetSafeString(startingIndex++);
               }
               );

            return e;
        }