Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas 123 posts 206 karma points
    Apr 05, 2016 @ 09:19
    Jonas
    0

    SQL

    What am I doing wrong, ...

    This wont work.

    e.Query.Where("BookingCategory = 'Child'");

    or this..

    e.Query.Where("BookingCategory = @0","'Child'");

    (Column name is "BookingCategory")

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Apr 05, 2016 @ 09:37
    Tim Geyssens
    0

    In which event are you doing this?

  • Jonas 123 posts 206 karma points
    Apr 05, 2016 @ 09:38
    Jonas
    0

    public class EventHandlerscs4 : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { UIOMatic.Controllers.PetaPocoObjectController.BuildingQuery += PetaPocoObjectController_BuildingQuery; }

        void PetaPocoObjectController_BuildingQuery(object sender, UIOMatic.QueryEventArgs e)
        {
    
            if (e.CurrentType == typeof(tcAdminTodaysChildActivity))
            {
                var DateNow = DateTime.Now;
                var theDate = Convert.ToDateTime(DateNow.ToString("yyyy-MM-dd"));
    
                e.Query.Where("HotelSiteRootId = @0 AND BookingCategory = 'Child' AND DATEPART(yy, ActivityStartTime) = " + theDate.Year + " AND DATEPART(mm, ActivityStartTime) = " + theDate.Month + "AND DATEPART(dd, ActivityStartTime) = " + theDate.Day + "", UmbracoContext.Current.Security.CurrentUser.StartContentId);
    
            }
    
    
        }
    }
    
  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Apr 05, 2016 @ 10:05
    Tim Geyssens
    0

    So the other filters work? Or they all fail?

  • Jonas 123 posts 206 karma points
    Apr 05, 2016 @ 10:50
    Jonas
    0

    The other filters work fine, both HotelSiteRootId (int) and Date (DateTime).

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Apr 05, 2016 @ 11:50
    Tim Geyssens
    0

    Hmm don't see why it shouldn't work, are you sure the correct code is getting executed?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies