WebApp/Default.aspx.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using DomainModel.Entities;

//源码下载 www.51aspx.com
namespace WebApp
{
    public partial class _Default : System.Web.UI.Page
    {
        private readonly NHinbernateHelper helper = new NHinbernateHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (isAdmin) linkm1.Text = "退出管理";
                BindData();
            }
        }
        bool isAdmin
        {
            get
            {
                bool resultBool = false;
                if (Session["isadmin"] == null) { resultBool = false; }
                else { resultBool = (bool)Session["isadmin"]; }
                return resultBool;
            }
        }

        private void BindData()
        {
            ArticleHQL aHql = new ArticleHQL(helper.GetSession());
            Pagination<Article> pager = new Pagination<Article>(helper.GetSession());


            string hql = "from Article order by id desc";
            AspNetPager1.RecordCount = pager.CountRecord(hql);
            Repeater1.DataSource = pager.PageList(hql, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex);
            Repeater1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            this.BindData();
        }

        protected void btnsave_Click(object sender, EventArgs e)
        {
            if (txtusername.Text == "" || txtconent.Text == "")
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "a", "<script>alert('请填写用户名或者留言内容!');</script>");
                return;
            }
            Article art = new Article();
            art.Title = txtTitle.Text;
后面还有 78 行代码,解锁后查看完整代码

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

AI 解读

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

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