Search Results

Search found 102 results on 5 pages for 'terry lorber'.

Page 5/5 | < Previous Page | 1 2 3 4 5 

  • How to use PredicateBuilder with nested OR conditionals in Linq

    - by tblank
    I've been very happily using PredicateBuilder but until now have only used it for queries with only either concatenated AND statements or OR statements. Now for the first time I need a pair of OR statements nested along with a some AND statements like this: select x from Table1 where a = 1 AND b = 2 AND (z = 1 OR y = 2) Using the documentation from Albahari, I've constructed my expression like this: Expression<Func<TdIncSearchVw, bool>> predicate = PredicateBuilder.True<TdIncSearchVw>(); // for AND Expression<Func<TdIncSearchVw, bool>> innerOrPredicate = PredicateBuilder.False<TdIncSearchVw>(); // for OR innerOrPredicate = innerOrPredicate.Or(i=> i.IncStatusInd.Equals(incStatus)); innerOrPredicate = innerOrPredicate.Or(i=> i.RqmtStatusInd.Equals(incStatus)); predicate = predicate.And(i => i.TmTec.Equals(tecTm)); predicate = predicate.And(i => i.TmsTec.Equals(series)); predicate = predicate.And(i => i.HistoryInd.Equals(historyInd)); predicate.And(innerOrPredicate); var query = repo.GetEnumerable(predicate); This results in SQL that completely ignores the 2 OR phrases. select x from TdIncSearchVw where ((this_."TM_TEC" = :p0 and this_."TMS_TEC" = :p1) and this_."HISTORY_IND" = :p2) If I try using just the OR phrases like: Expression<Func<TdIncSearchVw, bool>> innerOrPredicate = PredicateBuilder.False<TdIncSearchVw>(); // for OR innerOrPredicate = innerOrPredicate.Or(i=> i.IncStatusInd.Equals(incStatus)); innerOrPredicate = innerOrPredicate.Or(i=> i.RqmtStatusInd.Equals(incStatus)); var query = repo.GetEnumerable(innerOrPredicate); I get SQL as expected like: select X from TdIncSearchVw where (IncStatusInd = incStatus OR RqmtStatusInd = incStatus) If I try using just the AND phrases like: predicate = predicate.And(i => i.TmTec.Equals(tecTm)); predicate = predicate.And(i => i.TmsTec.Equals(series)); predicate = predicate.And(i => i.HistoryInd.Equals(historyInd)); var query = repo.GetEnumerable(predicate); I get SQL like: select x from TdIncSearchVw where ((this_."TM_TEC" = :p0 and this_."TMS_TEC" = :p1) and this_."HISTORY_IND" = :p2) which is exactly the same as the first query. It seems like I'm so close it must be something simple that I'm missing. Can anyone see what I'm doing wrong here? Thanks, Terry

    Read the article

  • Internationalization of static pages with Rails

    - by Gavin
    I feel like I'm missing something really simple and I keep spinning my wheels on this problem. I currently have internationalization working throughout my app. The translations work and the routes work perfectly. At least, most of the site works with the exception of the routes to my two static pages, my "About" and "FAQ" pages. Every other link throughout the app points to the proper localized route. For example if I select "french" as my language, links point to the appropriate "(/:locale)/controller(.:format)." However, despite the changes I make throughout the app my links for the "About" and "FAQ" refuse to point to "../fr/static/about" and always point to "/static/about." To make matters stranger, when I run rake routes I see: "GET (/:locale)/static/:permalink(.:format) pages#show {:locale=/en|fr/}" and when I manually type in "../fr/static/about" the page translates perfectly. My Routes file: devise_for :users scope "(:locale)", :locale => /en|fr/ do get 'static/:permalink', :controller => 'pages', :action => 'show' resources :places, only: [:index, :show, :destroy] resources :homes, only: [:index, :show] match '/:locale' => 'places#index' get '/'=>'places#index',:as=>"root" end My ApplicationController: before_filter :set_locale def set_locale I18n.locale=params[:locale]||I18n.default_locale end def default_url_options(options={}) logger.debug "default_url_options is passed options: #{options.inspect}\n" { :locale => I18n.locale } end and My Pages Controller: class PagesController < ApplicationController before_filter :validate_page PAGES = ['about_us', 'faq'] def show render params[:permalink] end def validate_page redirect_to :status => 404 unless PAGES.include?(params[:permalink]) end end I'd be very grateful for any help ... it's just been one of those days. Edit: Thanks to Terry for jogging me to include views. <div class="container-fluid nav-collapse"> <ul class="nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t(:'navbar.about') %><b class="caret"></b></a> <ul class="dropdown-menu"> <li><%=link_to t(:'navbar.about_us'), "/static/about_us"%></li> <li><%=link_to t(:'navbar.faq'), "/static/faq"%></li> <li><%=link_to t(:'navbar.blog'), '#' %></li> </ul> </li>

    Read the article

< Previous Page | 1 2 3 4 5