DTCMS_List

举报
清雨小竹 发表于 2022/09/25 00:32:58 2022/09/25
【摘要】 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companyList.aspx.cs" Inherits="DTcms.Web.admin.oacmp.companyList" %><%@ Import namespace="DTcms.Common...

  
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companyList.aspx.cs" Inherits="DTcms.Web.admin.oacmp.companyList" %>
  2. <%@ Import namespace="DTcms.Common" %>
  3. <!DOCTYPE html>
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <title>内容列表</title>
  7. <script type="text/javascript" src="../../scripts/jquery/jquery-1.10.2.min.js"></script>
  8. <script type="text/javascript" src="../../scripts/jquery/jquery.lazyload.min.js"></script>
  9. <script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog"></script>
  10. <script type="text/javascript" src="../js/layout.js"></script>
  11. <link href="../skin/default/style.css" rel="stylesheet" type="text/css" />
  12. <link href="../../css/pagination.css" rel="stylesheet" type="text/css" />
  13. <script type="text/javascript">
  14. $(function () {
  15. imgLayout();
  16. $(window).resize(function () {
  17. imgLayout();
  18. });
  19. //图片延迟加载
  20. $(".pic img").lazyload({ load: AutoResizeImage, effect: "fadeIn" });
  21. //点击图片链接
  22. $(".pic img").click(function () {
  23. //$.dialog({ lock: true, title: "查看大图", content: "<img src=\"" + $(this).attr("src") + "\" />", padding: 0 });
  24. var linkUrl = $(this).parent().parent().find(".foot a").attr("href");
  25. if (linkUrl != "") {
  26. location.href = linkUrl; //跳转到修改页面
  27. }
  28. });
  29. });
  30. //排列图文列表
  31. function imgLayout() {
  32. var imgWidth = $(".imglist").width();
  33. var lineCount = Math.floor(imgWidth / 222);
  34. var lineNum = imgWidth % 222 / (lineCount - 1);
  35. $(".imglist ul").width(imgWidth + Math.ceil(lineNum));
  36. $(".imglist ul li").css("margin-right", parseFloat(lineNum));
  37. }
  38. //等比例缩放图片大小
  39. function AutoResizeImage(e, s) {
  40. var img = new Image();
  41. img.src = $(this).attr("src")
  42. var w = img.width;
  43. var h = img.height;
  44. var wRatio = w / h;
  45. if ((220 / wRatio) >= 165) {
  46. $(this).width(220); $(this).height(220 / wRatio);
  47. } else {
  48. $(this).width(165 * wRatio); $(this).height(165);
  49. }
  50. }
  51. </script>
  52. </head>
  53. <body class="mainbody">
  54. <form id="form1" runat="server">
  55. <!--导航栏-->
  56. <div class="location">
  57. <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  58. <a href="../center.aspx" class="home"><i></i><span>首页</span></a>
  59. <i class="arrow"></i>
  60. <span>内容列表</span>
  61. </div>
  62. <!--/导航栏-->
  63. <!--工具栏-->
  64. <div class="toolbar-wrap">
  65. <div id="floatHead" class="toolbar">
  66. <div class="l-list">
  67. <ul class="icon-list">
  68. <li><a class="add" href="AppEdit.aspx?action=<%=DTEnums.ActionEnum.Add %>"><i></i><span>新增</span></a></li>
  69. <li><a class="all" href="javascript:;" οnclick="checkAll(this);"><i></i><span>全选</span></a></li>
  70. <li><asp:LinkButton ID="btnDelete" runat="server" CssClass="del" OnClientClick="return ExePostBack('btnDelete');" οnclick="btnDelete_Click"><i></i><span>删除</span></asp:LinkButton></li>
  71. </ul>
  72. </div>
  73. <div class="r-list">
  74. <asp:TextBox ID="txtKeywords" runat="server" CssClass="keyword" />
  75. <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn-search" οnclick="btnSearch_Click">查询</asp:LinkButton>
  76. </div>
  77. </div>
  78. </div>
  79. <!--/工具栏-->
  80. <!--文字列表-->
  81. <asp:Repeater ID="rptList1" runat="server">
  82. <HeaderTemplate>
  83. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
  84. <tr>
  85. <th width="6%">选择</th>
  86. <th align="left">公司名称</th>
  87. <th align="left" width="46%">地址</th>
  88. <th width="12%">添加日期</th>
  89. </tr>
  90. </HeaderTemplate>
  91. <ItemTemplate>
  92. <tr>
  93. <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>
  94. <td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("companyname")%></a></td>
  95. <td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("address")%></a></td>
  96. <td><a href="AppEdit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("companyid")%>"><%#Eval("createtime")%></a></td>
  97. </tr>
  98. </ItemTemplate>
  99. <FooterTemplate>
  100. <%#rptList1.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"7\">暂无记录</td></tr>" : ""%>
  101. </table>
  102. </FooterTemplate>
  103. </asp:Repeater>
  104. <!--/文字列表-->
  105. <!--内容底部-->
  106. <div class="line20"></div>
  107. <div class="pagelist">
  108. <div class="l-btns">
  109. <span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" οnkeydοwn="return checkNumber(event);" ontextchanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
  110. </div>
  111. <div id="PageContent" runat="server" class="default"></div>
  112. </div>
  113. <!--/内容底部-->
  114. </form>
  115. </body>
  116. </html>




  
  1. using DTcms.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. namespace DTcms.Web.admin.oacmp
  11. {
  12. public partial class companyList : Web.UI.ManagePage
  13. {
  14. protected int totalCount;
  15. protected int page;
  16. protected int pageSize;
  17. protected int category_id;
  18. protected string channel_name = string.Empty;
  19. protected string property = string.Empty;
  20. protected string keywords = string.Empty;
  21. protected void Page_Load(object sender, EventArgs e)
  22. {
  23. this.category_id = DTRequest.GetQueryInt("category_id");
  24. this.keywords = DTRequest.GetQueryString("keywords");
  25. this.property = DTRequest.GetQueryString("property");
  26. this.pageSize = GetPageSize(10); //每页数量
  27. if (!Page.IsPostBack)
  28. {
  29. SchoolChkAdminLevel(); //检查权限
  30. RptBind(keywords);
  31. }
  32. }
  33. #region 数据绑定=================================
  34. private void RptBind(string keywords)
  35. {
  36. this.page = DTRequest.GetQueryInt("page", 1);
  37. //this.ddlProperty.SelectedValue = this.property;
  38. this.txtKeywords.Text = this.keywords;
  39. //图表或列表显示
  40. BLL.oa_company bll = new BLL.oa_company();
  41. int begin = (this.page - 1) * pageSize;
  42. this.rptList1.DataSource = bll.GetListByPage("companyname like '%" + keywords + "%' ", " companyid desc ", begin, pageSize);
  43. this.rptList1.DataBind();
  44. //绑定页码
  45. txtPageNum.Text = this.pageSize.ToString();
  46. string pageUrl = Utils.CombUrlTxt("companyList.aspx", "page={0}&keywords={1}", "__id__", this.keywords);
  47. this.totalCount = bll.GetAllList().Tables[0].Rows.Count;
  48. PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, bll.GetList("companyname like '%" + keywords + "%' ").Tables[0].Rows.Count, pageUrl, 8);
  49. }
  50. #endregion
  51. #region 返回每页数量=========================
  52. private int GetPageSize(int _default_size)
  53. {
  54. int _pagesize;
  55. if (int.TryParse(Utils.GetCookie("company_page_size"), out _pagesize))
  56. {
  57. if (_pagesize > 0)
  58. {
  59. return _pagesize;
  60. }
  61. }
  62. return _default_size;
  63. }
  64. #endregion
  65. //关健字查询
  66. protected void btnSearch_Click(object sender, EventArgs e)
  67. {
  68. Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}", txtKeywords.Text));
  69. }
  70. //设置分页数量
  71. protected void txtPageNum_TextChanged(object sender, EventArgs e)
  72. {
  73. int _pagesize;
  74. if (int.TryParse(txtPageNum.Text.Trim(), out _pagesize))
  75. {
  76. if (_pagesize > 0)
  77. {
  78. Utils.WriteCookie("company_page_size", _pagesize.ToString(), 43200);
  79. }
  80. }
  81. Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}&property={1}", this.keywords, this.property));
  82. }
  83. public void SchoolChkAdminLevel()
  84. {
  85. Model.manager model = GetAdminInfo();
  86. if (model.role_type > 3)
  87. {
  88. string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
  89. Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
  90. Response.End();
  91. }
  92. }
  93. //批量删除
  94. protected void btnDelete_Click(object sender, EventArgs e)
  95. {
  96. SchoolChkAdminLevel(); //检查权限
  97. int sucCount = 0; //成功数量
  98. int errorCount = 0; //失败数量
  99. BLL.oa_company bll = new BLL.oa_company();
  100. Repeater rptList = new Repeater();
  101. rptList = this.rptList1;
  102. for (int i = 0; i < rptList.Items.Count; i++)
  103. {
  104. int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
  105. CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
  106. if (cb.Checked)
  107. {
  108. if (bll.Delete(id))
  109. {
  110. sucCount++;
  111. }
  112. else
  113. {
  114. errorCount++;
  115. }
  116. }
  117. }
  118. AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除学校成功"); //记录日志
  119. JscriptMsg("删除成功", "companyList.aspx", "Success");
  120. }
  121. }
  122. }


文章来源: zzzili.blog.csdn.net,作者:清雨小竹,版权归原作者所有,如需转载,请联系作者。

原文链接:zzzili.blog.csdn.net/article/details/40342831

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。