public ResponseFixedAssetsChangeListSearch FixedAssetsChangeListSearch(RequestFixedAssetsChangeListSearch request) { ResponseFixedAssetsChangeListSearch response = new ResponseFixedAssetsChangeListSearch(); using (cnn = GetConnection()) { var ts = cnn.BeginTransaction(); try { var user = this.UserInfoGet(request.Token, ts); AccountSetBLL account = new AccountSetBLL(cnn); var period = account.GetActivePeriod(user.AccountId, ts); var condition = new { AccountId = user.AccountId, Name = "%" + request.Name + "%" }; string sql = this.GetPageSql(@" A.*, convert(varchar(20),B.Year)+'年'+ convert(varchar(20),B.Month)+'期' as period ,C.tplId,ISCHUZHI=(SELECT 'Y' from TKS_FAS_FixedAssetsChange where ChangeType=8 and A.ParentId=ParentId)", @" TKS_FAS_FixedAssetsChange A left join tks_fas_monthPeriodInfo B on A.periodId=B.id left join tks_fas_changeType2TPL C on A.changeType=C.changeType where A.accountId=@AccountId and A.assetsname like @Name ", " createDate desc ", request.PageSize, request.PageIndex); List <TKS_FAS_FixedAssetsChangeExt> data = cnn.Query <TKS_FAS_FixedAssetsChangeExt>(sql, condition, ts).ToList(); string countSql = @"select count(1) from TKS_FAS_FixedAssetsChange where accountId=@AccountId and assetsname like @Name"; int total = int.Parse(cnn.ExecuteScalar(countSql, condition, ts).ToString()); ts.Commit(); response.IsSuccess = true; response.Message = "加载完毕"; response.PageIndex = request.PageIndex; response.Data = data; response.Total = total; return(response); } catch (Exception ex) { ts.Rollback(); return(this.DealException(response, ex) as ResponseFixedAssetsChangeListSearch); } } }
public ResponseFixedAssetsChangeListSearch FixedAssetsChangeListSearch([FromBody] RequestFixedAssetsChangeListSearch request) { try { FixedAssetsBLL bll = new FixedAssetsBLL(); return(bll.FixedAssetsChangeListSearch(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }