/// <summary> /// 组合搜索条件 /// </summary> /// <param name="mssqlCondition"></param> /// <param name="search">RecordingSearch模型变量</param> public MssqlCondition PrepareCondition(RecordingSearch search) { MssqlCondition mssqlCondition = new MssqlCondition(); mssqlCondition.Add("[BOrderId]", search.BOrderId, ConditionType.Equal); mssqlCondition.Add("[Price]", search.Price, ConditionType.Like); mssqlCondition.Add("[Name]", search.Name, ConditionType.Like); mssqlCondition.Add("[Photo]", search.Photo, ConditionType.Like); mssqlCondition.Add("[AddDate]", search.AddDate, ConditionType.Like); mssqlCondition.Add("[UserId]", search.UserId, ConditionType.Equal); mssqlCondition.Add("[UserName]", search.UserName, ConditionType.Like); mssqlCondition.Add("[BOrderId]", search.InBOrderId, ConditionType.In); return(mssqlCondition); }
/// <summary> /// 搜索砍价记录表数据列表 /// </summary> /// <param name="search">RecordingSearch模型变量</param> /// <returns>砍价记录表数据列表</returns> public List <RecordingInfo> SearchRecordingList(RecordingSearch search) { using (var conn = new SqlConnection(connectString)) { string sql = "select * from Recording"; string condition = PrepareCondition(search).ToString(); if (!string.IsNullOrEmpty(condition)) { sql += " where " + condition + " Order by AddDate DESC"; } return(conn.Query <RecordingInfo>(sql).ToList()); } }
/// <summary> /// 搜索砍价记录表数据列表 /// </summary> /// <param name="currentPage">当前的页数</param> /// <param name="pageSize">每页记录数</param> /// <param name="search">RecordingSearch模型变量</param> /// <param name="count">总数量</param> /// <returns>砍价记录表数据列表</returns> public List <RecordingInfo> SearchRecordingList(int currentPage, int pageSize, RecordingSearch search, ref int count) { using (var conn = new SqlConnection(connectString)) { ShopMssqlPagerClass pc = new ShopMssqlPagerClass(); pc.TableName = "Recording"; pc.Fields = "*"; pc.CurrentPage = currentPage; pc.PageSize = pageSize; pc.OrderType = OrderType.Desc; pc.MssqlCondition = PrepareCondition(search); count = pc.Count; return(conn.Query <RecordingInfo>(pc).ToList()); } }
/// <summary> /// 搜索砍价记录表数据列表 /// </summary> /// <param name="currentPage">当前的页数</param> /// <param name="pageSize">每页记录数</param> /// <param name="mode">RecordingSearch模型变量</param> /// <param name="count">总数量</param> /// <returns>砍价记录表数据列表</returns> public static List <RecordingInfo> SearchRecordingList(int currentPage, int pageSize, RecordingSearch mode, ref int count) { return(dal.SearchRecordingList(currentPage, pageSize, mode, ref count)); }
/// <summary> /// 搜索砍价记录表数据列表 /// </summary> /// <param name="mode">RecordingSearch模型变量</param> /// <returns>砍价记录表数据列表</returns> public static List <RecordingInfo> SearchRecordingList(RecordingSearch mode) { return(dal.SearchRecordingList(mode)); }