码迷,mamicode.com
首页 > 其他好文 > 详细

多字段动态查询

时间:2017-05-06 17:54:56      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:getc   condition   code   tco   ted   city   ber   val   get   

private bool GetCondition(MerchantTravelXSJL tb, string key, string searchCity, string phoneNumber, DateTime? buyStartDate, DateTime? buyEndDate, int? checkStatus)
{
bool boolResult = true;

if (!String.IsNullOrEmpty(key))
{
boolResult &= tb.MERCHANTNAME == key;
}
if (!String.IsNullOrEmpty(searchCity))
{
boolResult &= tb.CITYCODE == searchCity;
}
if (!String.IsNullOrEmpty(phoneNumber))
{
boolResult &= tb.CELLPHONENUMBER == phoneNumber;

}
if (buyStartDate.HasValue)
{
boolResult &= (tb.CREATEDTIME >= buyStartDate.Value);
}
if (buyEndDate.HasValue)
{
boolResult &= tb.CREATEDTIME < buyEndDate.Value;
}
if (checkStatus.HasValue)
{
boolResult &= tb.STATUS == checkStatus;
}
return boolResult;
}

多字段动态查询

标签:getc   condition   code   tco   ted   city   ber   val   get   

原文地址:http://www.cnblogs.com/fyy1003668657/p/6817149.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!