/// <summary> /// 查询微信注册用户 /// </summary> public IEnumerable <WXCustomer> GetQueryWXCustomer(WXCustomerSearchCondition SearchCondition, int PageIndex, int PageSize, out int RowCount) { string sqlWhere = this.GenQueryWhere(SearchCondition); int tempRowCount = 0; DbParam[] dbParams = new DbParam[] { new DbParam("@Where", DbType.String, sqlWhere, ParameterDirection.Input), new DbParam("@PageIndex", DbType.Int32, PageIndex, ParameterDirection.Input), new DbParam("@PageSize", DbType.Int32, PageSize, ParameterDirection.Input), new DbParam("@RowCount", DbType.Int32, tempRowCount, ParameterDirection.Output) }; DataTable dt = this.ExecuteDataTable("Proc_QueryWXCustomer", dbParams); RowCount = (int)dbParams[3].Value; return(dt.ConvertToEntityCollection <WXCustomer>()); }
/// <summary> /// 查询条件 /// </summary> private string GenQueryWhere(WXCustomerSearchCondition wxCustomer) { StringBuilder sb = new StringBuilder(); if (!string.IsNullOrEmpty(wxCustomer.RealName)) { sb.Append(" and RealName like '%" + wxCustomer.RealName + "%' "); } if (!string.IsNullOrEmpty(wxCustomer.Phone)) { sb.Append(" and Phone like '%" + wxCustomer.Phone + "%' "); } if (!string.IsNullOrEmpty(wxCustomer.UnitName)) { sb.Append(" and unitName like '%" + wxCustomer.UnitName + "%' "); } if (wxCustomer.StatCreateTime.HasValue) { sb.Append(" and CreateTime>='" + wxCustomer.StatCreateTime.Value.ToString("yyyy-MM-dd") + "') "); } if (wxCustomer.EndCreateTime.HasValue) { sb.Append(" and CreateTime<='" + wxCustomer.EndCreateTime.Value.ToString("yyyy-MM-dd") + "')"); } if (wxCustomer.Status.HasValue) { if (wxCustomer.Status == 1) { sb.Append(" and [status] =1 "); } else { sb.Append(" and [status] =0 "); } } return(sb.ToString()); }