protected void LoadData(int pageIndex)
 {
     RoleinfoSearch search = new RoleinfoSearch();
     search.Rolename = txtSrchRolename.Text;//角色名
     int recordCount = 0;
     var list = this.RoleinfoService.RetrieveRoleinfosPaging(search, pageIndex, pcData.PageSize, out recordCount);
     rptRoleList.DataSource = list;
     rptRoleList.DataBind();
     pcData.RecordCount = recordCount;
     pcData.CurrentIndex = pageIndex;
 }
 public List<Roleinfo> RetrieveRoleinfosPaging(RoleinfoSearch info, int pageIndex, int pageSize, out int count)
 {
     try
     {
         StringBuilder sqlCommand = new StringBuilder(@" SELECT ""ROLEINFO"".""ROLEID"",""ROLEINFO"".""ROLENAME"",""ROLEINFO"".""ROLESTATE"",""ROLEINFO"".""DESCRIPTION"",""ROLEINFO"".""ALLOWEDIT"",
              ""ROLEINFO"".""CREATEDDATE"",""ROLEINFO"".""CREATOR"",""ROLEINFO"".""LASTMODIFIEDDATE"",""ROLEINFO"".""LASTMODIFIEDBY""
              FROM ""ROLEINFO""
              WHERE 1=1");
         if (!string.IsNullOrEmpty(info.Roleid))
         {
             this.Database.AddInParameter(":Roleid", DbType.AnsiString, "%" + info.Roleid + "%");
             sqlCommand.AppendLine(@" AND ""ROLEINFO"".""ROLEID"" LIKE :Roleid");
         }
         if (!string.IsNullOrEmpty(info.Rolename))
         {
             this.Database.AddInParameter(":Rolename", "%" + info.Rolename + "%");
             sqlCommand.AppendLine(@" AND ""ROLEINFO"".""ROLENAME"" LIKE :Rolename");
         }
         if (info.Rolestates.Count > 0)
         {
             this.Database.AddInParameter(":Rolestate", info.Rolestates[0]);
             sqlCommand.AppendLine(@" AND (""ROLEINFO"".""ROLESTATE""=:Rolestate");
             for (int i = 1; i < info.Rolestates.Count; i++)
             {
                 this.Database.AddInParameter(":Rolestate" + i.ToString(), info.Rolestates[i]);
                 sqlCommand.AppendLine(@" OR ""ROLEINFO"".""ROLESTATE""=:Rolestate" + i.ToString());
             }
             sqlCommand.AppendLine(@" )");
         }
         if (!string.IsNullOrEmpty(info.Description))
         {
             this.Database.AddInParameter(":Description", "%" + info.Description + "%");
             sqlCommand.AppendLine(@" AND ""ROLEINFO"".""DESCRIPTION"" LIKE :Description");
         }
         //if (!string.IsNullOrEmpty(info.Creator))
         //{
         //    this.Database.AddInParameter(":Creator", "%" + info.Creator + "%");
         //    sqlCommand.AppendLine(@" AND ""ROLEINFO"".""CREATOR"" LIKE :Creator");
         //}
         //if (info.StartLastmodifieddate.HasValue)
         //{
         //    this.Database.AddInParameter(":StartLastmodifieddate", info.StartLastmodifieddate.Value.Date);
         //    sqlCommand.AppendLine(@" AND ""ROLEINFO"".""LASTMODIFIEDDATE"" >= :StartLastmodifieddate");
         //}
         //if (info.EndLastmodifieddate.HasValue)
         //{
         //    this.Database.AddInParameter(":EndLastmodifieddate", info.EndLastmodifieddate.Value.Date.AddDays(1).AddSeconds(-1));
         //    sqlCommand.AppendLine(@" AND ""ROLEINFO"".""LASTMODIFIEDDATE"" <= :EndLastmodifieddate");
         //}
         //if (!string.IsNullOrEmpty(info.Lstmofifiedby))
         //{
         //    this.Database.AddInParameter(":Lstmofifiedby", "%" + info.Lstmofifiedby + "%");
         //    sqlCommand.AppendLine(@" AND ""ROLEINFO"".""LSTMOFIFIEDBY"" LIKE :Lstmofifiedby");
         //}
         sqlCommand.AppendLine(@"  ORDER BY ""ROLEINFO"".""ROLEID"" DESC");
         return this.ExecuteReaderPaging<Roleinfo>(sqlCommand.ToString(), pageIndex, pageSize, out count);
     }
     finally
     {
         this.Database.ClearParameter();
     }
 }
 protected void InitRoles()
 {
     var search = new RoleinfoSearch();
     int recordCount = 0;
     search.Rolestates.Add(RoleState.Normal);
     var list = RoleinfoService.RetrieveRoleinfosPaging(search, 0, int.MaxValue, out recordCount);
     list.Insert(0, new Roleinfo() { Rolename = "==请选择==", Roleid = string.Empty });
     ddlRoleList.DataTextField = "Rolename";
     ddlRoleList.DataValueField = "Roleid";
     ddlRoleList.DataSource = list;
     ddlRoleList.DataBind();
 }
 public List<Roleinfo> RetrieveRoleinfosPaging(RoleinfoSearch info,int pageIndex, int pageSize,out int count)
 {
     return Management.RetrieveRoleinfosPaging(info,pageIndex,pageSize,out count);
 }