Asp.NETPersonnalBlogSystem/Admin/LogList.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using Asp.NETPersonnalBlogSystem.BLL;
using Asp.NETPersonnalBlogSystem.Models;

namespace Asp.NETPersonnalBlogSystem.Admin
{
    /// <summary>
    /// 系统日志页面
    /// 提供日志的查看和搜索功能
    /// </summary>
    public partial class LogList : System.Web.UI.Page
    {
        private int pageIndex = 1;
        private int pageSize = 20;
        private LogService logService = new LogService();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadLogs();
            }
        }

        private void LoadLogs()
        {
            string logLevel = ddlLogLevel.SelectedValue;
            string logType = ddlLogType.SelectedValue;
            DateTime? startDate = null;
            DateTime? endDate = null;

            if (!string.IsNullOrEmpty(txtStartDate.Text))
            {
                startDate = Convert.ToDateTime(txtStartDate.Text);
            }
            if (!string.IsNullOrEmpty(txtEndDate.Text))
            {
                endDate = Convert.ToDateTime(txtEndDate.Text);
            }

            if (!int.TryParse(Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }

            List<SystemLog> logs = logService.GetLogList(pageIndex, pageSize, logLevel, logType, startDate, endDate);
            int totalCount = logService.GetLogCount(logLevel, logType, startDate, endDate);
            int totalPages = (int)Math.Ceiling((double)totalCount / pageSize);

            gvLogs.DataSource = logs;
            gvLogs.DataBind();

            litTotalCount.Text = totalCount.ToString();
            litCurrentPage.Text = pageIndex.ToString();
            litTotalPages.Text = totalPages.ToString();

            btnPrev.Enabled = pageIndex > 1;
            btnNext.Enabled = pageIndex < totalPages;
        }
后面还有 47 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。