/// <summary> /// 查询公告 /// </summary> /// <param name="filter">查询条件</param> public static QueryResult<Notices> QueryNotices(NoticesQueryFilter filter) { QueryResult<Notices> result = new QueryResult<Notices>(); PagingInfoEntity page = new PagingInfoEntity(); page.SortField = (filter.SortList == null || filter.SortList.Count == 0) ? null : filter.SortListToString(); page.MaximumRows = filter.PageSize; page.StartRowIndex = (filter.PageIndex - 1) * filter.PageSize; CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryNotices"); using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC")) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32, "@SysNo", QueryConditionOperatorType.Equal, filter.SysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Contents", DbType.String, "@Contents", QueryConditionOperatorType.Like, filter.Contents); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32, "@Status", QueryConditionOperatorType.Equal, filter.Status); cmd.CommandText = sqlBuilder.BuildQuerySql(); result.ResultList = cmd.ExecuteEntityList<Notices>(); int totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); result.PagingInfo = new PagingInfo() { PageIndex = filter.PageIndex, PageSize = filter.PageSize, TotalCount = totalCount }; return result; } }
protected void Page_Load(object sender, EventArgs e) { NoticesQueryFilter queryFilter = new NoticesQueryFilter(); queryFilter.PageCount = 0; queryFilter.PageIndex = 1; queryFilter.PageSize = 10; NoticesLogic.QueryNotices(queryFilter); btnOK.ServerClick += new EventHandler(btnOK_ServerClick); }
public override void PageLoad() { base.PageLoad(); ucPager.PageSize = 10; QueryFilter = new NoticesQueryFilter(); if (!IsPostBack) { BindData(); } }
/// <summary> /// 修改公告状态 /// </summary> /// <param name="sysNo">编号</param> /// <param name="status">状态</param> public static QueryResult<Notices> QueryNotices(NoticesQueryFilter queryFilter) { return NoticesDA.QueryNotices(queryFilter); }