DTCMS_List
【摘要】
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companyList.aspx.cs" Inherits="DTcms.Web.admin.oacmp.companyList" %><%@ Import namespace="DTcms.Common...
-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companyList.aspx.cs" Inherits="DTcms.Web.admin.oacmp.companyList" %>
-
<%@ Import namespace="DTcms.Common" %>
-
<!DOCTYPE html>
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<title>内容列表</title>
-
<script type="text/javascript" src="../../scripts/jquery/jquery-1.10.2.min.js"></script>
-
<script type="text/javascript" src="../../scripts/jquery/jquery.lazyload.min.js"></script>
-
<script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog"></script>
-
<script type="text/javascript" src="../js/layout.js"></script>
-
<link href="../skin/default/style.css" rel="stylesheet" type="text/css" />
-
<link href="../../css/pagination.css" rel="stylesheet" type="text/css" />
-
<script type="text/javascript">
-
$(function () {
-
imgLayout();
-
$(window).resize(function () {
-
imgLayout();
-
});
-
//图片延迟加载
-
$(".pic img").lazyload({ load: AutoResizeImage, effect: "fadeIn" });
-
//点击图片链接
-
$(".pic img").click(function () {
-
//$.dialog({ lock: true, title: "查看大图", content: "<img src=\"" + $(this).attr("src") + "\" />", padding: 0 });
-
var linkUrl = $(this).parent().parent().find(".foot a").attr("href");
-
if (linkUrl != "") {
-
location.href = linkUrl; //跳转到修改页面
-
}
-
});
-
});
-
//排列图文列表
-
function imgLayout() {
-
var imgWidth = $(".imglist").width();
-
var lineCount = Math.floor(imgWidth / 222);
-
var lineNum = imgWidth % 222 / (lineCount - 1);
-
$(".imglist ul").width(imgWidth + Math.ceil(lineNum));
-
$(".imglist ul li").css("margin-right", parseFloat(lineNum));
-
}
-
//等比例缩放图片大小
-
function AutoResizeImage(e, s) {
-
var img = new Image();
-
img.src = $(this).attr("src")
-
var w = img.width;
-
var h = img.height;
-
var wRatio = w / h;
-
if ((220 / wRatio) >= 165) {
-
$(this).width(220); $(this).height(220 / wRatio);
-
} else {
-
$(this).width(165 * wRatio); $(this).height(165);
-
}
-
}
-
</script>
-
</head>
-
-
<body class="mainbody">
-
<form id="form1" runat="server">
-
<!--导航栏-->
-
<div class="location">
-
<a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
-
<a href="../center.aspx" class="home"><i></i><span>首页</span></a>
-
<i class="arrow"></i>
-
<span>内容列表</span>
-
</div>
-
<!--/导航栏-->
-
-
<!--工具栏-->
-
<div class="toolbar-wrap">
-
<div id="floatHead" class="toolbar">
-
<div class="l-list">
-
<ul class="icon-list">
-
<li><a class="add" href="AppEdit.aspx?action=<%=DTEnums.ActionEnum.Add %>"><i></i><span>新增</span></a></li>
-
<li><a class="all" href="javascript:;" οnclick="checkAll(this);"><i></i><span>全选</span></a></li>
-
<li><asp:LinkButton ID="btnDelete" runat="server" CssClass="del" OnClientClick="return ExePostBack('btnDelete');" οnclick="btnDelete_Click"><i></i><span>删除</span></asp:LinkButton></li>
-
</ul>
-
</div>
-
<div class="r-list">
-
<asp:TextBox ID="txtKeywords" runat="server" CssClass="keyword" />
-
<asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn-search" οnclick="btnSearch_Click">查询</asp:LinkButton>
-
</div>
-
</div>
-
</div>
-
<!--/工具栏-->
-
-
<!--文字列表-->
-
<asp:Repeater ID="rptList1" runat="server">
-
<HeaderTemplate>
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
-
<tr>
-
<th width="6%">选择</th>
-
<th align="left">公司名称</th>
-
<th align="left" width="46%">地址</th>
-
<th width="12%">添加日期</th>
-
</tr>
-
</HeaderTemplate>
-
<ItemTemplate>
-
<tr>
-
<td align="center"><asp:CheckBox ID="chkId" CssClass="checkall" runat="server" style="vertical-align:middle;" /><asp:HiddenField ID="hidId" Value='<%#Eval("companyid")%>' runat="server" /></td>
-
<td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("companyname")%></a></td>
-
<td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("address")%></a></td>
-
<td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("createtime")%></a></td>
-
</tr>
-
</ItemTemplate>
-
<FooterTemplate>
-
<%#rptList1.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"7\">暂无记录</td></tr>" : ""%>
-
</table>
-
</FooterTemplate>
-
</asp:Repeater>
-
<!--/文字列表-->
-
-
<!--内容底部-->
-
<div class="line20"></div>
-
<div class="pagelist">
-
<div class="l-btns">
-
<span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" οnkeydοwn="return checkNumber(event);" ontextchanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
-
</div>
-
<div id="PageContent" runat="server" class="default"></div>
-
</div>
-
<!--/内容底部-->
-
</form>
-
</body>
-
</html>
-
using DTcms.Common;
-
using System;
-
using System.Collections.Generic;
-
using System.Data;
-
using System.Linq;
-
using System.Text;
-
using System.Web;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
-
namespace DTcms.Web.admin.oacmp
-
{
-
public partial class companyList : Web.UI.ManagePage
-
{
-
protected int totalCount;
-
protected int page;
-
protected int pageSize;
-
-
protected int category_id;
-
protected string channel_name = string.Empty;
-
protected string property = string.Empty;
-
protected string keywords = string.Empty;
-
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
this.category_id = DTRequest.GetQueryInt("category_id");
-
this.keywords = DTRequest.GetQueryString("keywords");
-
this.property = DTRequest.GetQueryString("property");
-
-
this.pageSize = GetPageSize(10); //每页数量
-
if (!Page.IsPostBack)
-
{
-
SchoolChkAdminLevel(); //检查权限
-
RptBind(keywords);
-
}
-
}
-
-
-
-
#region 数据绑定=================================
-
private void RptBind(string keywords)
-
{
-
this.page = DTRequest.GetQueryInt("page", 1);
-
-
//this.ddlProperty.SelectedValue = this.property;
-
this.txtKeywords.Text = this.keywords;
-
//图表或列表显示
-
BLL.oa_company bll = new BLL.oa_company();
-
-
int begin = (this.page - 1) * pageSize;
-
-
this.rptList1.DataSource = bll.GetListByPage("companyname like '%" + keywords + "%' ", " companyid desc ", begin, pageSize);
-
-
this.rptList1.DataBind();
-
//绑定页码
-
txtPageNum.Text = this.pageSize.ToString();
-
string pageUrl = Utils.CombUrlTxt("companyList.aspx", "page={0}&keywords={1}", "__id__", this.keywords);
-
-
this.totalCount = bll.GetAllList().Tables[0].Rows.Count;
-
-
PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, bll.GetList("companyname like '%" + keywords + "%' ").Tables[0].Rows.Count, pageUrl, 8);
-
}
-
#endregion
-
-
-
#region 返回每页数量=========================
-
private int GetPageSize(int _default_size)
-
{
-
int _pagesize;
-
if (int.TryParse(Utils.GetCookie("company_page_size"), out _pagesize))
-
{
-
if (_pagesize > 0)
-
{
-
return _pagesize;
-
}
-
}
-
return _default_size;
-
}
-
#endregion
-
-
//关健字查询
-
protected void btnSearch_Click(object sender, EventArgs e)
-
{
-
Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}", txtKeywords.Text));
-
}
-
-
-
//设置分页数量
-
protected void txtPageNum_TextChanged(object sender, EventArgs e)
-
{
-
int _pagesize;
-
if (int.TryParse(txtPageNum.Text.Trim(), out _pagesize))
-
{
-
if (_pagesize > 0)
-
{
-
Utils.WriteCookie("company_page_size", _pagesize.ToString(), 43200);
-
}
-
}
-
Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}&property={1}", this.keywords, this.property));
-
}
-
-
-
public void SchoolChkAdminLevel()
-
{
-
Model.manager model = GetAdminInfo();
-
if (model.role_type > 3)
-
{
-
string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
-
Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
-
Response.End();
-
}
-
}
-
-
//批量删除
-
protected void btnDelete_Click(object sender, EventArgs e)
-
{
-
SchoolChkAdminLevel(); //检查权限
-
int sucCount = 0; //成功数量
-
int errorCount = 0; //失败数量
-
BLL.oa_company bll = new BLL.oa_company();
-
Repeater rptList = new Repeater();
-
rptList = this.rptList1;
-
for (int i = 0; i < rptList.Items.Count; i++)
-
{
-
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
-
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
-
if (cb.Checked)
-
{
-
if (bll.Delete(id))
-
{
-
sucCount++;
-
}
-
else
-
{
-
errorCount++;
-
}
-
}
-
}
-
AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除学校成功"); //记录日志
-
JscriptMsg("删除成功", "companyList.aspx", "Success");
-
}
-
}
-
}
文章来源: zzzili.blog.csdn.net,作者:清雨小竹,版权归原作者所有,如需转载,请联系作者。
原文链接:zzzili.blog.csdn.net/article/details/40342831
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)