Ejemplo n.º 1
0
        //SEARCH Venues
        public Paged <VenuesV2> SearchV2(int pageIndex, int pageSize, string query)
        {
            Paged <VenuesV2> pagedVenues = null;
            List <VenuesV2>  venueList   = null;
            int totalCount = 0;

            string procName = "[dbo].[Venues_SearchV2]";

            _data.ExecuteCmd(procName, delegate(SqlParameterCollection paginationParams)
            {
                paginationParams.AddWithValue("@pageIndex", pageIndex);
                paginationParams.AddWithValue("@pageSize", pageSize);
                paginationParams.AddWithValue("@query", query);
            }, delegate(IDataReader reader, short set)
            {
                VenuesV2 aVenue = MapVenueV2(reader, out int index);

                if (totalCount == 0)
                {
                    totalCount = reader.GetSafeInt32(index);
                }
                if (venueList == null)
                {
                    venueList = new List <VenuesV2>();
                }
                venueList.Add(aVenue);
            });
            {
                pagedVenues = new Paged <VenuesV2>(venueList, pageIndex, pageSize, totalCount);
            }

            return(pagedVenues);
        }
Ejemplo n.º 2
0
        private static VenuesV2 MapVenueV2(IDataReader reader, out int startingIndex)
        {
            VenuesV2 aVenue = new VenuesV2();

            startingIndex = 0;

            aVenue.Id          = reader.GetSafeInt32(startingIndex++);
            aVenue.Name        = reader.GetSafeString(startingIndex++);
            aVenue.Description = reader.GetSafeString(startingIndex++);
            Location location = new Location();

            location.Id                = reader.GetSafeInt32(startingIndex++);
            location.LocationType      = new Models.Domain.LookUp.TwoColumn();
            location.LocationType.Id   = reader.GetSafeInt32(startingIndex++);
            location.LocationType.Name = reader.GetSafeString(startingIndex++);
            location.LineOne           = reader.GetSafeString(startingIndex++);
            location.LineTwo           = reader.GetSafeString(startingIndex++);
            location.City              = reader.GetSafeString(startingIndex++);
            location.Zip               = reader.GetSafeString(startingIndex++);
            location.State             = new Models.Domain.LookUp.TwoColumn();
            location.State.Id          = reader.GetSafeInt32(startingIndex++);
            location.State.Name        = reader.GetSafeString(startingIndex++);
            location.Latitude          = reader.GetSafeDouble(startingIndex++);
            location.Longitude         = reader.GetSafeDouble(startingIndex++);
            location.DateModified      = reader.GetSafeDateTime(startingIndex++);
            location.DateAdded         = reader.GetSafeDateTime(startingIndex++);
            location.CreatedBy         = new UserProfile();
            location.CreatedBy.UserId  = reader.GetSafeInt32(startingIndex++);
            aVenue.Location            = location;
            aVenue.Url          = reader.GetSafeString(startingIndex++);
            aVenue.CreatedBy    = reader.GetSafeInt32(startingIndex++);
            aVenue.ModifiedBy   = reader.GetSafeInt32(startingIndex++);
            aVenue.DateCreated  = reader.GetSafeUtcDateTime(startingIndex++);
            aVenue.DateModified = reader.GetSafeUtcDateTime(startingIndex++);

            return(aVenue);
        }