protected void LoadRepairData() { var search = new AssetmaintaindetailSearch(); search.Assetno = Assetno;//设备编号 int recordCount = 0; var list = AssetmaintaindetailService.RetrieveAssetmaintaindetailsPaging(search, 0, 100, out recordCount); rptRepairList.DataSource = list; rptRepairList.DataBind(); }
public List<Assetmaintaindetail> RetrieveAssetmaintaindetailsPaging(AssetmaintaindetailSearch info,int pageIndex, int pageSize,out int count) { try { StringBuilder sqlCommand = new StringBuilder(@" SELECT ""ASSETMAINTAINDETAIL"".""DETAILID"",""ASSETMAINTAINDETAIL"".""ASSETMAINTAINID"",""ASSETMAINTAINDETAIL"".""ASSETNO"",""ASSETMAINTAINDETAIL"".""PLANDATE"",""ASSETMAINTAINDETAIL"".""ACTUALDATE"", ""ASSETMAINTAINDETAIL"".""MAINTAINCONTENT"",c.StorageName,c.subcompanyname AS subcompanyname FROM ""ASSETMAINTAINDETAIL"" INNER JOIN ""ASSETMAINTAIN"" ON ""ASSETMAINTAINDETAIL"".""ASSETMAINTAINID""=""ASSETMAINTAIN"".""ASSETMAINTAINID"" INNER JOIN v_storage_address c on c.StorageTitle=ASSETMAINTAIN.STORAGETITLE and c.StorageId=ASSETMAINTAIN.STORAGEID WHERE 1=1"); #region ��ϸ��� if (!string.IsNullOrEmpty(info.Detailid)) { this.Database.AddInParameter(":Detailid",DbType.AnsiString,"%"+info.Detailid+"%"); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""DETAILID"" LIKE :Detailid"); } #endregion #region �豸ά�ޱ�� if (!string.IsNullOrEmpty(info.Assetmaintainid)) { this.Database.AddInParameter(":Assetmaintainid",DbType.AnsiString,"%"+info.Assetmaintainid+"%"); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""ASSETMAINTAINID"" LIKE :Assetmaintainid"); } #endregion #region �豸��� if (!string.IsNullOrEmpty(info.Assetno)) { this.Database.AddInParameter(":Assetno", DbType.AnsiString, info.Assetno); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""ASSETNO"" = :Assetno"); } #endregion #region �ƻ�ά������ if (info.StartPlandate.HasValue) { this.Database.AddInParameter(":StartPlandate",info.StartPlandate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""PLANDATE"" >= :StartPlandate"); } if (info.EndPlandate.HasValue) { this.Database.AddInParameter(":EndPlandate",info.EndPlandate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""PLANDATE"" <= :EndPlandate"); } #endregion #region ʵ��ά������ if (info.StartActualdate.HasValue) { this.Database.AddInParameter(":StartActualdate",info.StartActualdate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""ACTUALDATE"" >= :StartActualdate"); } if (info.EndActualdate.HasValue) { this.Database.AddInParameter(":EndActualdate",info.EndActualdate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""ACTUALDATE"" <= :EndActualdate"); } #endregion #region ά��˵�� if (!string.IsNullOrEmpty(info.Maintaincontent)) { this.Database.AddInParameter(":Maintaincontent", "%"+info.Maintaincontent+"%"); sqlCommand.AppendLine(@" AND ""ASSETMAINTAINDETAIL"".""MAINTAINCONTENT"" LIKE :Maintaincontent"); } #endregion sqlCommand.AppendLine(@" ORDER BY ""ASSETMAINTAINDETAIL"".""DETAILID"" DESC"); return this.ExecuteReaderPaging<Assetmaintaindetail>(sqlCommand.ToString(), pageIndex, pageSize, out count); } finally { this.Database.ClearParameter(); } }
public List<Assetmaintaindetail> RetrieveAssetmaintaindetailsPaging(AssetmaintaindetailSearch info,int pageIndex, int pageSize,out int count) { return Management.RetrieveAssetmaintaindetailsPaging(info,pageIndex,pageSize,out count); }