Linq查询条件。 [英] Linq query conditions.
问题描述
User1启用了以下字段名:
TrialStartDate:26/05/2013
TrialExpiryDate:31/05/2013
WIC_ALL:true
Price_Start日期:28/05/2013
Price_ExpiryDate:31/05/2013
如果User1具有trialStart和trialExpiry Date设置,则用户将成为newsUser。但是,当user1也设置了wic_all,PriceStart和PriceExpiry Date时,则user1成为完全用户,使其覆盖(NewsTrials)查询。
我的问题是我无法使用(完整测试)查询将user1作为FullUser登录。我想知道怎么能覆盖newsTrial查询?
请帮忙。
User1 has the following fieldnames enabled:
TrialStartDate: 26/05/2013
TrialExpiryDate: 31/05/2013
WIC_ALL: true
Price_StartDate: 28/05/2013
Price_ExpiryDate: 31/05/2013
If User1 has trialStart and trialExpiry Date setup, then user becomes a newsUser. However , when the user1 also has wic_all, PriceStart and PriceExpiry Date setup too, then user1 becomes full user, making it overide the (NewsTrials) query.
My issue is that I am unable to login user1 as FullUser using the (full-test) query. I would like to know how can overide the newsTrial query?
Please help.
public UserDetail NewsTrial(string username, string password)
{
var query = from s in db.Subscriptions
join u in db.UserDetails on s.sUID equals u.uID
where s.sTrialExpiryDate >= DateTime.Now &&
s.sPID.Value == 163 &&
u.uUsername == username &&
u.uPassword == password
select u; //
return query.FirstOrDefault();
}
public UserDetail full_test(string username, string password)
{
var query = from s in db.Subscriptions
join u in db.UserDetails on s.sUID equals u.uID
where s.sPrice_ExpiryDate >= DateTime.Now &&
s.sPID.Value == 163 &&
s.sWIC_All.Value == true &&
u.uUsername == username &&
u.uPassword == password
select u;
return query.FirstOrDefault();
}
非常感谢。
Many thanks.
推荐答案
这篇关于Linq查询条件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!