// 绑定网格 private void BindGrid() { string author = tbAuthor.Text.Trim(); string title = tbTitle.Text.Trim(); var startDt = dpStart.SelectedDate; var endDt = dpEnd.SelectedDate; ArticleType?type = (ArticleType?)UI.GetDDLValue(ddlType); IQueryable <DAL.Article> q = DAL.Article.Search(type, author, title, startDt, endDt); Grid1.BindGrid(q); }
// 查询及绑定网格 void BindGrid() { string name = tbName.Text.Trim(); string mobile = tbMobile.Text.Trim(); int? deptId = UI.GetDDLValue(ddlDept); int? titleId = UI.GetDDLValue(ddlTitle); RoleType?roleId = UI.GetDDLEnumValue(ddlRole, typeof(RoleType)); bool? enable = ddlStatus.SelectedItemArray.Length == 0 ? null : new bool?(ddlStatus.SelectedValue == "enabled"); bool includeAdmin = Common.LoginUser.Name == "admin"; IQueryable <User> q = DAL.User.Search( name: name, mobile: mobile, role: roleId, inUsed: enable, deptId: deptId, titleId: titleId, includeAdmin: includeAdmin ); Grid1.BindGrid(q); }