public List<Subcompanyinfo> RetrieveSubcompanyinfosPaging(SubcompanyinfoSearch info,int pageIndex, int pageSize,out int count) { try { StringBuilder sqlCommand = new StringBuilder(@" SELECT ""SUBCOMPANYINFO"".""SUBCOMPANYID"",""SUBCOMPANYINFO"".""SUBCOMPANYNAME"",""SUBCOMPANYINFO"".""FGSSORTID"",""SUBCOMPANYINFO"".""SUBCOMPANYCODE"" FROM ""SUBCOMPANYINFO"" WHERE 1=1"); if (!string.IsNullOrEmpty(info.Subcompanyname)) { this.Database.AddInParameter(":Subcompanyname",DbType.AnsiString,"%"+info.Subcompanyname+"%"); sqlCommand.AppendLine(@" AND ""SUBCOMPANYINFO"".""SUBCOMPANYNAME"" LIKE :Subcompanyname"); } if (!string.IsNullOrEmpty(info.Fgssortid)) { this.Database.AddInParameter(":Fgssortid",DbType.AnsiString,"%"+info.Fgssortid+"%"); sqlCommand.AppendLine(@" AND ""SUBCOMPANYINFO"".""FGSSORTID"" LIKE :Fgssortid"); } if (!string.IsNullOrEmpty(info.Subcompanycode)) { this.Database.AddInParameter(":Subcompanycode",DbType.AnsiString,"%"+info.Subcompanycode+"%"); sqlCommand.AppendLine(@" AND ""SUBCOMPANYINFO"".""SUBCOMPANYCODE"" LIKE :Subcompanycode"); } sqlCommand.AppendLine(@" ORDER BY ""SUBCOMPANYINFO"".""FGSSORTID"" ASC"); return this.ExecuteReaderPaging<Subcompanyinfo>(sqlCommand.ToString(), pageIndex, pageSize, out count); } finally { this.Database.ClearParameter(); } }
protected void LoadData(int pageIndex) { var search = new SubcompanyinfoSearch(); search.Subcompanyname = txtSrchSubcompanyname.Text; var subcompanyinfoService = new SubcompanyinfoService(); int recordCount = 0; var list = subcompanyinfoService.RetrieveSubcompanyinfosPaging(search, pageIndex, pcData.PageSize, out recordCount); gvSubCompanies.DataSource = list; gvSubCompanies.DataBind(); pcData.RecordCount = recordCount; pcData.CurrentIndex = pageIndex; }
public List<Subcompanyinfo> RetrieveSubcompanyinfosPaging(SubcompanyinfoSearch info,int pageIndex, int pageSize,out int count) { return Management.RetrieveSubcompanyinfosPaging(info,pageIndex,pageSize,out count); }
protected void LoadSubCompanyData() { var search = new SubcompanyinfoSearch(); int recordCount = 0; var list = SubcompanyinfoService.RetrieveSubcompanyinfosPaging(search, 0, 10, out recordCount); list.Insert(0, new Subcompanyinfo() { Subcompanyid = 0, Subcompanyname = "全部" }); ddlSubCompanies.DataTextField = "Subcompanyname"; ddlSubCompanies.DataValueField = "Subcompanyid"; ddlSubCompanies.DataSource = list; ddlSubCompanies.DataBind(); }