复制代码 代码如下:
private bool GetCondition(FeedBack fb)
{
bool boolResult = true;
int f_type = Int32.Parse(ddlFType.SelectedValue);
int isClose = Int32.Parse(ddlIsClose.SelectedValue);
int isTrue = Int32.Parse(ddlIsTrue.SelectedValue);
string keyword = tbxKeyword.Text.FilterInjectStr();
if (f_type != 0)
{
boolResult &= fb.F_Type == f_type;
}
if (isClose != -1)
{
boolResult &= fb.IsClose == isClose;
}
if (isTrue != -1)
{
boolResult &= fb.IsTrue == isTrue;
}
if (!keyword.IsNullOrEmpty())
{
boolResult &= fb.ContentInfo.IndexOf(keyword) > -1;
}
return boolResult;
}
复制代码 代码如下:
private void ListDataBind()
{
Expression<Func<FeedBack,bool>> expr = n => GetCondition(n);
List<FeedBack> pageData = feedBacks.AllFeedBacks.Where(expr.Compile()).ToList();
FeedbackList.DataSource = pageData;
FeedbackList.DataBind();
}
新闻热点
疑难解答
图片精选