标签:post set 查询 click count class 姓名 ssi bst
.net分页方法
//记录分页的总条数
DX.Model.Container.PagerDataContainer Container = new DX.Model.Container.PagerDataContainer();
int ActualPageSize = PageSize;
#region 总页数
int total = 0;
DataSet dsTotal = new DataSet();
StringBuilder sbTotal = new StringBuilder();
if (UserIdentity == 0)
{
sbTotal.Append("select count(UserID) as total FROM [dbo].[tb_e_User] WHERE 1=1"); //查询总条数
}
else
{
sbTotal.Append("select count(UserID) as total FROM [dbo].[tb_e_User] WHERE UserIdentity=" + UserIdentity); //查询总条数
}
if (UserIdentity != 0)
{
sbTotal.Append("AND UserIdentity =" + UserIdentity);
}
dsTotal = DX.DBHelper.DbHelperSQL.Query(sbTotal.ToString());
if (dsTotal.Tables.Count > 0)
{
if (dsTotal.Tables[0].Rows.Count > 0)
{
total = Convert.ToInt32(dsTotal.Tables[0].Rows[0]["total"]);
}
}
Container = GetContainerPageStr(PageSize, PageIndex, Container, total, out PageSize);
#region 分页数据
StringBuilder sbsql = new StringBuilder();
////1为普通用户 2为策划师 3为主持人 4为摄影师 5为摄像师 6为化妆师
sbsql.Append("SELECT ");
sbsql.Append("tab1.UserID,");
sbsql.Append("tab1.LoginNo,");
sbsql.Append("tab1.[RealName],");
sbsql.Append("(SELECT b.CityName FROM dbo.tb_d_Provinces b where b.ProvinceID=tab1.ProvinceID) AS ProvinceName,");
sbsql.Append("(SELECT c.CityName FROM dbo.tb_d_Provinces c where c.ProvinceID=tab1.CityID) AS CityName,");
if (UserIdentity == 3 || UserIdentity == 4 || UserIdentity == 5 || UserIdentity == 6 || UserIdentity == 7 || UserIdentity == 8)
{
sbsql.Append("(SELECT j.CityName FROM dbo.tb_d_Provinces j where j.ProvinceID=tab1.SvrProvinceID) AS SvrProvinceName,");
sbsql.Append("(SELECT k.CityName FROM dbo.tb_d_Provinces k where k.ProvinceID=tab1.SvrCityID) AS SvrCityName,");
}
sbsql.Append("tab1.[Address],");
sbsql.Append("tab1.LoginCount,");
sbsql.Append("tab1.RegisterTime,");
sbsql.Append("");
sbsql.Append("tab1.LastLoginTime,");
if (UserIdentity == 2) //策划师
{
sbsql.Append("tab1.Age, ");
sbsql.Append("tab1.Sex, ");
}
if (UserIdentity == 3 || UserIdentity == 4 || UserIdentity == 5 || UserIdentity == 6 || UserIdentity == 7 || UserIdentity == 8) //主持人
{
sbsql.Append("tab1.Age, ");
sbsql.Append("tab1.Sex, ");
if (UserIdentity == 3)
{
sbsql.Append("tab1.BodyHeight, ");
}
sbsql.Append("tab1.WorkYears, ");
sbsql.Append("ISNULL((SELECT x.SvrRMB FROM dbo.tb_e_User_PriceAdju x WHERE x.SRMBID = tab1.SRMBID ) ,0)AS SvrRMB, ");
}
sbsql.Append("tab1.ISLOCK FROM [dbo].[tb_e_User] tab1,");
sbsql.Append("(");
sbsql.Append("SELECT TOP " + PageSize + " UserID FROM ");
sbsql.Append("(");
sbsql.Append(" SELECT TOP " + (ActualPageSize * PageIndex) + " UserID FROM [dbo].[tb_e_User] WHERE 1=1 "); //
if (UserIdentity != 0)
{
sbsql.Append("AND UserIdentity =" + UserIdentity);
}
sbsql.Append("ORDER BY UserID DESC ");
sbsql.Append(" ) p ORDER BY p.UserID ASC ");
sbsql.Append(") ");
sbsql.Append("tab2 WHERE tab1.UserID= tab2.UserID ORDER BY tab1.UserID DESC ");
DataSet ds = new DataSet();
ds = DX.DBHelper.DbHelperSQL.Query(sbsql.ToString());
if (ds.Tables.Count > 0)
{
Container.Success = 1;
Container.SuccessStr = "加载成功";
Container.DsList = ds;
}
else
{
Container.DsList = listNull;
}
#endregion
return Container;
-------------------------------js分页方法--------------------------------------------------
function UserList(PageIndex,id) {
var param = { action: "CaseList", PageIndex: PageIndex, PageSize: PageSize, id: id, UserIdentity: UserIdentity };//参数拼接
var Resultstr = "";
var PagerStr = "";
Resultstr += "<thead>";
Resultstr += "<tr>";
Resultstr += "<th>用户编号</th>";
Resultstr += "<th>用户姓名</th>";
Resultstr += "<th>用户标题</th>";
Resultstr += "<th>案例类型</th>";
//Resultstr += "<th>视频地址</th>";
Resultstr += "<th>案例价格</th>";
Resultstr += "<th>浏览量</th>";
Resultstr += "<th>案例地址</th>";
Resultstr += "<th>案例时间</th>";
Resultstr += "<th>操作</th>";
if (UserIdentity == 3) {
Resultstr += "<th>案例审核</th>";
} else {
Resultstr += "<th>推荐</th>";
Resultstr += "<th>专项推荐</th>";
Resultstr += "<th>婚礼案例推荐</th>";
Resultstr += "<th>职业人案例推荐</th>";
}
Resultstr += "</tr>";
Resultstr += "</thead>";
Resultstr += "<tbody >";
$.ajax({
type: "Post",
async: true,
cache: false,
url: "/ashx/ZWY.ashx",
data: param,
dataType: "json",
success: function (data) {
if (data.Success == 1) {
$.each(data.DsList.ds, function (i, item) {
currPageIndex = data.PageIndex;
Resultstr += "<tr>";
Resultstr += "<td>";
Resultstr += "<a href=\"#\">" + item.CaseID + "</a>";
Resultstr += "</td> ";
Resultstr += "<td>" + item.RealName + "</td>";
Resultstr += "<td>" + item.Title + "</td>";
if (item.Type == 1) {
Resultstr += "<td>普通案例</td>";
} else {
Resultstr += "<td>视频案例</td>";
}
if (item.VideoUrl == "") {
//Resultstr += "<td>--</td>";
} else {
//Resultstr += "<td>" + item.VideoUrl + "</td>";
}
Resultstr += "<td>" + item.Price + "</td>";
Resultstr += "<td>" + item.PageView + "</td>";
//alert(item.RegisterTime);
Resultstr += "<td>" + item.Address + "</td>";
Resultstr += "<td>" + item.CaseTime.substring(0,10) + "</td>";
if (UserIdentity == 3) {
Resultstr += "<td><a href=‘javascript:void(0);‘ onclick=‘javascript:DeleteCase(" + PageIndex + "," + item.CaseID + ");‘> 删除</a>";
Resultstr += "<a href=‘/pages/casedetails.aspx?CaseID=" + item.CaseID + "‘ target=\"_blank\"> 查看</a>";
//Resultstr += "<td><a href=‘javascript:void(0);‘ onclick=‘javascript:AuditPass(" + PageIndex + "," + item.CaseID + ");‘> 审核通过</a>";
Resultstr += "<td><a href=‘javascript:void(0);‘ onclick=‘javascript:ShenHe(" + PageIndex + "," + item.CaseID + ");‘> 审核通过</a>";
Resultstr += "<a href=‘javascript:void(0);‘ onclick=‘javascript:ShenHe1(" + PageIndex + "," + item.CaseID + ");‘> 驳回审核</a>";
} else {
Resultstr += "<td><a href=‘javascript:void(0);‘ onclick=‘javascript:DeleteCase(" + PageIndex + "," + item.CaseID + ");‘> 删除</a> <a href=‘/pages/casedetails.aspx?CaseID=" + item.CaseID + "‘ target=\"_blank\"> 查看</a> </td>";
//Resultstr += "<td><a href=‘javascript:void(0);‘ onclick=‘javascript:Detail(" + item.UserID + ");‘>详细</a></td>";
Resultstr += "<td><input type=\"text\" id=\"Rec" + item.CaseID + "\" style=\"width:40px; height:20px; font-size:14px; padding:0;\" value=\"" + item.Recommend + "\"> <a href=‘javascript:void(0);‘ onclick=‘javascript:Recommend(" + item.CaseID + ");‘>推荐</a></td>";
Resultstr += "<td><input type=\"text\" id=\"Re" + item.CaseID + "\" style=\"width:40px; height:20px; font-size:14px; padding:0;\" value=\"" + item.specialRecommend + "\"> <a href=‘javascript:void(0);‘ onclick=‘javascript:specialRecommend(" + item.CaseID + ");‘>推荐</a></td>";
Resultstr += "<td><input type=\"text\" id=\"Recc" + item.CaseID + "\" style=\"width:40px; height:20px; font-size:14px; padding:0;\" value=\"" + item.weddingRecommend + "\"> <a href=‘javascript:void(0);‘ onclick=‘javascript:WeddingRecommend(" + item.CaseID + ");‘>推荐</a></td>";
Resultstr += "<td><input type=\"text\" id=\"Reec" + item.CaseID + "\" style=\"width:40px; height:20px; font-size:14px; padding:0;\" value=\"" + item.ProfessionalRecommend + "\"> <a href=‘javascript:void(0);‘ onclick=‘javascript:ProfessionalRecommend(" + item.CaseID + ");‘>推荐</a></td>";
}
Resultstr += "</tr>";
});
if (data.DsList.ds == "") {
Resultstr += "<tr><td colspan=11 style=\"text-align:center;\">暂无数据...</td><tr>";
// Resultstr += "<div style=\"float:left; width:300px;border:1px solid red\">暂无数据</div>";
Resultstr += "</tbody>";
$("#dynamic-table").html("");
$("#dynamic-table").html(Resultstr);
} else {
Resultstr += "</tbody>";
$("#dynamic-table").html("");
$("#dynamic-table").html(Resultstr);
}
Resultstr += "</tbody>";
$("#dynamic-table").html("");
$("#dynamic-table").html(Resultstr);
PagerStr += ‘ <div class="col-xs-6"> ‘;
PagerStr += ‘ <div id="dynamic-table_info" class="dataTables_info">共‘ + data.PageCount + ‘页 第‘ + PageIndex + ‘页 共‘ + data.TotalCount + ‘条结果</div> ‘;
PagerStr += ‘ </div> ‘;
PagerStr += ‘ <div class="col-xs-6"> ‘;
PagerStr += ‘ <div id="dynamic-table_paginate" class="dataTables_paginate paging_simple_numbers"> ‘;
PagerStr += ‘ <ul class="pagination"> ‘;
if (PageIndex == 1) {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:showtip(\‘已经是首页了\‘);">首 页</a></li> ‘;
}
else {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:PageMode(1);">首 页</a></li> ‘;
}
if (PageIndex != 1) {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:PageMode(‘ + data.PagePre + ‘);">上一页</a></li> ‘;
}
else {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" title="上一页" onclick="javascript:showtip(\‘上一页没有了\‘);">上一页</a></li> ‘;
}
if (data.PageCount != PageIndex) {
PagerStr += " <li class=\"paginate_button\"><a href=\"javascript:void(0);\" title=\"下一页\" onclick=\"javascript:PageMode(" + data.PageNext + ");\">下一页</a></li>";
}
else {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:showtip(\‘下一页没有了\‘);">下一页</a></li> ‘;
}
if (PageIndex == data.PageCount) {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:showtip(\‘已经是最后一页了\‘);">尾 页</a></li> ‘;
}
else {
PagerStr += ‘ <li class="paginate_button"><a href="javascript:void(0);" onclick="javascript:PageMode(‘ + data.PageCount + ‘)">尾 页</a></li> ‘;
}
PagerStr += ‘ </ul> ‘;
PagerStr += ‘ </div> ‘;
PagerStr += ‘ </div> ‘;
$("#pager").empty();
$("#pager").html(PagerStr);
} else {
$("#dynamic-table").html("");
$("#dynamic-table").html("暂无数据");
}
}
});
}
.net分页方法
标签:post set 查询 click count class 姓名 ssi bst
原文地址:http://www.cnblogs.com/zwyAndDong/p/7371990.html