public void QueryVendor(SAPVendorQueryVM queryVM, int pageSize, int pageIndex, string sortField, Action <dynamic> callback) { SAPVendorQueryFilter filter = queryVM.ConvertVM <SAPVendorQueryVM, SAPVendorQueryFilter>(); filter.PagingInfo = new PagingInfo() { PageIndex = pageIndex, PageSize = pageSize, SortBy = sortField }; filter.CompanyCode = CPApplication.Current.CompanyCode; string relativeUrl = "/InvoiceService/SAP/QueryVendor"; restClient.QueryDynamicData(relativeUrl, filter, (obj, args) => { if (args.FaultsHandle()) { return; } callback(args.Result); }); }
/// <summary> /// SAP供应商查询 /// </summary> /// <param name="query"></param> /// <param name="totalCount"></param> /// <returns></returns> public virtual DataTable QueryVendor(SAPVendorQueryFilter query, out int totalCount) { PagingInfoEntity pagingEntity = new PagingInfoEntity(); pagingEntity.SortField = query.PagingInfo.SortBy; pagingEntity.MaximumRows = query.PagingInfo.PageSize; pagingEntity.StartRowIndex = query.PagingInfo.PageIndex * query.PagingInfo.PageSize; CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QuerySAPVendor"); using (DynamicQuerySqlBuilder sqlBuilder = new DynamicQuerySqlBuilder( dataCommand.CommandText, dataCommand, pagingEntity, "SV.VendorSysNo desc")) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SV.VendorSysNo", DbType.Int32, "@VendorSysNo", QueryConditionOperatorType.Equal, query.VendorSysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SV.CompanyCode", DbType.StringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, query.CompanyCode); dataCommand.CommandText = sqlBuilder.BuildQuerySql(); DataTable dt = dataCommand.ExecuteDataTable(); totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount")); return(dt); } }