public object GetCooByPage(int currentPage) { string typeValue = ""; //类型 int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 totalRowsAmount = CooperationBll.Instance.GetRecordCount("Status='1'"); DataTable cooTable = CooperationBll.Instance.GetListByPage("Status='1'", "ReleaseTime DESC,id DESC", pageStartRow, pageEndRow); //获得封面 for (int i = 0; i < cooTable.Rows.Count; i++) { string[] imgIds = cooTable.Rows[i]["cover"].ToString().Split(','); string imgs = ""; foreach (string imgId in imgIds) { if (!string.IsNullOrEmpty(imgId)) { ImgEntity imgEntity = ImgBll.Instance.GetModel(int.Parse(imgId)); imgs += imgEntity.ImgUrl + ","; } } cooTable.Rows[i]["cover"] = imgs; } totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString(CultureInfo.InvariantCulture)); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = typeValue, PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = cooTable, Status = StatusEnum.success }; return(dataTablePageModels); }
public object GetActivityByPage(int currentPage) { string typeValue = ""; //类型 int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 totalRowsAmount = ActivityBll.Instance.GetRecordCount("Status='1'"); DataTable activityTable = ActivityBll.Instance.GetListByPage("Status='1'", "ReleaseTime DESC,id DESC", pageStartRow, pageEndRow); //获得封面 for (int i = 0; i < activityTable.Rows.Count; i++) { if (activityTable.Rows[i]["cover"].ToString() != "") { activityTable.Rows[i]["cover"] = SmallImgBll.Instance.GetModel(Convert.ToInt32(activityTable.Rows[i]["cover"])).ImgUrl; } } totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString(CultureInfo.InvariantCulture)); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = typeValue, PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = activityTable, Status = StatusEnum.success }; return(dataTablePageModels); }
public object GetReplyByPage(string typeValue, string workId, int currentPage) { int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 string strWhere = $"Status='1' and type='{typeValue}' and workId='{workId}'"; totalRowsAmount = ReplyBll.Instance.GetRecordCount(strWhere); DataTable worksTable = ReplyBll.Instance.GetListByPage(strWhere, "ReleaseTime desc,ReplyId desc", pageStartRow, pageEndRow).Tables[0]; totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString(CultureInfo.InvariantCulture)); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = typeValue, PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = worksTable, Status = StatusEnum.success }; return(dataTablePageModels); }
public object GetWorksByPage(string typeValue, int currentPage) { int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 DataTable sysTable = SysParaBll.Instance.GetList($"Status='1' and RefType='noteType' and RefValue='{typeValue}'"); if (sysTable.Rows.Count > 0) { string strWhere = $"Status='1' and WorksType='{sysTable.Rows[0]["id"]}'"; totalRowsAmount = WorksBll.Instance.GetRecordCount(strWhere); DataTable worksTable = WorksBll.Instance.GetListByPage(strWhere, "UpdateTime desc,WorksId desc", pageStartRow, pageEndRow); //获得类型、封面 for (int i = 0; i < worksTable.Rows.Count; i++) { if (worksTable.Rows[i]["WorksType"].ToString() != "") { worksTable.Rows[i]["WorksType"] = SysParaBll.Instance.GetModel(Convert.ToInt32(worksTable.Rows[i]["WorksType"]))?.RefText; } if (worksTable.Rows[i]["type2"].ToString() != "") { worksTable.Rows[i]["type2"] = SysParaBll.Instance.GetModel(Convert.ToInt32(worksTable.Rows[i]["type2"]))?.RefText; } if (worksTable.Rows[i]["cover"].ToString() != "") { worksTable.Rows[i]["cover"] = SmallImgBll.Instance.GetModel(Convert.ToInt32(worksTable.Rows[i]["cover"])).ImgUrl; } } totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString(CultureInfo.InvariantCulture)); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = typeValue, PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = worksTable, Status = StatusEnum.success }; return(dataTablePageModels); } return(new Dictionary <string, string>() { { "status", "204" }, { "message", "无内容" } }); }
public object GetShareByPage(int currentPage) { string typeValue = ""; //类型 int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 totalRowsAmount = ExchangeBll.Instance.GetRecordCount("Status='1'"); DataTable shareTable = ExchangeBll.Instance.GetListByPage2("t.Status='1'", "addTime DESC", pageStartRow, pageEndRow).Tables[0]; //获得封面 for (int i = 0; i < shareTable.Rows.Count; i++) { if (shareTable.Rows[i]["cover"].ToString() != "") { shareTable.Rows[i]["cover"] = SmallImgBll.Instance.GetModel(Convert.ToInt32(shareTable.Rows[i]["cover"]))?.ImgUrl; } if (shareTable.Rows[i]["Certificate"].ToString() != "") { shareTable.Rows[i]["Certificate"] = ImgBll.Instance.GetModel(Convert.ToInt32(shareTable.Rows[i]["Certificate"]))?.ImgUrl; } if (shareTable.Rows[i]["Imgs"].ToString() != "") { string[] imgIds = shareTable.Rows[i]["Imgs"].ToString().Split(','); string imgs = ""; foreach (string imgId in imgIds) { int imgid; if (int.TryParse(imgId, out imgid)) { ImgEntity imgEntity = ImgBll.Instance.GetModel(imgid); imgs += imgEntity.ImgUrl + ","; } } shareTable.Rows[i]["Imgs"] = imgs; } } totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString()); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = typeValue, PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = shareTable, Status = StatusEnum.success }; return(dataTablePageModels); }
public object ShareSearch(string sea, string p) { int currentPage = int.Parse(p); //当前页 int pageSize = 10; //每页行数 int pageStartRow = (currentPage - 1) * pageSize + 1; //开始行数 int pageEndRow = currentPage * pageSize; //结束行数 int nextPage = currentPage + 1; //下一页 int totalRowsAmount; //总行数 int totalPages; //总页数 bool hasNext; //下一页 int previousPage = currentPage - 1; //上一页 bool hasPrevious = previousPage >= 1; //上一页 StringBuilder strWhere = new StringBuilder("t.status=1 "); StringBuilder sb = new StringBuilder("status=1 "); if (!string.IsNullOrEmpty(sea)) { strWhere.Append("and t.title like '%" + sea + "%'"); sb.Append("and title like '%" + sea + "%'"); } totalRowsAmount = ExchangeBll.Instance.GetRecordCount(sb.ToString()); DataTable shareTable = ExchangeBll.Instance.GetListByPage2(strWhere.ToString(), "addTime DESC", pageStartRow, pageEndRow).Tables[0]; //获得封面 for (int i = 0; i < shareTable.Rows.Count; i++) { if (!string.IsNullOrEmpty(shareTable.Rows[i]["cover"].ToString())) { shareTable.Rows[i]["cover"] = SmallImgBll.Instance.GetModel(Convert.ToInt32(shareTable.Rows[i]["cover"]))?.ImgUrl; } if (!string.IsNullOrEmpty(shareTable.Rows[i]["Certificate"].ToString())) { string[] imgIds = shareTable.Rows[i]["Certificate"].ToString().Split(','); string imgs = ""; foreach (string imgId in imgIds) { int imgid; if (int.TryParse(imgId, out imgid)) { ImgEntity imgEntity = ImgBll.Instance.GetModel(imgid); imgs += imgEntity.ImgUrl + ","; } } shareTable.Rows[i]["Certificate"] = imgs; } if (!string.IsNullOrEmpty(shareTable.Rows[i]["Imgs"].ToString())) { string[] imgIds = shareTable.Rows[i]["Imgs"].ToString().Split(','); string imgs = ""; foreach (string imgId in imgIds) { int imgid; if (int.TryParse(imgId, out imgid)) { ImgEntity imgEntity = ImgBll.Instance.GetModel(imgid); imgs += imgEntity.ImgUrl + ","; } } shareTable.Rows[i]["Imgs"] = imgs; } } totalPages = int.Parse(Math.Ceiling(totalRowsAmount / 10.0).ToString()); hasNext = nextPage <= totalPages; DataTablePageModels dataTablePageModels = new DataTablePageModels { CurrentPage = currentPage, TypeValue = "", PageSize = pageSize, PageStartRow = pageStartRow, PageEndRow = pageEndRow, NextPage = nextPage, TotalRowsAmount = totalRowsAmount, TotalPages = totalPages, HasNext = hasNext, PreviousPage = previousPage, HasPrevious = hasPrevious, Dt = shareTable, Status = StatusEnum.success }; return(dataTablePageModels); }