標籤: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;}#endregionreturn 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分頁方法