关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

后台管理列表页css文件代码分享

发布时间:2019-11-16 17:37:46

后台管理列表页css文件参考,代码如下所示:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using DTcms.Common;
using DTcms.DBUtility;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using NetWing.Common.Data.SQLServer;
namespace DTcms.Web.admin.mailbox
{
    public partial class mailboxlist : Web.UI.ManagePage
    {
        protected int pageSize;
        protected int currentPage;
        protected string  type;//信箱类型
        protected void Page_Load(object sender, EventArgs e)
        {
            this.pageSize = GetPageSize(10); //每页数量
            string page = Request["page"];
            type = Request["type"];
            if (!string.IsNullOrEmpty(page))//当前页
            {
                currentPage = int.Parse(page);
            }
            else
            {
                currentPage = 1;
            }
            if (!Page.IsPostBack)
            {
                string pageUrl = Utils.CombUrlTxt("mailboxlist.aspx", "page={0}&type={1}", "__id__",this.type);
                //string ddd = Request["shenhe"];
                txtPageNum.Text = this.pageSize.ToString();
                string sql = "";
                if (!string.IsNullOrEmpty(type))
                {
                    sql = "select count(id) from mailbox where type='" + type + "'";
                }
                else
                {
                    sql = "select count(id) from mailbox";
                }
                //Response.Write("<h1>" + sql + "</h1>");
                int count = (int)SqlEasy.ExecuteScalar(sql);
                //数据绑定
                RptBind();
                PageContent.InnerHtml = Utils.OutPageList(this.pageSize, currentPage, count, pageUrl, 5);//8代表中间页码
            }
            }
        #region 数据绑定
        private void RptBind()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Select * FROM (   ");
            sb.Append("SELECT ROW_NUMBER()Over(order by id desc) as rowId, ");
            sb.Append("id, ");
            sb.Append("user_name, ");
            sb.Append("truename, ");
            sb.Append("idno, ");
            sb.Append("sex, ");
            sb.Append("unit, ");
            sb.Append("mobi, ");
            sb.Append("email, ");
            sb.Append("qq, ");
            sb.Append("address, ");
            sb.Append("viewpass, ");
            sb.Append("content, ");
            sb.Append("type, ");
            sb.Append("add_time, ");
            sb.Append("reply, ");
            sb.Append("status, ");
            sb.Append("up_time ");
            sb.Append(" from mailbox ");
            sb.Append(") as mytable  ");
            //sb.Append(" WHERE rowId between 1 and 10  ");
            sb.Append(" WHERE rowId between " + ((currentPage - 1) * this.pageSize + 1) + " and " + currentPage * this.pageSize + " ");
            if (!string.IsNullOrEmpty(this.type))
            {
                sb.Append(" and type='" + this.type + "'");
            }
            //Response.Write(sb.ToString());
            DataTable dt = SqlEasy.ExecuteDataTable(sb.ToString());
            rptList.DataSource = dt;
            rptList.DataBind();
            sb.Clear();
        }
        #endregion
            //批量审核
        protected void btnAudit_Click(object sender, EventArgs e)
        {
            int sucCount = 0;
            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)
                {
                    sucCount = sucCount + 1;
                    SqlEasy.ExecuteNonQuery("update mailbox set status=0 where id="+id+"");
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "审核信箱" + this.type + "成功" + sucCount + "条"); //记录日志
            JscriptMsg("审核成功" + sucCount + "条!", Utils.CombUrlTxt("mailboxlist.aspx", "page={0}&type={1}",
                this.currentPage.ToString(), this.type), "Success");
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int sucCount = 0;
            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)
                {
                    sucCount = sucCount + 1;
                    SqlEasy.ExecuteNonQuery("delete from mailbox where id=" + id + "");
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除信箱消息" + this.type + "成功" + sucCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条!", Utils.CombUrlTxt("mailboxlist.aspx", "page=1&type={0}",
                 this.type), "Success");
        }
        //设置分页数量
        protected void txtPageNum_TextChanged(object sender, EventArgs e)
        {
            int _pagesize;
            if (int.TryParse(txtPageNum.Text.Trim(), out _pagesize))
            {
                if (_pagesize > 0)
                {
                    Utils.WriteCookie("mailboxlist_page_size", _pagesize.ToString(), 43200);
                }
            }
            Response.Redirect(Utils.CombUrlTxt("mailboxlist.aspx", "page={0}&type={1}",
                this.currentPage.ToString(),this.type));
        }
        #region 返回图文每页数量=========================
        private int GetPageSize(int _default_size)
        {
            int _pagesize;
            if (int.TryParse(Utils.GetCookie("mailboxlist_page_size"), out _pagesize))
            {
                if (_pagesize > 0)
                {
                    return _pagesize;
                }
            }
            return _default_size;
        }
        #endregion
    }
}



/template/Home/Zkeys/PC/Static