⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newpage.aspx.cs

📁 ASP.NET多线程编程(二),ASP.NET多线程编程(二) .
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Zeroone.FileSystem;
using Zeroone;

public partial class Admin_newPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string path = Path.CheckRepairPath(Request.QueryString["path"]);
            string name = Request.QueryString["name"];
            string action = Request.QueryString["action"];

            Document d = DocumentController.GetDocument(path, name);
            PageCollection pc = d.GetPages();
            this.hlkHome.NavigateUrl = Globals.ApplicationPath + "/admin" + path + "ManageDocument/" + name + ".aspx";
            rptPages.DataSource = pc;
            rptPages.DataBind();

            if (action.ToLower() == "update")
            {
                int pageIndex = int.Parse(Request.QueryString["index"]);
                Zeroone.FileSystem.Page p = pc[pageIndex];
                this.tbSubject.Text = p.Subject;
                this.tbContent.Value = p.Content;
                this.btnManage.Text = "更新";
                btnDelete.Visible = true;
                lbtnDelete.Visible = true;
            }
        }
    }
    protected void btnManage_Click(object sender, EventArgs e)
    {
        string path = Path.CheckRepairPath(Request.QueryString["path"]);
        string name = Request.QueryString["name"];
        string action = Request.QueryString["action"];

        if (action.ToLower() == "update")
        {

            Document d = DocumentController.GetDocument(path, name);
            PageCollection pc = d.GetPages();
            int pageIndex = int.Parse(Request.QueryString["index"]);
            Zeroone.FileSystem.Page p = pc[pageIndex];
            p.Subject = this.tbSubject.Text;
            p.Content = this.tbContent.Value;
            p.Update();
        }
        else
        {
            Zeroone.FileSystem.Page p = new Zeroone.FileSystem.Page();
            p.Subject = this.tbSubject.Text;
            p.Content = this.tbContent.Value;
            p.Path = Path.CheckRepairPath(path + name);
            p.Create();
        }

        //
        string gourl = Globals.ApplicationPath + "/admin" + path + "ManageDocument/" + name + ".aspx";
        Response.Redirect(gourl);
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        string path = Path.CheckRepairPath(Request.QueryString["path"]);
        string name = Request.QueryString["name"];
        string gourl = Globals.ApplicationPath + "/admin" + path + "ManageDocument/" + name + ".aspx";
        Response.Redirect(gourl);
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string path = Path.CheckRepairPath(Request.QueryString["path"]);
        string name = Request.QueryString["name"];
        int pageIndex = int.Parse(Request.QueryString["index"]);
            Document d = DocumentController.GetDocument(path, name);
            PageCollection pc = d.GetPages();
        Zeroone.FileSystem.Page p = pc[pageIndex];
        p.Delete();

        //
        string gourl = Globals.ApplicationPath + "/admin" + path + "ManageDocument/" + name + ".aspx";
        Response.Redirect(gourl);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -