private void GetData() { Guid userId = WebUserAuth.UserId.Value; ProjectBLL bll = new ProjectBLL(); int recordCount = 0; myLoanModel = bll.WXGetMyLoanList(userId, 0, 1, GlobalUtils.PageSize, out recordCount); double divide = recordCount / GlobalUtils.PageSize; double floor = System.Math.Floor(divide); if (recordCount % GlobalUtils.PageSize != 0) { floor++; } pageCount = Convert.ToInt32(floor);//总页数 }
/// <summary> /// 获取我的借款记录列表 /// </summary> public void GetMyLoanShowList() { int pagesize = GlobalUtils.PageSize; int pageindex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1); int status = Tool.SafeConvert.ToInt32(Context.Request.Form["statusStr"], 0); string userId = Tool.SafeConvert.ToString(Context.Request.Form["userId"]); Guid uId = WebUserAuth.UserId.Value; if (uId == Guid.Empty) { if (string.IsNullOrEmpty(userId)) { uId = Guid.NewGuid(); } else { uId = Guid.Parse(userId); } } if (pageindex < 1) { pageindex = 1; } StringBuilder sb = new StringBuilder(); int totalcount = 0; ProjectBLL bll = new ProjectBLL(); WXMyLoanList_Info myLoanModel = bll.WXGetMyLoanList(uId, status, pageindex, pagesize, out totalcount); if (myLoanModel != null && myLoanModel.List.Count() > 0) { int index = 1; int pageCount = GetPageCount(totalcount, pagesize);//总页数 sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"" + pageCount + "\",\"list\":["); foreach (WXSubMyLoanList_Info temp in myLoanModel.List) { sb.Append("{\"Id\":\"" + temp.ProjectId + "\",\"Title\":\"" + temp.Title + "\",\"ProjectType\":\"" + ToolStatus.ConvertProjectType(temp.Type) + "\",\"Amount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.Amount) + "\",\"HaveBorrowedAmount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.HaveBorrowedAmount) + "\",\"ProcessStr\":\"" + borrowLog.GetProcessStr(temp) + "\",\"MonthsStr\":\"" + borrowLog.GetMonthsStr(temp) + "\",\"PrincipalInterest\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(myLoanModel.PrincipalInterest) + "\",\"LinkUrl\":\"" + borrowLog.GetLinkUrl(temp) + "\",\"CircleCss\":\"" + borrowLog.GetCircleCss(temp) + "\",\"AddDate\":\"" + Convert.ToDateTime(temp.AddDate).ToString("yyyy-MM-dd") + "\",\"DeadlineStr\":\"" + borrowLog.GetDeadlineStr(temp) + "\",\"InterestRate\":\"" + ToolStatus.DeleteZero(temp.InterestRate)); if (index == myLoanModel.List.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } } else { sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"0\"}"); } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }