public MssqlCondition PrepareCondition(WithdrawSearchInfo searchModel) { MssqlCondition mssqlCondition = new MssqlCondition(); mssqlCondition.Add("[Distributor_Id]", searchModel.Distributor_Id, ConditionType.Equal); mssqlCondition.Add("[Time]", searchModel.StartTime, ConditionType.MoreOrEqual); mssqlCondition.Add("[Time]", searchModel.EndTtime, ConditionType.LessOrEqual); mssqlCondition.Add("[Status]", searchModel.Status, ConditionType.Equal); mssqlCondition.Add("[UserName]", searchModel.UserName, ConditionType.Like); mssqlCondition.Add("[RealName]", searchModel.RealName, ConditionType.Like); mssqlCondition.Add("[Mobile]", searchModel.Mobile, ConditionType.Like); return(mssqlCondition); }
public List <WithdrawInfo> SearchList(WithdrawSearchInfo searchModel) { using (SqlConnection conn = new SqlConnection(connectString)) { string sql = @"SELECT * FROM (select a.*,b.[UserName],b.[RealName],b.[Mobile] from [Withdraw] a LEFT JOIN[Usr] b ON a.[Distributor_Id] = b.[Id]) TMP"; string condition = PrepareCondition(searchModel).ToString(); if (!string.IsNullOrEmpty(condition)) { sql += " WHERE " + condition; } sql += " Order by [Id] desc"; return(conn.Query <WithdrawInfo>(sql).ToList()); } }
public List <WithdrawInfo> SearchList(int currentPage, int pageSize, WithdrawSearchInfo searchModel, ref int count) { using (var conn = new SqlConnection(connectString)) { ShopMssqlPagerClass pc = new ShopMssqlPagerClass(); pc.TableName = @"(select a.*,b.[UserName],b.[RealName],b.[Mobile] from [Withdraw] a LEFT JOIN[Usr] b ON a.[Distributor_Id] = b.[Id]) TMP"; pc.Fields = "*"; pc.CurrentPage = currentPage; pc.PageSize = pageSize; pc.OrderField = "[Id]"; pc.OrderType = OrderType.Desc; pc.MssqlCondition = PrepareCondition(searchModel); count = pc.Count; return(conn.Query <WithdrawInfo>(pc).ToList()); } }
public static List <WithdrawInfo> SearchList(int currentPage, int pageSize, WithdrawSearchInfo searchModel, ref int count) { return(dal.SearchList(currentPage, pageSize, searchModel, ref count)); }
public static List <WithdrawInfo> SearchList(WithdrawSearchInfo searchModel) { return(dal.SearchList(searchModel)); }