public List<Usermaproleinfo> RetrieveUsermaproleinfosPaging(UsermaproleinfoSearch info,int pageIndex, int pageSize,out int count) { return Management.RetrieveUsermaproleinfosPaging(info,pageIndex,pageSize,out count); }
public List<Usermaproleinfo> RetrieveUsermaproleinfosPaging(UsermaproleinfoSearch info,int pageIndex, int pageSize,out int count) { try { StringBuilder sqlCommand = new StringBuilder(@" SELECT ""USERMAPROLEINFO"".""USERID"",""USERMAPROLEINFO"".""ROLEID"",""USERMAPROLEINFO"".""LASTMODIFIEDDATE"",""USERMAPROLEINFO"".""LASTMODIFIEDBY"" FROM ""USERMAPROLEINFO"" WHERE 1=1"); if (!string.IsNullOrEmpty(info.Userid)) { this.Database.AddInParameter(":Userid",DbType.AnsiString,"%"+info.Userid+"%"); sqlCommand.AppendLine(@" AND ""USERMAPROLEINFO"".""USERID"" LIKE :Userid"); } if (!string.IsNullOrEmpty(info.Roleid)) { this.Database.AddInParameter(":Roleid",DbType.AnsiString,"%"+info.Roleid+"%"); sqlCommand.AppendLine(@" AND ""USERMAPROLEINFO"".""ROLEID"" LIKE :Roleid"); } if (info.StartLastmodifieddate.HasValue) { this.Database.AddInParameter(":StartLastmodifieddate",info.StartLastmodifieddate.Value.Date); sqlCommand.AppendLine(@" AND ""USERMAPROLEINFO"".""LASTMODIFIEDDATE"" >= :StartLastmodifieddate"); } if (info.EndLastmodifieddate.HasValue) { this.Database.AddInParameter(":EndLastmodifieddate",info.EndLastmodifieddate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""USERMAPROLEINFO"".""LASTMODIFIEDDATE"" <= :EndLastmodifieddate"); } if (!string.IsNullOrEmpty(info.Lastmodifiedby)) { this.Database.AddInParameter(":Lastmodifiedby",DbType.AnsiString,"%"+info.Lastmodifiedby+"%"); sqlCommand.AppendLine(@" AND ""USERMAPROLEINFO"".""LASTMODIFIEDBY"" LIKE :Lastmodifiedby"); } sqlCommand.AppendLine(@" ORDER BY ""USERMAPROLEINFO"".""USERID"" DESC,""USERMAPROLEINFO"".""ROLEID"" DESC"); return this.ExecuteReaderPaging<Usermaproleinfo>(sqlCommand.ToString(), pageIndex, pageSize, out count); } finally { this.Database.ClearParameter(); } }