protected void LoadData(int pageIndex) { var search = new AssetremoveSearch(); search.Assetremoveid = txtSrchAssetremoveid.Text;//拆机单号 if (ucSrchStartApplydate.DateValue.HasValue) { search.StartApplydate = ucSrchStartApplydate.DateValue.Value;//申请拆机日期 } if (ucSrchEndApplydate.DateValue.HasValue) { search.EndApplydate = ucSrchEndApplydate.DateValue.Value;//申请拆机日期 } search.Storagetitle = ucSelectProject.Storagetitle;//区分字段:分公司或项目体 search.Storageid = ucSelectProject.StorageId;//项目体ID或分公司ID int recordCount = 0; var list = AssetremoveService.RetrieveAssetremovesPaging(search, pageIndex, pcData.PageSize, out recordCount); rptRemoveList.DataSource = list; rptRemoveList.DataBind(); pcData.RecordCount = recordCount; pcData.CurrentIndex = pageIndex; }
public List<Assetremove> RetrieveAssetremovesPaging(AssetremoveSearch info, int pageIndex, int pageSize, out int count) { try { StringBuilder sqlCommand = new StringBuilder(@" SELECT ""ASSETREMOVE"".""ASSETREMOVEID"",""ASSETREMOVE"".""ASSETCATEGORYID"",""ASSETREMOVE"".""APPLYDATE"",""ASSETREMOVE"".""APPLYUSERID"",""ASSETREMOVE"".""APPLYCONTENT"", ""ASSETREMOVE"".""APPROVEUSER"",""ASSETREMOVE"".""APPROVEDATE"",""ASSETREMOVE"".""APPROVERESULT"",""ASSETREMOVE"".""PLANREMOVEDATE"",""ASSETREMOVE"".""ACTUALREMOVEDATE"", ""ASSETREMOVE"".""REJECTREASON"",""ASSETREMOVE"".""CONFIRMDATE"",""ASSETREMOVE"".""CONFIRMUSER"",""ASSETREMOVE"".""REMOVEDCONTENT"",""ASSETREMOVE"".""STORAGETITLE"", ""ASSETREMOVE"".""STORAGEID"",""ASSETREMOVE"".""SUBCOMPANY"",""ASSETREMOVE"".""SUBCOMPANYCONTACTORID"",""ASSETREMOVE"".""CONTACTPHONE"",""ASSETREMOVE"".""PROJECTCONTACTORID"", ""ASSETREMOVE"".""PROJECTCONTACTORPHONE"",""ASSETREMOVE"".""CREATOR"",""ASSETREMOVE"".""CREATEDDATE"" ,SYSTEM,c.StorageName,c.subcompanyname,TU.USERNAME AS Applyusername FROM ""ASSETREMOVE"" inner join ASSETCATEGORY ON ASSETREMOVE.ASSETCATEGORYID=ASSETCATEGORY.ASSETCATEGORYID Inner join v_storage_address c on c.StorageTitle=ASSETREMOVE.STORAGETITLE and c.StorageId=ASSETREMOVE.STORAGEID INNER JOIN T_USER TU ON TU.ID=ASSETREMOVE.APPLYUSERID WHERE 1=1"); #region ������� if (!string.IsNullOrEmpty(info.Assetremoveid)) { this.Database.AddInParameter(":Assetremoveid", DbType.AnsiString, "%" + info.Assetremoveid + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""ASSETREMOVEID"" LIKE :Assetremoveid"); } #endregion #region ��Ŀ��ID��ֹ�˾ID if (!string.IsNullOrEmpty(info.Storageid) && !string.IsNullOrEmpty(info.Storagetitle)) { this.Database.AddInParameter(":Storagetitle", DbType.AnsiString, info.Storagetitle); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""STORAGETITLE"" = :Storagetitle"); this.Database.AddInParameter(":Storageid", DbType.AnsiString, info.Storageid); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""STORAGEID"" = :Storageid"); } #endregion #region (ϵͳ)�豸���� if (!string.IsNullOrEmpty(info.Assetcategoryid)) { this.Database.AddInParameter(":Assetcategoryid", DbType.AnsiString, "%" + info.Assetcategoryid + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""ASSETCATEGORYID"" LIKE :Assetcategoryid"); } #endregion #region ���������� if (info.StartApplydate.HasValue) { this.Database.AddInParameter(":StartApplydate", info.StartApplydate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPLYDATE"" >= :StartApplydate"); } if (info.EndApplydate.HasValue) { this.Database.AddInParameter(":EndApplydate", info.EndApplydate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPLYDATE"" <= :EndApplydate"); } #endregion #region ������ if (!string.IsNullOrEmpty(info.Applyuserid)) { this.Database.AddInParameter(":Applyuserid", DbType.AnsiString, "%" + info.Applyuserid + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPLYUSERID"" LIKE :Applyuserid"); } #endregion #region �������� if (!string.IsNullOrEmpty(info.Applycontent)) { this.Database.AddInParameter(":Applycontent", "%" + info.Applycontent + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPLYCONTENT"" LIKE :Applycontent"); } #endregion #region ����� if (!string.IsNullOrEmpty(info.Approveuser)) { this.Database.AddInParameter(":Approveuser", "%" + info.Approveuser + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPROVEUSER"" LIKE :Approveuser"); } #endregion #region ������� if (info.StartApprovedate.HasValue) { this.Database.AddInParameter(":StartApprovedate", info.StartApprovedate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPROVEDATE"" >= :StartApprovedate"); } if (info.EndApprovedate.HasValue) { this.Database.AddInParameter(":EndApprovedate", info.EndApprovedate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""APPROVEDATE"" <= :EndApprovedate"); } #endregion #region �ƻ�������� if (info.StartPlanremovedate.HasValue) { this.Database.AddInParameter(":StartPlanremovedate", info.StartPlanremovedate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""PLANREMOVEDATE"" >= :StartPlanremovedate"); } if (info.EndPlanremovedate.HasValue) { this.Database.AddInParameter(":EndPlanremovedate", info.EndPlanremovedate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""PLANREMOVEDATE"" <= :EndPlanremovedate"); } #endregion #region ʵ�ʲ������ if (info.StartActualremovedate.HasValue) { this.Database.AddInParameter(":StartActualremovedate", info.StartActualremovedate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""ACTUALREMOVEDATE"" >= :StartActualremovedate"); } if (info.EndActualremovedate.HasValue) { this.Database.AddInParameter(":EndActualremovedate", info.EndActualremovedate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""ACTUALREMOVEDATE"" <= :EndActualremovedate"); } #endregion #region �ܾ����� if (!string.IsNullOrEmpty(info.Rejectreason)) { this.Database.AddInParameter(":Rejectreason", "%" + info.Rejectreason + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""REJECTREASON"" LIKE :Rejectreason"); } #endregion #region ȷ������ if (info.StartConfirmdate.HasValue) { this.Database.AddInParameter(":StartConfirmdate", info.StartConfirmdate.Value.Date); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""CONFIRMDATE"" >= :StartConfirmdate"); } if (info.EndConfirmdate.HasValue) { this.Database.AddInParameter(":EndConfirmdate", info.EndConfirmdate.Value.Date.AddDays(1).AddSeconds(-1)); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""CONFIRMDATE"" <= :EndConfirmdate"); } #endregion #region ȷ���� if (!string.IsNullOrEmpty(info.Confirmuser)) { this.Database.AddInParameter(":Confirmuser", DbType.AnsiString, "%" + info.Confirmuser + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""CONFIRMUSER"" LIKE :Confirmuser"); } #endregion #region �ֹ�˾��ϵ�� if (!string.IsNullOrEmpty(info.Subcompanycontactorid)) { this.Database.AddInParameter(":Subcompanycontactorid", DbType.AnsiString, "%" + info.Subcompanycontactorid + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""SUBCOMPANYCONTACTORID"" LIKE :Subcompanycontactorid"); } #endregion #region ��ϵ�绰 if (!string.IsNullOrEmpty(info.Contactphone)) { this.Database.AddInParameter(":Contactphone", DbType.AnsiString, "%" + info.Contactphone + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""CONTACTPHONE"" LIKE :Contactphone"); } #endregion #region ��Ŀ����ϵ�� if (!string.IsNullOrEmpty(info.Projectcontactorid)) { this.Database.AddInParameter(":Projectcontactorid", DbType.AnsiString, "%" + info.Projectcontactorid + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""PROJECTCONTACTORID"" LIKE :Projectcontactorid"); } #endregion #region ��Ŀ����ϵ�绰 if (!string.IsNullOrEmpty(info.Projectcontactorphone)) { this.Database.AddInParameter(":Projectcontactorphone", DbType.AnsiString, "%" + info.Projectcontactorphone + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""PROJECTCONTACTORPHONE"" LIKE :Projectcontactorphone"); } #endregion #region ������ if (!string.IsNullOrEmpty(info.Creator)) { this.Database.AddInParameter(":Creator", DbType.AnsiString, "%" + info.Creator + "%"); sqlCommand.AppendLine(@" AND ""ASSETREMOVE"".""CREATOR"" LIKE :Creator"); } #endregion #region �����״̬ if (info.AssetRemoveStates.Count > 0) { this.Database.AddInParameter(":APPROVERESULT", info.AssetRemoveStates[0]); sqlCommand.AppendLine(@" AND (""ASSETREMOVE"".""APPROVERESULT""=:APPROVERESULT"); for (int i = 1; i < info.AssetRemoveStates.Count; i++) { this.Database.AddInParameter(":APPROVERESULT" + i.ToString(), info.AssetRemoveStates[i]); sqlCommand.AppendLine(@" OR ""ASSETREMOVE"".""APPROVERESULT""=:APPROVERESULT" + i.ToString()); } sqlCommand.AppendLine(@" )"); } #endregion sqlCommand.AppendLine(@" ORDER BY ""ASSETREMOVE"".""ASSETREMOVEID"" DESC"); return this.ExecuteReaderPaging<Assetremove>(sqlCommand.ToString(), pageIndex, pageSize, out count); } finally { this.Database.ClearParameter(); } }
public List<Assetremove> RetrieveAssetremovesPaging(AssetremoveSearch info,int pageIndex, int pageSize,out int count) { return Management.RetrieveAssetremovesPaging(info,pageIndex,pageSize,out count); }